From 7e704d7ac997387341e920e1757c24cac0efe5e9 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 8 Feb 2016 16:36:45 -0500 Subject: Refactor the build system. Avoid recursive make. This looks like a lot, but more things should "just work". We have `make dist` now! --- Makefile | 56 +++++++++++++++++--------------------------------------- 1 file changed, 17 insertions(+), 39 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index e9c01ce..06f3fed 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,9 @@ -topdir = . -include config.mk - -################################################################################ +include $(dir $(lastword $(MAKEFILE_LIST)))/config.mk +include $(topsrcdir)/automake.head.mk # these are the resulting packages -packages=doc libretools librelib gitget xbs +packages=libretools librelib gitget xbs # and which directories they contain -doc=doc libretools=\ src \ src/abslibre-tools \ @@ -21,41 +18,22 @@ xbs=\ src/xbs-abs \ src/xbs-abslibre -################################################################################ - -all: PHONY build -copy: PHONY $(addprefix copy-, $(packages)) -build: PHONY $(addprefix build-, $(packages)) -install: PHONY $(addprefix install-,$(packages)) -clean: PHONY $(addprefix clean-, $(packages)) - rm -f po/*.pot -pot: PHONY $(addprefix pot-, $(filter-out doc,$(packages))) -check: - @cd test && ./testenv $(TESTENVFLAGS) roundup +verbs=build install uninstall mostlyclean clean distclean maintainer-clean check +$(foreach verb,$(verbs),$(foreach package,$(packages),$(eval $(verb)-$(package): $(addsuffix /$(verb),$($(package)))))) +$(foreach verb,$(verbs),$(foreach package,$(packages),$(eval .PHONY: $(verb)-$(package)))) -%/build: PHONY % - $(MAKE) -C $* -%/install: PHONY % - $(MAKE) -C $* install -%/clean: PHONY % - $(MAKE) -C $* clean -%/pot: PHONY % - $(MAKE) -C $* pot -%/everything.pot: FORCE % - $(MAKE) -C $* everything.pot +$(outdir)/check:: + cd $(@D)/test && ./testenv $(TESTENVFLAGS) roundup -.SECONDEXPANSION: -$(addprefix copy-, $(packages)): copy-%: PHONY $$(addsuffix /copy, $$($$*)) -$(addprefix build-, $(packages)): build-%: PHONY $$(addsuffix /build, $$($$*)) -$(addprefix install-,$(packages)): install-%: PHONY $$(addsuffix /install,$$($$*)) -$(addprefix clean-, $(packages)): clean-%: PHONY $$(addsuffix /clean, $$($$*)) -$(addprefix pot-, $(packages)): pot-%: PHONY po/%.pot -$(addprefix pot-, $(packages)): pot-%: PHONY po/%.pot -$(foreach p,$(packages),po/$p.pot): po/%.pot: $$(addsuffix /everything.pot,$$($$*)) +_po_rule = \ +po/%(package).pot: $(addsuffix /everything.pot,$(%(package))); \ cat $^ | msguniq -Fi --to-code=UTF-8 > '$@' || rm -f '$@' +$(foreach package,$(packages),$(eval $(subst %(package),$(package),$(value _po_rule)))) -################################################################################ +pots = +am_out_files += $(foreach package,$(packages),po/$(package).pot) +am_clean_files += .var.* +am_gen_files += .srcversion-libretools.mk .srcversion-devtools.mk +am_subdirs = src -FORCE: PHONY -PHONY: -.PHONY: PHONY +include $(topsrcdir)/automake.tail.mk -- cgit v1.2.3