aboutsummaryrefslogtreecommitdiff
path: root/apps/Makefile
diff options
context:
space:
mode:
authorpx4dev <px4@purgatory.org>2013-01-11 02:32:05 -0800
committerpx4dev <px4@purgatory.org>2013-01-11 02:32:05 -0800
commit0267782782f083c53bcf49b28e4ba2ed8c28105a (patch)
tree07bae5bd37604b0af274163bd210a338bf408d54 /apps/Makefile
parent919d53766acb1fa6acfb9e38074666167de772e9 (diff)
downloadpx4-firmware-0267782782f083c53bcf49b28e4ba2ed8c28105a.tar.gz
px4-firmware-0267782782f083c53bcf49b28e4ba2ed8c28105a.tar.bz2
px4-firmware-0267782782f083c53bcf49b28e4ba2ed8c28105a.zip
Recover changes lost to bad merging.
Diffstat (limited to 'apps/Makefile')
-rw-r--r--apps/Makefile71
1 files changed, 53 insertions, 18 deletions
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