From 1a5559aff221c699efb799c14955d9adccb99794 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Tue, 7 Jun 2011 00:54:42 +0100 Subject: [PATCH] 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. --- Makefile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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 -------------------------------------------------- -- 2.11.0