From 031f6d73fa3f482aaf4ffc77e1d3f7d9f3fe7af5 Mon Sep 17 00:00:00 2001 From: Marko Kreen Date: Tue, 20 Dec 2011 16:56:20 +0200 Subject: [PATCH] antimake: minor fixes - Move 'ProcessTargets' before 'clean' so ifdefs in latter can see changes to CLEANFILES. - Make EMBED_LIBUSUAL support srcdir != builddir --- mk/antimake.mk | 57 +++++++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 26 deletions(-) diff --git a/mk/antimake.mk b/mk/antimake.mk index 26c9935..4e2388a 100755 --- a/mk/antimake.mk +++ b/mk/antimake.mk @@ -650,14 +650,16 @@ ForEachTarget = $(call ForEachList,ForEachTarget2,$(2),$(1)) ## Utility functions for libusual link ## +_USUAL_DIR = $(call JoinPath,$(srcdir),$(USUAL_DIR)) + # module names from sources (plus headers) -UsualMods = $(trace1)$(shell $(USUAL_DIR)/find_modules.sh $(USUAL_DIR) $(wildcard $(addprefix $(srcdir)/,$(1)))) +UsualMods = $(trace1)$(shell $(_USUAL_DIR)/find_modules.sh $(_USUAL_DIR) $(wildcard $(addprefix $(srcdir)/,$(1)))) # full-path sources based on module list -UsualSrcsFull = $(wildcard $(addprefix $(USUAL_DIR)/usual/,$(addsuffix *.[ch],$(1)))) +UsualSrcsFull = $(trace1)$(wildcard $(addprefix $(_USUAL_DIR)/usual/,$(addsuffix *.[ch],$(1)))) # remove USUAL_DIR -UsualStrip = $(subst $(USUAL_DIR)/,,$(1)) +UsualStrip = $(trace1)$(subst $(_USUAL_DIR)/,,$(1)) # simple-path sources based on module list UsualSrcs = $(call UsualStrip,$(call UsualSrcsFull,$(1))) @@ -913,6 +915,9 @@ $(1)_CPPFLAGS += -I$$(USUAL_DIR) $(IFEQ) ($$(filter $$(USUAL_DIR),$(VPATH)),) VPATH += $$(USUAL_DIR) $(ENDIF) +$(IFNEQ) ($$(srcdir),$$(builddir),) +VPATH += $$(call JoinPath,$$(srcdir),$$(USUAL_DIR)) +$(ENDIF) $(ENDIF) # autodetect linker, unless given @@ -1170,10 +1175,32 @@ AM_FLAGS += real ## EMBED_SUBDIRS end + ## -## clean targets +## Now generate the rules ## +## check which target func to call +# 1=cleantgt,2=rawtgt,3=prim,4=dest,5=flags +MakeTarget = $(call $(if $(filter $(AM_BIG_PRIMARIES),$(3)),MakeBigTarget,MakeSmallTarget),$(1),$(2),$(3),$(4),$(5)) + +## process all targets in one list +# 1-list, 2-prim,3-dest,4-flags +MakeTargetList = $(foreach tgt,$($(1)),$(call MakeTarget,$(call CleanName,$(tgt)),$(tgt),$(2),$(3),$(4))) + +## process all target lists +# 1=list names +ProcessTargets = $(call ForEachTarget,MakeTarget,$(1)) + +# process non-EXTRA targets +$(eval $(call ProcessTargets,$(am_TARGETLISTS))) + +# process EXTRA_* last, they may already have been processed +$(eval $(call ProcessTargets,$(am_EXTRA_TARGETLISTS))) + +## +## clean targets +## clean: ifdef CLEANFILES @@ -1282,28 +1309,6 @@ am-show-distfiles: am-make-distfiles: $(am_FINAL_DISTFILES) $(foreach dir,$(am_DISTDIRS),@$(MAKE) $(AM_MAKEFLAGS) -C $(dir) $@ $(NewLine)) -## -## Now generate the rules -## - -## check which target func to call -# 1=cleantgt,2=rawtgt,3=prim,4=dest,5=flags -MakeTarget = $(call $(if $(filter $(AM_BIG_PRIMARIES),$(3)),MakeBigTarget,MakeSmallTarget),$(1),$(2),$(3),$(4),$(5)) - -## process all targets in one list -# 1-list, 2-prim,3-dest,4-flags -MakeTargetList = $(foreach tgt,$($(1)),$(call MakeTarget,$(call CleanName,$(tgt)),$(tgt),$(2),$(3),$(4))) - -## process all target lists -# 1=list names -ProcessTargets = $(call ForEachTarget,MakeTarget,$(1)) - -# process non-EXTRA targets -$(eval $(call ProcessTargets,$(am_TARGETLISTS))) - -# process EXTRA_* last, they may already have been processed -$(eval $(call ProcessTargets,$(am_EXTRA_TARGETLISTS))) - ## ## debug target ## -- 2.39.5