mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
Simplify the dependency and recursion setup so it's easier to add new rules
This commit is contained in:
parent
b5065e7a17
commit
8c7a1dfecc
29
Makefile.lib
29
Makefile.lib
@ -125,6 +125,9 @@ CLEAN += $(PROG)
|
||||
|
||||
all-default: $(LIB_O) $(PROGS) $(MAN1) $(MAN5)
|
||||
|
||||
# Ensure that Makefiles in subdirs are created before we recursive into them
|
||||
init-recursive: init-default
|
||||
|
||||
init-default:
|
||||
@$(foreach subdir,$(sort $(SUBDIRS)), \
|
||||
$(MKINSTALLDIRS) $(subdir) >/dev/null; \
|
||||
@ -191,28 +194,24 @@ endif
|
||||
|
||||
# Recursion:
|
||||
|
||||
.PHONY: all-recursive install-recursive clean-recursive cleanall-recursive init-recursive check-recursive test-recursive
|
||||
RULES = all install clean cleanall init check test
|
||||
RECRULES = $(addsuffix -recursive,$(RULES))
|
||||
|
||||
all-recursive install-recursive clean-recursive cleanall-recursive init-recursive check-recursive test-recursive:
|
||||
.PHONY: $(RECRULES)
|
||||
|
||||
# The -recursive rules decend all subdirs.
|
||||
$(RECRULES):
|
||||
ifdef SUBDIRS
|
||||
@$(foreach subdir,$(sort $(SUBDIRS)), \
|
||||
$(call ncmd,recmake,$(subdir),$(subst -recursive,,$@)) || exit 1;)
|
||||
endif
|
||||
|
||||
all: all-recursive all-default all-local
|
||||
install: install-recursive install-default install-local
|
||||
check: check-recursive check-default check-local
|
||||
clean: clean-recursive clean-default clean-local
|
||||
test: test-recursive test-default test-local
|
||||
# Setup the default sub commands dependency. First decend subdirs then do all
|
||||
# the default stuff and finally do any local hooks.
|
||||
$(RULES): $$@-recursive $$@-default $$@-local
|
||||
|
||||
cleanall: cleanall-recursive cleanall-default
|
||||
init: init-default init-recursive
|
||||
|
||||
all-local:
|
||||
install-local:
|
||||
clean-local:
|
||||
check-local:
|
||||
test-local:
|
||||
# Dummy rules for local hooks
|
||||
$(addsuffix -local,$(RULES)):
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
|
Loading…
Reference in New Issue
Block a user