X-Git-Url: https://git.distorted.org.uk/~mdw/firewall/blobdiff_plain/d8eafff6266e40e386421641344494c89cff4d4b..eecc0daae4d78c7998a89f667cfd498780504c25:/Makefile diff --git a/Makefile b/Makefile index 7596df7..1c48383 100644 --- a/Makefile +++ b/Makefile @@ -102,7 +102,8 @@ TARGETS = $(addsuffix .sh,$(HOSTS)) TARGETS += dummy.sh dummy.sh: base.m4 prologue.m4 dummy-payload.m4 - $(V_M4) $^ >$@.new && chmod +x $@.new && mv $@.new $@ + $(V_M4)-DFWHOST=testing $^ >$@.new + $(V_AT)chmod +x $@.new && mv $@.new $@ TARGETS += dummy-inst.sh dummy-inst.sh: dummy.sh @@ -110,16 +111,26 @@ dummy-inst.sh: dummy.sh $(V_AT)chmod +x $@.new && mv $@.new $@ ###-------------------------------------------------------------------------- +### Other utilities. + +## A list of diversions in ascending numerical order. +CLEANFILES += divs +divs: $(M4_SOURCES) $(addsuffix .m4,$(HOSTS)) + $(V_GEN)grep -n m4_divert $^ | \ + grep -v 'm4_divert(-1)' | \ + sort -t\( -k2n >$@ + +###-------------------------------------------------------------------------- ### Building. all: $(TARGETS) .PHONY: all %.sh: %.m4 $(M4_SOURCES) - $(V_M4)base.m4 $*.m4 $(MAIN_M4_SOURCES) >$@.new + $(V_M4)-DFWHOST=$* base.m4 $*.m4 $(MAIN_M4_SOURCES) >$@.new $(V_AT)chmod +x $@.new && mv $@.new $@ -clean:; rm -f $(TARGETS) *.new +clean:; rm -f $(TARGETS) *.new $(CLEANFILES) .PHONY: clean ###-------------------------------------------------------------------------- @@ -127,6 +138,7 @@ clean:; rm -f $(TARGETS) *.new ## The local machine doesn't want the complicated SSH stuff. THISHOST = $(shell hostname) +OTHERHOSTS = $(filter-out $(THISHOST), $(HOSTS)) ## Testing. check: $(THISHOST).sh @@ -138,7 +150,7 @@ install/$(THISHOST): $(THISHOST).sh $(ROOT) ./$(THISHOST).sh replace ## Installation on a remote host. -install/%: %.sh +$(addprefix install/, $(OTHERHOSTS)): install/%: %.sh if [ "x$(SCRIPTS)" != x ]; then \ for i in $(SCRIPTS); do \ $(ROOT) scp $$i root@$*:$(sbindir)/$$i.new && \ @@ -148,12 +160,12 @@ install/%: %.sh done; \ fi $(ROOT) scp $*.sh root@$*:$(FIREWALL).new - $(ROOT) ssh root@$* $(FIREWALL) remote-prepare - $(ROOT) ssh root@$* $(FIREWALL) remote-commit + $(ROOT) ssh root@$* $(FIREWALL).new remote-prepare + $(ROOT) ssh root@$* $(FIREWALL).new remote-commit $(ROOT) ssh root@$* rm -f $(FIREWALL).new ## General installation target. -install: all install/$(THISHOST) $(addprefix install/,$(HOSTS)) -.PHONY: install install/$(THISHOST) +install: all $(addprefix install/,$(HOSTS)) +.PHONY: install $(addprefix install/,$(HOSTS)) ###----- That's all, folks --------------------------------------------------