aboutsummaryrefslogtreecommitdiff
path: root/apps/system
diff options
context:
space:
mode:
Diffstat (limited to 'apps/system')
-rw-r--r--apps/system/Makefile33
-rw-r--r--apps/system/free/Makefile28
-rw-r--r--apps/system/i2c/Makefile27
-rw-r--r--apps/system/install/Makefile27
-rw-r--r--apps/system/readline/Makefile24
5 files changed, 80 insertions, 59 deletions
diff --git a/apps/system/Makefile b/apps/system/Makefile
index d64bb54c6..9955a6b2c 100644
--- a/apps/system/Makefile
+++ b/apps/system/Makefile
@@ -41,31 +41,36 @@ SUBDIRS = free i2c install readline poweroff ramtron sdcard sysinfo
# Create the list of installed runtime modules (INSTALLED_DIRS)
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
define ADD_DIRECTORY
-INSTALLED_DIRS += ${shell if [ -r $1/Makefile ]; then echo "$1"; fi}
+ 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:
context:
-depend:
- @for dir in $(INSTALLED_DIRS) ; do \
- $(MAKE) -C $$dir depend TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \
- done
-
-clean:
- @for dir in $(INSTALLED_DIRS) ; do \
- $(MAKE) -C $$dir clean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \
- done
+depend: $(foreach SDIR, $(INSTALLED_DIRS), $(SDIR)_depend)
-distclean: clean
- @for dir in $(INSTALLED_DIRS) ; do \
- $(MAKE) -C $$dir distclean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \
- done
+clean: $(foreach SDIR, $(INSTALLED_DIRS), $(SDIR)_clean)
+distclean: clean $(foreach SDIR, $(INSTALLED_DIRS), $(SDIR)_distclean)
diff --git a/apps/system/free/Makefile b/apps/system/free/Makefile
index 7f911d81c..dada00d99 100644
--- a/apps/system/free/Makefile
+++ b/apps/system/free/Makefile
@@ -1,7 +1,7 @@
############################################################################
# apps/system/free/Makefile
#
-# Copyright (C) 2011 Uros Platise. All rights reserved.
+# Copyright (C) 2011-2012 Uros Platise. All rights reserved.
# Author: Uros Platise <uros.platise@isotel.eu>
# Gregory Nutt <gnutt@nuttx.org>
#
@@ -61,10 +61,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+ BIN = ..\..\libapps$(LIBEXT)
+else
ifeq ($(WINTOOL),y)
- BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
+ BIN = ..\\..\\libapps$(LIBEXT)
else
- BIN = "$(APPDIR)/libapps$(LIBEXT)"
+ BIN = ../../libapps$(LIBEXT)
+endif
endif
ROOTDEPPATH = --dep-path .
@@ -83,32 +87,32 @@ $(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
.built: $(OBJS)
- @( for obj in $(OBJS) ; do \
- $(call ARCHIVE, $(BIN), $${obj}); \
- done ; )
- @touch .built
+ $(call ARCHIVE, $(BIN), $(OBJS))
+ $(Q) touch .built
# Register application
.context:
$(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main)
- @touch $@
+ $(Q) touch $@
context: .context
# Create dependencies
.depend: Makefile $(SRCS)
- @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
- @touch $@
+ $(Q) $(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
+ $(Q) touch $@
depend: .depend
clean:
- @rm -f *.o *~ .*.swp .built
+ $(call DELFILE, .built)
$(call CLEAN)
distclean: clean
- @rm -f .context Make.dep .depend
+ $(call DELFILE, .context)
+ $(call DELFILE, Make.dep)
+ $(call DELFILE, .depend)
-include Make.dep
diff --git a/apps/system/i2c/Makefile b/apps/system/i2c/Makefile
index 00db91bb7..029d2b6fe 100644
--- a/apps/system/i2c/Makefile
+++ b/apps/system/i2c/Makefile
@@ -48,10 +48,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+ BIN = ..\..\libapps$(LIBEXT)
+else
ifeq ($(WINTOOL),y)
- BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
+ BIN = ..\\..\\libapps$(LIBEXT)
else
- BIN = "$(APPDIR)/libapps$(LIBEXT)"
+ BIN = ../../libapps$(LIBEXT)
+endif
endif
ROOTDEPPATH = --dep-path .
@@ -73,30 +77,29 @@ $(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
.built: $(OBJS)
- @( for obj in $(OBJS) ; do \
- $(call ARCHIVE, $(BIN), $${obj}); \
- done ; )
- @touch .built
+ $(call ARCHIVE, $(BIN), $(OBJS))
+ $(Q) touch .built
.context:
$(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main)
- @touch $@
+ $(Q) touch $@
context: .context
.depend: Makefile $(SRCS)
- @$(MKDEP) $(ROOTDEPPATH) \
- $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
- @touch $@
+ $(Q) $(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
+ $(Q) touch $@
depend: .depend
clean:
- @rm -f *.o *~ .*.swp .built
+ $(call DELFILE, .built)
$(call CLEAN)
distclean: clean
- @rm -f Make.dep .depend
+ $(call DELFILE, .context)
+ $(call DELFILE, Make.dep)
+ $(call DELFILE, .depend)
-include Make.dep
diff --git a/apps/system/install/Makefile b/apps/system/install/Makefile
index 71d82f34c..6a02d859f 100644
--- a/apps/system/install/Makefile
+++ b/apps/system/install/Makefile
@@ -2,6 +2,7 @@
# apps/system/install/Makefile
#
# Copyright (C) 2011 Uros Platise. All rights reserved.
+# Copyright (C) 2012 Gregory Nutt. All rights reserved.
# Author: Uros Platise <uros.platise@isotel.eu>
# Gregory Nutt <gnutt@nuttx.org>
#
@@ -61,10 +62,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+ BIN = ..\..\libapps$(LIBEXT)
+else
ifeq ($(WINTOOL),y)
- BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
+ BIN = ..\\..\\libapps$(LIBEXT)
else
- BIN = "$(APPDIR)/libapps$(LIBEXT)"
+ BIN = ../../libapps$(LIBEXT)
+endif
endif
ROOTDEPPATH = --dep-path .
@@ -83,32 +88,32 @@ $(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
.built: $(OBJS)
- @( for obj in $(OBJS) ; do \
- $(call ARCHIVE, $(BIN), $${obj}); \
- done ; )
- @touch .built
+ $(call ARCHIVE, $(BIN), $(OBJS))
+ $(Q) touch .built
# Register application
.context:
$(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main)
- @touch $@
+ $(Q) touch $@
context: .context
# Create dependencies
.depend: Makefile $(SRCS)
- @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
- @touch $@
+ $(Q) $(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
+ $(Q) touch $@
depend: .depend
clean:
- @rm -f *.o *~ .*.swp .built
+ $(call DELFILE, .built)
$(call CLEAN)
distclean: clean
- @rm -f .context Make.dep .depend
+ $(call DELFILE, .context)
+ $(call DELFILE, Make.dep)
+ $(call DELFILE, .depend)
-include Make.dep
diff --git a/apps/system/readline/Makefile b/apps/system/readline/Makefile
index 34fab7e81..3a48d324e 100644
--- a/apps/system/readline/Makefile
+++ b/apps/system/readline/Makefile
@@ -52,10 +52,14 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+ BIN = ..\..\libapps$(LIBEXT)
+else
ifeq ($(WINTOOL),y)
- BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
+ BIN = ..\\..\\libapps$(LIBEXT)
else
- BIN = "$(APPDIR)/libapps$(LIBEXT)"
+ BIN = ../../libapps$(LIBEXT)
+endif
endif
ROOTDEPPATH = --dep-path .
@@ -74,10 +78,8 @@ $(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
.built: $(OBJS)
- @( for obj in $(OBJS) ; do \
- $(call ARCHIVE, $(BIN), $${obj}); \
- done ; )
- @touch .built
+ $(call ARCHIVE, $(BIN), $(OBJS))
+ $(Q) touch .built
# Context build phase target
@@ -86,18 +88,20 @@ context:
# Dependency build phase target
.depend: Makefile $(SRCS)
- @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
- @touch $@
+ $(Q) $(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
+ $(Q) touch $@
depend: .depend
# Housekeeping targets
clean:
- @rm -f *.o *~ .*.swp .built
+ $(call DELFILE, .built)
$(call CLEAN)
distclean: clean
- @rm -f .context Make.dep .depend
+ $(call DELFILE, .context)
+ $(call DELFILE, Make.dep)
+ $(call DELFILE, .depend)
-include Make.dep