summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-02-08 16:36:45 -0500
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-02-08 16:36:45 -0500
commit7e704d7ac997387341e920e1757c24cac0efe5e9 (patch)
treea9f30eabaaad5496397a91053d3e03bab1ea57e4 /Makefile
parent7785a72495e3eb0ea826b41720c241f58a15b601 (diff)
Refactor the build system. Avoid recursive make.
This looks like a lot, but more things should "just work". We have `make dist` now!
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile56
1 files changed, 17 insertions, 39 deletions
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