From 213a1ffca123ab7bf30ba3af57fff3c5e99f54ea Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 23 Jun 2014 20:58:18 -0400 Subject: clean up the build system --- Makefile | 59 +++++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 37 insertions(+), 22 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 4abd3a5..d4e4bf0 100644 --- a/Makefile +++ b/Makefile @@ -1,44 +1,59 @@ -prefix = /usr +DESTDIR = + +#prefix = /usr/local +prefix = /usr exec_prefix = $(prefix) -sbindir = $(exec_prefix)/sbin -libexecdir = $(exec_prefix)/lib -systemddir = $(prefix)/lib/systemd/system -confdir = /etc/conf.d +bindir = $(exec_prefix)/bin +#sbindir = $(exec_prefix)/sbin +sbindir = $(bindir) +#libexecdir = $(exec_prefix)/libexec +libexecdir = $(exec_prefix)/lib +#sysconfdir = $(prefix)/etc +sysconfdir = /etc/conf.d +systemddir = $(prefix)/lib/systemd/system pkglibexecdir = $(libexecdir)/parabolaweb-utils +pkgconffile = $(sysconfdir)/parabolaweb CFLAGS += -std=c99 -Wall -Wextra -Werror -Wno-unused-parameter CPPFLAGS += -DSCRIPT_LOCATION='"$(pkglibexecdir)/parabolaweb-changepassword.real"' -all: depends.txt parabolaweb-changepassword - -install: \ +targets = \ $(DESTDIR)$(sbindir)/parabolaweb-changepassword \ $(DESTDIR)$(sbindir)/parabolaweb-fcgi \ $(DESTDIR)$(sbindir)/parabolaweb-reporead-inotify \ $(DESTDIR)$(sbindir)/parabolaweb-update \ - $(DESTDIR)$(confdir)/parabolaweb \ $(DESTDIR)$(pkglibexecdir)/parabolaweb-changepassword.real \ $(DESTDIR)$(systemddir)/parabolaweb.service \ $(DESTDIR)$(systemddir)/parabolaweb-reporead-inotify.service -depends.txt: list-depends depends_static.txt - bash $< > $@ +all: depends.txt $(notdir $(targets)) parabolaweb.conf -%.service: %.service.in - sed 's|@sbindir@|$(sbindir)|' < $< > $@ +install: $(targets) $(sysconffile) -$(DESTDIR)$(sbindir)/%: % - install -Dm755 $< $@ +# Pattern rules -$(DESTDIR)$(sbindir)/parabolaweb-changepassword: parabolaweb-changepassword - install -Dm6755 $< $@ +%: %.in + sed -e 's|@sbindir@|$(sbindir)|' -e 's|@pkgconffile@|$(pkgconffile)|' < $< > $@ + +$(DESTDIR)$(sbindir)/%: % + $(INSTALL) -Dm755 $< $@ -$(DESTDIR)$(pkglibexecdir)/parabolaweb-changepassword.real: parabolaweb-changepassword.sh - install -Dm755 $< $@ +$(DESTDIR)$(pkglibexecdir)/%: % + $(INSTALL) -Dm755 $< $@ $(DESTDIR)$(systemddir)/%.service: %.service - install -Dm644 $< $@ + $(INSTALL) -Dm644 $< $@ + +# Specific rules + +depends.txt: list-depends depends_static.txt + $< > $@ + +$(DESTDIR)$(sbindir)/parabolaweb-changepassword: parabolaweb-changepassword + $(INSTALL) -Dm6755 $< $@ + +$(DESTDIR)(pkgconffile): parabolaweb.conf + $(INSTALL) -Dm644 $< $@ -$(DESTDIR)$(confdir)/%: %.conf - install -Dm644 $< $@ +.DELETE_ON_ERROR: -- cgit v1.2.3-54-g00ecf