From: Mark Wooding Date: Sun, 29 Dec 2013 20:02:14 +0000 (+0000) Subject: Makefile: Better `install' targets, with hostnames only. X-Git-Url: https://git.distorted.org.uk/~mdw/exim-config/commitdiff_plain/485c5db5dc2347d1f47a908dc2956cb8438493e7 Makefile: Better `install' targets, with hostnames only. Including the config mode just makes the user interface awful. --- diff --git a/Makefile b/Makefile index a88c324..60a8279 100644 --- a/Makefile +++ b/Makefile @@ -59,28 +59,32 @@ CONFIGS = $(foreach m, $(MODES), exim4-$m.conf) TARGETS += $(CONFIGS) $(CONFIGS): exim4-%.conf: $(EARLY) $$(HOOKS_$$*) $(MAIN) $$(OPTIONS_$$*) $(V_GEN)m4 -P -DMODE=$* $^ >$@.new - $(V_AT)exim4 -C$@.new -bV >/dev/null + $(V_AT)$(CHECK_$*)exim4 -C$@.new -bV >/dev/null $(V_AT)mv $@.new $@ all: $(TARGETS) +host-mode = $(notdir $(filter $1/%, $(HOST_MODES))) + +HOSTS = $(sort $(call dir-nosl, $(HOST_MODES))) THISHOST = $(shell hostname) +OTHERHOSTS = $(filter-out $(THISHOST), $(HOSTS)) ROOT = sudo -INSTALL_TARGETS = $(addprefix install-, $(HOST_MODES)) - -$(filter install-$(THISHOST)/%, $(INSTALL_TARGETS)): \ -install-$(THISHOST)/%: exim4-%.conf +install/$(THISHOST): exim4-$(call host-mode,$(THISHOST)).conf $(ROOT) install -m644 $< /etc/exim4/exim4.conf $(ROOT) service exim4 reload -$(filter-out install-$(THISHOST)/%, $(INSTALL_TARGETS)): \ -install-%: exim4-$$(notdir $$*).conf - $(ROOT) scp $< root@$(call dir-nosl,$*):/etc/exim4/exim4.conf - $(ROOT) ssh root@$(call dir-nosl,$*) service exim4 reload +show: + : $(addprefix install/, $(OTHERHOSTS)) + +$(addprefix install/, $(OTHERHOSTS)): \ +install/%: exim4-$$(call host-mode,$$*).conf + $(ROOT) scp $< root@$*:/etc/exim4/exim4.conf + $(ROOT) ssh root@$* service exim4 reload -install: $(INSTALL_TARGETS) +install: $(addprefix install/, $(HOSTS)) clean:; rm -f $(CLEANFILES) .PHONY: clean