diff --git a/Makefile b/Makefile index e4e51caa8..f440827b0 100644 --- a/Makefile +++ b/Makefile @@ -45,60 +45,42 @@ APPDIR = ${shell pwd} SUBDIRS = namedapp nshlib netutils examples vsn -# We use a non-existing .built_always to guarantee that Makefile always walks -# into the sub-directories and asks for build. NOTE that namedapp is always -# in the list of applications to be built - -BUILTIN_APPS_BUILT = namedapp/.built_always -BUILTIN_APPS_DIR = namedapp - # CONFIGURED_APPS is the list of all configured built-in directories/built action # It is created by the configured appconfig file (a copy of which appears in this -# directoy as .config) +# directory as .config) CONFIGURED_APPS = -include .config -# AVAILABLE_APPS is the list of currently available application directories. It +# BUILTIN_APPS_DIR is the list of currently available application directories. It # is the same as CONFIGURED_APPS, but filtered to exclude any non-existent apps +# namedapp is always in the list of applications to be built -AVAILABLE_APPS = +BUILTIN_APPS_DIR = namedapp -define ADD_AVAILABLE -AVAILABLE_APPS += ${shell DIR=`echo $1 | cut -d'=' -f1`; if [ -r $$DIR/Makefile ]; then echo "$1"; fi} +# Create the list of available applications (BUILTIN_APPS_DIR) + +define ADD_BUILTIN +BUILTIN_APPS_DIR += ${shell if [ -r $1/Makefile ]; then echo "$1"; fi} endef -define BUILTIN_ADD_APP -BUILTIN_APPS_DIR += ${shell echo $1 | cut -d'=' -f1} -endef - -define BUILTIN_ADD_BUILT -BUILTIN_APPS_BUILT += ${shell echo $1 | sed -e "s:=:/:g"} -endef - -# (1) Create the list of available applications (AVAILABLE_APPS), (2) Add each -# available app to the list of to build (BUILTIN_APPS_DIR), and (3) Add the -# "built" indication for each app (BUILTIN_APPS_BUILT). - -$(foreach BUILTIN, $(CONFIGURED_APPS), $(eval $(call ADD_AVAILABLE,$(BUILTIN)))) -$(foreach APP, $(AVAILABLE_APPS), $(eval $(call BUILTIN_ADD_APP,$(APP)))) -$(foreach BUILT, $(AVAILABLE_APPS), $(eval $(call BUILTIN_ADD_BUILT,$(BUILT)))) +$(foreach BUILTIN, $(CONFIGURED_APPS), $(eval $(call ADD_BUILTIN,$(BUILTIN)))) # The final build target -BIN = libapps$(LIBEXT) +BIN = libapps$(LIBEXT) # Build targets all: $(BIN) -.PHONY: $(BUILTIN_APPS_BUILT) context depend clean distclean +.PHONY: $(BUILTIN_APPS_DIR) context depend clean distclean -$(BUILTIN_APPS_BUILT): +$(BUILTIN_APPS_DIR): @for dir in $(BUILTIN_APPS_DIR) ; do \ $(MAKE) -C $$dir TOPDIR="$(TOPDIR)" APPDIR=$(APPDIR); \ done -$(BIN): $(BUILTIN_APPS_BUILT) +$(BIN): $(BUILTIN_APPS_DIR) @( for obj in $(OBJS) ; do \ $(call ARCHIVE, $@, $${obj}); \ done ; ) diff --git a/README.txt b/README.txt index e824c8a2a..af3d07304 100644 --- a/README.txt +++ b/README.txt @@ -34,7 +34,7 @@ NuttX is configured. .config is included in the toplevel apps/Makefile. As a minimum, this configuration file must define files to add to the CONFIGURED_APPS list like: - CONFIGURED_APPS += hello/.built_always poweroff/.built_always jvm/.built_always + CONFIGURED_APPS += hello poweroff jvm The form of each entry is = when: diff --git a/examples/README.txt b/examples/README.txt index 2dbef2e06..7f000dd5a 100644 --- a/examples/README.txt +++ b/examples/README.txt @@ -8,7 +8,7 @@ examples application Makefile (this path is a relative to the apps/ top- level directory). For example, - CONFIGURE_APPS += examples/ostest=.built_always + CONFIGURE_APPS += examples/ostest Selects the examples/ostest example. @@ -46,7 +46,7 @@ examples/dhcpd file in the configuration driver with instruction to build applications like: - CONFIGURED_APPS = uiplib=.built_always + CONFIGURED_APPS += uiplib examples/hello ^^^^^^^^^^^^^^ @@ -101,7 +101,7 @@ examples/igmp file in the configuration driver with instruction to build applications like: - CONFIGURED_APPS = uiplib=.built_always + CONFIGURED_APPS += uiplib examples/mm ^^^^^^^^^^^ @@ -145,7 +145,7 @@ examples/netttest file in the configuration driver with instruction to build applications like: - CONFIGURED_APPS = uiplib=.built_always + CONFIGURED_APPS += uiplib examples/nsh ^^^^^^^^^^^^ @@ -159,15 +159,15 @@ examples/nsh file in the configuration driver with instruction to build applications like: - CONFIGURED_APPS = nshlib=.built_always + CONFIGURED_APPS += nshlib And if networking is included: - CONFIGURED_APPS = uiplib=.built_always - CONFIGURED_APPS = dhcpc=.built_always - CONFIGURED_APPS = resolv=.built_always - CONFIGURED_APPS = tftp=.built_always - CONFIGURED_APPS = webclient=.built_always + CONFIGURED_APPS += uiplib + CONFIGURED_APPS += dhcpc + CONFIGURED_APPS += resolv + CONFIGURED_APPS += tftp + CONFIGURED_APPS += webclient examples/nx ^^^^^^^^^^^ @@ -332,7 +332,7 @@ examples/poll provide an appconfig file in the configuration driver with instruction to build applications like: - CONFIGURED_APPS = uiplib=.built_always + CONFIGURED_APPS += uiplib examples/romfs ^^^^^^^^^^^^^^ @@ -384,8 +384,8 @@ examples/sendmail file in the configuration driver with instruction to build applications like: - CONFIGURED_APPS = uiplib=.built_always - CONFIGURED_APPS = smtp=.built_always + CONFIGURED_APPS += uiplib + CONFIGURED_APPS += smtp examples/serloop ^^^^^^^^^^^^^^^^ @@ -412,8 +412,8 @@ examples/thttpd file in the configuration driver with instruction to build applications like: - CONFIGURED_APPS = uiplib=.built_always - CONFIGURED_APPS = thttpd=.built_always + CONFIGURED_APPS += uiplib + CONFIGURED_APPS += thttpd examples/udp ^^^^^^^^^^^^ @@ -425,7 +425,7 @@ examples/udp file in the configuration driver with instruction to build applications like: - CONFIGURED_APPS = uiplib=.built_always + CONFIGURED_APPS += uiplib examples/uip ^^^^^^^^^^^^ @@ -465,10 +465,10 @@ examples/uip file in the configuration driver with instruction to build applications like: - CONFIGURED_APPS = uiplib=.built_always - CONFIGURED_APPS = dhcpc=.built_always - CONFIGURED_APPS = resolv=.built_always - CONFIGURED_APPS = webserver=.built_always + CONFIGURED_APPS += uiplib + CONFIGURED_APPS += dhcpc + CONFIGURED_APPS += resolv + CONFIGURED_APPS += webserver examples/usbserial ^^^^^^^^^^^^^^^^^^ @@ -629,8 +629,8 @@ examples/wget file in the configuration driver with instruction to build applications like: - CONFIGURED_APPS = uiplib=.built_always - CONFIGURED_APPS = resolv=.built_always - CONFIGURED_APPS = webclient=.built_always + CONFIGURED_APPS += uiplib + CONFIGURED_APPS += resolv + CONFIGURED_APPS += webclient diff --git a/examples/nettest/Makefile b/examples/nettest/Makefile index 38b930f45..7e17227ef 100644 --- a/examples/nettest/Makefile +++ b/examples/nettest/Makefile @@ -1,7 +1,7 @@ ############################################################################ # examples/nettest/Makefile # -# Copyright (C) 2007-2008, 2010-2010 Gregory Nutt. All rights reserved. +# Copyright (C) 2007-2008, 2010-2011 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -79,7 +79,7 @@ ROOTDEPPATH = --dep-path . VPATH = all: .built -.PHONY: .built clean depend disclean +.PHONY: clean depend disclean $(TARG_AOBJS): %$(OBJEXT): %.S $(call ASSEMBLE, $<, $@) diff --git a/examples/udp/Makefile b/examples/udp/Makefile index 36aa0a169..30a48baed 100644 --- a/examples/udp/Makefile +++ b/examples/udp/Makefile @@ -1,7 +1,7 @@ ############################################################################ # apps/examples/udp/Makefile # -# Copyright (C) 2007-2008, 2010 Gregory Nutt. All rights reserved. +# Copyright (C) 2007-2008, 2011 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -79,7 +79,7 @@ ROOTDEPPATH = --dep-path . VPATH = all: .built -.PHONY: .built clean depend disclean +.PHONY: clean depend disclean $(TARG_AOBJS): %$(OBJEXT): %.S $(call ASSEMBLE, $<, $@) @@ -91,7 +91,6 @@ $(TARG_BIN): $(TARG_OBJS) $(HOST_BIN) @( for obj in $(TARG_OBJS) ; do \ $(call ARCHIVE, $@, $${obj}); \ done ; ) - @touch .built $(HOST_OBJS): %.o: %.c $(HOSTCC) -c $(HOSTCFLAGS) $< -o $@ @@ -100,6 +99,7 @@ $(HOST_BIN): $(HOST_OBJS) $(HOSTCC) $(HOSTLDFLAGS) $(HOST_OBJS) -o $@ .built: $(TARG_BIN) $(HOST_BIN) + @touch .built context: