From: Mark Wooding Date: Mon, 6 Jun 2011 23:54:42 +0000 (+0100) Subject: Makefile: Better rule hacking for installation. X-Git-Url: https://git.distorted.org.uk/~mdw/firewall/commitdiff_plain/1a5559aff221c699efb799c14955d9adccb99794 Makefile: Better rule hacking for installation. If I use static pattern rules, I can set them as phony. But I must exclude the local host rule. --- diff --git a/Makefile b/Makefile index 7596df7..8f918e5 100644 --- a/Makefile +++ b/Makefile @@ -127,6 +127,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 +139,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 +149,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) +.PHONY: install $(addprefix install/,$(HOSTS)) ###----- That's all, folks --------------------------------------------------