Use directory.mk for recursive dir makefiles

This commit is contained in:
Sebastien Lorquet 2016-06-02 16:25:51 +02:00
parent bfff5e7179
commit b354a41fd4
4 changed files with 4 additions and 160 deletions

View File

@ -33,40 +33,4 @@
# #
############################################################################ ############################################################################
-include $(TOPDIR)/.config include $(APPDIR)/Directory.mk
# Sub-directories
SUBDIRS = tiff screenshot traveler
# Sub-directories that might need context setup
CNTXTDIRS =
all: nothing
.PHONY: nothing context depend clean distclean
define SDIR_template
$(1)_$(2):
$(Q) $(MAKE) -C $(1) $(2) TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"
endef
# $(foreach SDIR, $(CNTXTDIRS), $(eval $(call SDIR_template,$(SDIR),context)))
$(foreach SDIR, $(SUBDIRS), $(eval $(call SDIR_template,$(SDIR),depend)))
$(foreach SDIR, $(SUBDIRS), $(eval $(call SDIR_template,$(SDIR),clean)))
$(foreach SDIR, $(SUBDIRS), $(eval $(call SDIR_template,$(SDIR),distclean)))
nothing:
install:
context: # $(foreach SDIR, $(CNTXTDIRS), $(SDIR)_context)
depend: $(foreach SDIR, $(SUBDIRS), $(SDIR)_depend)
clean: $(foreach SDIR, $(SUBDIRS), $(SDIR)_clean)
distclean: clean $(foreach SDIR, $(SUBDIRS), $(SDIR)_distclean)
-include Make.dep

View File

@ -33,46 +33,4 @@
# #
############################################################################ ############################################################################
-include $(TOPDIR)/.config include $(APPDIR)/Directory.mk
# Sub-directories containing interpreter runtime
SUBDIRS = bas ficl micropython pcode prun
# Create the list of installed runtime modules (INSTALLED_DIRS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
define ADD_DIRECTORY
INSTALLED_DIRS += ${shell if exist $1\Makefile (echo $1)}
endef
else
define ADD_DIRECTORY
INSTALLED_DIRS += ${shell if [ -r $1/Makefile ]; then echo "$1"; fi}
endef
endif
$(foreach DIR, $(SUBDIRS), $(eval $(call ADD_DIRECTORY,$(DIR))))
all: nothing
.PHONY: nothing context depend clean distclean
define SDIR_template
$(1)_$(2):
$(Q) $(MAKE) -C $(1) $(2) TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"
endef
$(foreach SDIR, $(INSTALLED_DIRS), $(eval $(call SDIR_template,$(SDIR),depend)))
$(foreach SDIR, $(INSTALLED_DIRS), $(eval $(call SDIR_template,$(SDIR),clean)))
$(foreach SDIR, $(INSTALLED_DIRS), $(eval $(call SDIR_template,$(SDIR),distclean)))
nothing:
install:
context:
depend: $(foreach SDIR, $(INSTALLED_DIRS), $(SDIR)_depend)
clean: $(foreach SDIR, $(INSTALLED_DIRS), $(SDIR)_clean)
distclean: $(foreach SDIR, $(INSTALLED_DIRS), $(SDIR)_distclean)

View File

@ -33,37 +33,4 @@
# #
############################################################################ ############################################################################
-include $(TOPDIR)/.config # Current configuration include $(APPDIR)/Directory.mk
# Sub-directories
SUBDIRS = chat json codecs esp8266
ifeq ($(CONFIG_NET),y)
SUBDIRS += netlib dhcpc dhcpd discover ftpc ftpd smtp telnetd
SUBDIRS += webclient webserver tftpc thttpd xmlrpc pppd
endif
all: nothing
.PHONY: nothing context depend clean distclean
define SDIR_template
$(1)_$(2):
$(Q) $(MAKE) -C $(1) $(2) TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"
endef
$(foreach SDIR, $(SUBDIRS), $(eval $(call SDIR_template,$(SDIR),depend)))
$(foreach SDIR, $(SUBDIRS), $(eval $(call SDIR_template,$(SDIR),clean)))
$(foreach SDIR, $(SUBDIRS), $(eval $(call SDIR_template,$(SDIR),distclean)))
nothing:
install:
context:
depend: $(foreach SDIR, $(SUBDIRS), $(SDIR)_depend)
clean: $(foreach SDIR, $(SUBDIRS), $(SDIR)_clean)
distclean: $(foreach SDIR, $(SUBDIRS), $(SDIR)_distclean)

View File

@ -33,49 +33,4 @@
# #
############################################################################ ############################################################################
-include $(TOPDIR)/.config # Current configuration include $(APPDIR)/Directory.mk
# Sub-directories containing system tasks/libraries
SUBDIRS = cdcacm cle composite cu flash_eraseall free i2c hex2bin install
SUBDIRS += hexed lm75 mdio netdb nxplayer ramtest readline
SUBDIRS += stackmonitor sudoku symtab ubloxmodem usbmonitor usbmsc vi
SUBDIRS += zmodem zoneinfo
# Create the list of installed runtime modules (INSTALLED_DIRS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
define ADD_DIRECTORY
INSTALLED_DIRS += $(if $(wildcard .\$1\Makefile),$1,)
endef
else
define ADD_DIRECTORY
INSTALLED_DIRS += $(if $(wildcard ./$1/Makefile),$1,)
endef
endif
$(foreach DIR, $(SUBDIRS), $(eval $(call ADD_DIRECTORY,$(DIR))))
all: nothing
.PHONY: nothing context depend clean distclean
define SDIR_template
$(1)_$(2):
$(Q) $(MAKE) -C $(1) $(2) TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"
endef
$(foreach SDIR, $(INSTALLED_DIRS), $(eval $(call SDIR_template,$(SDIR),depend)))
$(foreach SDIR, $(INSTALLED_DIRS), $(eval $(call SDIR_template,$(SDIR),clean)))
$(foreach SDIR, $(INSTALLED_DIRS), $(eval $(call SDIR_template,$(SDIR),distclean)))
nothing:
install:
context:
depend: $(foreach SDIR, $(INSTALLED_DIRS), $(SDIR)_depend)
clean: $(foreach SDIR, $(INSTALLED_DIRS), $(SDIR)_clean)
distclean: $(foreach SDIR, $(INSTALLED_DIRS), $(SDIR)_distclean)