diff options
-rw-r--r-- | Makefile | 16 |
1 files changed, 10 insertions, 6 deletions
@@ -33,7 +33,7 @@ all: package _main = $(_$(func)_main) _hash = _memoized_$(_$(func)_hash) -memoized = $(if $($(_hash)),,$(eval $(_hash) := _ $(_main)))$(wordlist 2,$(words $($(_hash))),$($(_hash))) +memoized = $(if $($(_hash)),,$(eval $(_hash) := _ $(_main)))$(call rest,$($(_hash))) # utilities #################################################################### @@ -61,6 +61,10 @@ file2 = $(foreach file,$2,$(call _file2_memo,$1,$(file))) specs_for = $(strip $(foreach t,$1,$(filter $t|%,$(if $2,$2,$(specs))))) +# These are equivalent to the same functions in GSML +rest = $(wordlist 2,$(words $1),$1) +merge = $(firstword $2)$(if $(call rest,$2),$1$(call merge,$1,$(call rest,$2))) + # configuration ################################################################ # Load conf/sources.mk @@ -74,9 +78,9 @@ export bindir := $(shell $(CAT) conf/bindir.txt) # Post-processing for conf/sources.mk packages := $(filter-out _%,$(variables)) -packages_specific=$(filter $(patsubst rules/%/Makefile,%,$(wildcard rules/*/Makefile)),$(packages)) -packages_stub =$(foreach package,$(packages),$(if $(filter stub,$(call name2,type,$(package))),$(package))) -packages_generic =$(filter-out $(packages_specific) $(packages_stub),$(packages)) +packages_specific := $(filter $(patsubst rules/%/Makefile,%,$(wildcard rules/*/Makefile)),$(packages)) +packages_stub := $(foreach package,$(packages),$(if $(filter stub,$(call name2,type,$(package))),$(package))) +packages_generic := $(filter-out $(packages_specific) $(packages_stub),$(packages)) specs := $(foreach variable,$(variables),$(if $(findstring |,$($(variable))),$($(variable)))) tarbombs := $(addprefix build/extract/,$(call spec2,base,$(_tarbombs))) @@ -213,10 +217,10 @@ package: PHONY $(addprefix build/packages/,$(packages)) _dirs2jars = $(if $1,$(shell $(FIND) $1 -name '*.jar')) _deps2jars = $(filter %.jar,$1) $(call _dirs2jars,$(filter build/packages/%,$1)) -deps2classpath = $(shell $(ECHO) $(abspath $(call _deps2jars,$1)) $(CLASSPATH) | $(SED) 'y/ /:/') +deps2classpath = $(call merge,:,$(abspath $(call _deps2jars,$1)) $(CLASSPATH)) _deps2bindirs = $(if $1,$(sort $(shell $(FIND) $1 -type f -executable -printf '%h\n' 2>/dev/null))) -deps2path = $(shell $(ECHO) $(abspath $(call _deps2bindirs,$(filter build/packages/%,$1))) $(PATH) | $(SED) 'y/ /:/') +deps2path = $(call merge,:,$(abspath $(call _deps2bindirs,$(filter build/packages/%,$1))) $(PATH)) recurse = \ PATH='$(call deps2path,$^)' \ |