From 0267782782f083c53bcf49b28e4ba2ed8c28105a Mon Sep 17 00:00:00 2001 From: px4dev Date: Fri, 11 Jan 2013 02:32:05 -0800 Subject: Recover changes lost to bad merging. --- apps/Makefile | 71 ++++++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 53 insertions(+), 18 deletions(-) (limited to 'apps/Makefile') diff --git a/apps/Makefile b/apps/Makefile index 11d95bc19..f0de58e25 100644 --- a/apps/Makefile +++ b/apps/Makefile @@ -107,7 +107,7 @@ endif # Create the list of available applications (INSTALLED_APPS) define ADD_BUILTIN -INSTALLED_APPS += ${shell if [ -r $1/Makefile ]; then echo "$1"; fi} + INSTALLED_APPS += $(if $(wildcard $1$(DELIM)Makefile),$1,) endef $(foreach BUILTIN, $(CONFIGURED_APPS), $(eval $(call ADD_BUILTIN,$(BUILTIN)))) @@ -120,8 +120,10 @@ INSTALLED_APPS += $(EXTERNAL_APPS) # provided by the user (possibly as a symbolic link) to add libraries and # applications to the standard build from the repository. -INSTALLED_APPS += ${shell if [ -r external/Makefile ]; then echo "external"; fi} -SUBDIRS += ${shell if [ -r external/Makefile ]; then echo "external"; fi} +EXTERNAL_DIR := $(dir $(wildcard external$(DELIM)Makefile)) + +INSTALLED_APPS += $(EXTERNAL_DIR) +SUBDIRS += $(EXTERNAL_DIR) # The final build target @@ -133,48 +135,81 @@ all: $(BIN) .PHONY: $(INSTALLED_APPS) context depend clean distclean $(INSTALLED_APPS): - @$(MAKE) -C $@ TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; + $(Q) $(MAKE) -C $@ TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" $(BIN): $(INSTALLED_APPS) - @( for obj in $(OBJS) ; do \ - $(call ARCHIVE, $@, $${obj}); \ - done ; ) .context: - @for dir in $(INSTALLED_APPS) ; do \ +ifeq ($(CONFIG_WINDOWS_NATIVE),y) + $(Q) for %%G in ($(INSTALLED_APPS)) do ( \ + if exist %%G\.context del /f /q %%G\.context \ + $(MAKE) -C %%G TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" context \ + ) +else + $(Q) for dir in $(INSTALLED_APPS) ; do \ rm -f $$dir/.context ; \ - $(MAKE) -C $$dir TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" context ; \ + $(MAKE) -C $$dir TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" context ; \ done - @touch $@ +endif + $(Q) touch $@ context: .context .depend: context Makefile $(SRCS) - @for dir in $(INSTALLED_APPS) ; do \ +ifeq ($(CONFIG_WINDOWS_NATIVE),y) + $(Q) for %%G in ($(INSTALLED_APPS)) do ( \ + if exist %%G\.depend del /f /q %%G\.depend \ + $(MAKE) -C %%G TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" depend \ + ) +else + $(Q) for dir in $(INSTALLED_APPS) ; do \ rm -f $$dir/.depend ; \ - $(MAKE) -C $$dir TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" depend ; \ + $(MAKE) -C $$dir TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" depend ; \ done - @touch $@ +endif + $(Q) touch $@ depend: .depend clean: - @for dir in $(SUBDIRS) ; do \ +ifeq ($(CONFIG_WINDOWS_NATIVE),y) + $(Q) for %%G in ($(SUBDIRS)) do ( \ + $(MAKE) -C %%G clean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" \ + ) +else + $(Q) for dir in $(SUBDIRS) ; do \ $(MAKE) -C $$dir clean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \ done - @rm -f $(BIN) *~ .*.swp *.o +endif + $(call DELFILE, $(BIN)) $(call CLEAN) distclean: # clean - @for dir in $(SUBDIRS) ; do \ +ifeq ($(CONFIG_WINDOWS_NATIVE),y) + $(Q) for %%G in ($(SUBDIRS)) do ( \ + $(MAKE) -C %%G distclean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" \ + ) + $(call DELFILE, .config) + $(call DELFILE, .context) + $(call DELFILE, .depend) + $(Q) ( if exist external ( \ + echo ********************************************************" \ + echo * The external directory/link must be removed manually *" \ + echo ********************************************************" \ + ) +else + $(Q) for dir in $(SUBDIRS) ; do \ $(MAKE) -C $$dir distclean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \ done - @rm -f .config .context .depend - @( if [ -e external ]; then \ + $(call DELFILE, .config) + $(call DELFILE, .context) + $(call DELFILE, .depend) + $(Q) ( if [ -e external ]; then \ echo "********************************************************"; \ echo "* The external directory/link must be removed manually *"; \ echo "********************************************************"; \ fi; \ ) +endif -- cgit v1.2.3