summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--[l---------]Makefile60
1 files changed, 59 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 4ecdba5..a745ecf 120000..100644
--- a/Makefile
+++ b/Makefile
@@ -1 +1,59 @@
-build-aux/Makefile.README.mk \ No newline at end of file
+# Copyright 2016 Luke Shumaker
+# License: WTFPLv2
+
+prefix = /usr/local
+bindir = $(prefix)/bin
+systemddir = $(prefix)/lib/systemd/system
+sysconfdir = $(prefix)/etc
+pkgconfdir = $(sysconfdir)/httpconnectd
+DESTDIR =
+Q = @
+
+########################################################################
+
+MAKEFLAGS += -r
+vars = $(patsubst .var.%,%,$(filter .var.%,$^))
+build_targets += httpconnectd httpconnectd@.service httpconnectd.socket
+build_targets += httpsconnectd httpsconnectd.service
+build_targets += basicauth.conf-sample
+install_targets += $(DESTDIR)$(bindir)/httpconnectd $(DESTDIR)$(systemddir)/httpconnectd@.service $(DESTDIR)$(systemddir)/httpconnectd.socket
+install_targets += $(DESTDIR)$(bindir)/httpsconnectd $(DESTDIR)$(systemddir)/httpsconnectd.service $(DESTDIR)$(pkgconfdir)/https.conf
+install_targets += $(DESTDIR)$(pkgconfdir)/basicauth.conf-sample
+
+all: $(build_targets)
+install: $(install_targets)
+clean:
+ rm -f -- httpconnectd httpconnectd.sh httpconnectd@.service
+ rm -f -- httpsconnectd httpsconnectd.sh httpsconnectd.service
+uninstall:
+ rm -f -- $(install_targets)
+ rmdir -p -- $(dir $(install_targets))
+.PHONY: all install clean uninstall
+
+httpconnectd@.service: .var.bindir
+httpconnectd.sh: .var.pkgconfdir
+
+httpsconnectd.service: .var.bindir
+httpsconnectd.sh: .var.pkgconfdir
+
+########################################################################
+
+%: %.sh
+ install -m755 $< $@
+
+%: %.in
+ $(if $(Q),$(Q)echo 'EDIT < $< > $@';)$(if $(vars),sed $(foreach v,$(vars), -e 's|@$(v)@|$($(v))|g' ),cat) < $< > $@
+
+$(DESTDIR)$(bindir)/%: %
+ install -Dm755 $< $@
+$(DESTDIR)$(systemddir)/%: %
+ install -Dm644 $< $@
+$(DESTDIR)$(pkgconfdir)/%: %
+ install -Dm644 $< $@
+
+.var.%: FORCE
+ $(Q)printf '%s' '$($*)' > .tmp$@ && { cmp -s .tmp$@ $@ && rm -f -- .tmp$@ || mv -Tf .tmp$@ $@; } || { rm -f -- .tmp$@; false; }
+
+.DELETE_ON_ERROR:
+.SECONDARY:
+.PHONY: FORCE