diff --git a/apps/ChangeLog.txt b/apps/ChangeLog.txt index 9d64b5c74..681802a56 100755 --- a/apps/ChangeLog.txt +++ b/apps/ChangeLog.txt @@ -10,4 +10,7 @@ * Makefile -- Makefile cosmetics (I am slowly adding the Darjeeling JVM) * Make.defs -- New file adds common make definitions for applications. * hello/Makefile -- Now uses new Make.defs definitions. Added README.txt. - * apps/poweroff -- New application to turn off board power. \ No newline at end of file + * apps/poweroff -- New application to turn off board power. + * Moved NSH library, netutils, and examples from the nuttx/ directory to + the apps/ directory + * Moved exec_nuttapp machinery into the nuttapp/ directory. diff --git a/apps/Make.defs b/apps/Make.defs index 5b6cd9aa0..f459264c8 100755 --- a/apps/Make.defs +++ b/apps/Make.defs @@ -36,6 +36,6 @@ define REGISTER @echo "Register: $1" - @echo "{ .name = \"$1\", .priority = $2, .stacksize = $3, .main = $4 }," >> "$(APPDIR)/exec_nuttapp_list.h" - @echo "EXTERN int $4(int argc, char *argv[]);" >> "$(APPDIR)/exec_nuttapp_proto.h" + @echo "{ .name = \"$1\", .priority = $2, .stacksize = $3, .main = $4 }," >> "$(APPDIR)/nuttapp/exec_nuttapp_list.h" + @echo "EXTERN int $4(int argc, char *argv[]);" >> "$(APPDIR)/nuttapp/exec_nuttapp_proto.h" endef diff --git a/apps/Makefile b/apps/Makefile index 76eeb1e92..be7b9f6be 100644 --- a/apps/Makefile +++ b/apps/Makefile @@ -41,15 +41,16 @@ APPDIR = ${shell pwd} # Application Directories # SUBDIRS is the list of all directories containing Makefiles. It is used -# only for cleaning. +# only for cleaning. nuttapp must always be the first in the list. -SUBDIRS = nshlib netutils examples vsn +SUBDIRS = nuttapp 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 +# We use a non-existing .built_always to guarantee that Makefile always walks +# into the sub-directories and asks for build. NOTE that nuttapp is always +# in the list of applications to be built -BUILTIN_APPS_BUILT = -BUILTIN_APPS_DIR = +BUILTIN_APPS_BUILT = nuttapp/.built_always +BUILTIN_APPS_DIR = nuttapp ifeq ($(CONFIG_BUILTIN_APPS),y) @@ -89,69 +90,44 @@ $(foreach BUILT, $(AVAILABLE_APPS), $(eval $(call BUILTIN_ADD_BUILT,$(BUILT)))) endif -# Source and object files +# The final build target -ASRCS = -CSRCS = exec_nuttapp.c +BIN = libapps$(LIBEXT) -AOBJS = $(ASRCS:.S=$(OBJEXT)) -COBJS = $(CSRCS:.c=$(OBJEXT)) +# Build targets -SRCS = $(ASRCS) $(CSRCS) -OBJS = $(AOBJS) $(COBJS) +all: $(BIN) +.PHONY: $(BUILTIN_APPS_BUILT) .depend depend clean distclean -BIN = libapps$(LIBEXT) - -ROOTDEPPATH = --dep-path . -VPATH = - -all: $(BIN) -.PHONY: .depend depend clean distclean - -$(AOBJS): %$(OBJEXT): %.S - $(call ASSEMBLE, $<, $@) - -$(COBJS): %$(OBJEXT): %.c - $(call COMPILE, $<, $@) - $(BUILTIN_APPS_BUILT): @for dir in $(BUILTIN_APPS_DIR) ; do \ $(MAKE) -C $$dir TOPDIR="$(TOPDIR)" APPDIR=$(APPDIR); \ done -$(BIN): $(OBJS) $(BUILTIN_APPS_BUILT) +$(BIN): $(BUILTIN_APPS_BUILT) @( for obj in $(OBJS) ; do \ $(call ARCHIVE, $@, $${obj}); \ done ; ) .depend: Makefile $(SRCS) - @echo "/* List of application requirements, generated during make depend. */" > exec_nuttapp_list.h - @echo "/* List of application entry points, generated during make depend. */" > exec_nuttapp_proto.h - @$(MKDEP) $(ROOTDEPPATH) \ - $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep - @touch $@ @for dir in $(BUILTIN_APPS_DIR) ; do \ rm -f $$dir/.depend ; \ $(MAKE) -C $$dir TOPDIR="$(TOPDIR)" APPDIR=$(APPDIR) depend ; \ done + @touch $@ depend: .depend clean: - @rm -f $(BIN) *~ .*.swp *.o libapps.a - $(call CLEAN) @for dir in $(SUBDIRS) ; do \ $(MAKE) -C $$dir clean TOPDIR="$(TOPDIR)" APPDIR=$(APPDIR); \ done + @rm -f $(BIN) *~ .*.swp *.o + $(call CLEAN) distclean: clean - @rm -f .config - @rm -f Make.dep .depend - @rm -f exec_nuttapp_list.h - @rm -f exec_nuttapp_proto.h @for dir in $(SUBDIRS) ; do \ $(MAKE) -C $$dir distclean TOPDIR="$(TOPDIR)" APPDIR=$(APPDIR); \ done - --include Make.dep + @rm -f .config .depend diff --git a/apps/examples/dhcpd/Makefile b/apps/examples/dhcpd/Makefile index d3ebff901..d4f03f74b 100644 --- a/apps/examples/dhcpd/Makefile +++ b/apps/examples/dhcpd/Makefile @@ -48,7 +48,7 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -BIN = ../../libapps$(LIBEXT) +BIN = $(APPDIR)/libapps$(LIBEXT) ROOTDEPPATH = --dep-path . @@ -81,7 +81,7 @@ $(BIN): $(OBJS) depend: .depend clean: - @rm -f $(BIN) *.o *~ .*.swp .built + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean diff --git a/apps/examples/hello/Makefile b/apps/examples/hello/Makefile index 73430c5c5..c856f145f 100644 --- a/apps/examples/hello/Makefile +++ b/apps/examples/hello/Makefile @@ -48,7 +48,7 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -BIN = ../../libapps$(LIBEXT) +BIN = $(APPDIR)/libapps$(LIBEXT) ROOTDEPPATH = --dep-path . @@ -81,7 +81,7 @@ $(BIN): $(OBJS) depend: .depend clean: - @rm -f $(BIN) *.o *~ .*.swp .built + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean diff --git a/apps/examples/helloxx/Makefile b/apps/examples/helloxx/Makefile index 69c4e08eb..5cbf55ef3 100755 --- a/apps/examples/helloxx/Makefile +++ b/apps/examples/helloxx/Makefile @@ -50,7 +50,7 @@ CXXOBJS = $(CXXSRCS:.cxx=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) $(CXXSRCS) OBJS = $(AOBJS) $(COBJS) $(CXXOBJS) -BIN = ../../libapps$(LIBEXT) +BIN = $(APPDIR)/libapps$(LIBEXT) ROOTDEPPATH = --dep-path . @@ -98,7 +98,7 @@ $(BIN): chkcxx $(OBJS) depend: .depend clean: - @rm -f $(BIN) *.o *~ .*.swp .built + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean diff --git a/apps/examples/hidkbd/Makefile b/apps/examples/hidkbd/Makefile index c0c21d6da..48b0c90a2 100644 --- a/apps/examples/hidkbd/Makefile +++ b/apps/examples/hidkbd/Makefile @@ -48,7 +48,7 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -BIN = ../../libapps$(LIBEXT) +BIN = $(APPDIR)/libapps$(LIBEXT) ROOTDEPPATH = --dep-path . @@ -81,7 +81,7 @@ $(BIN): $(OBJS) depend: .depend clean: - @rm -f $(BIN) *.o *~ .*.swp .built + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean diff --git a/apps/examples/igmp/Makefile b/apps/examples/igmp/Makefile index 99971469b..d1362f0b8 100755 --- a/apps/examples/igmp/Makefile +++ b/apps/examples/igmp/Makefile @@ -48,7 +48,7 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -BIN = ../../libapps$(LIBEXT) +BIN = $(APPDIR)/libapps$(LIBEXT) ROOTDEPPATH = --dep-path . @@ -81,7 +81,7 @@ $(BIN): $(OBJS) depend: .depend clean: - @rm -f $(BIN) *.o *~ .*.swp .built + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean diff --git a/apps/examples/mm/Makefile b/apps/examples/mm/Makefile index c9ef6f907..747a1a1e2 100644 --- a/apps/examples/mm/Makefile +++ b/apps/examples/mm/Makefile @@ -48,7 +48,7 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -BIN = ../../libapps$(LIBEXT) +BIN = $(APPDIR)/libapps$(LIBEXT) ROOTDEPPATH = --dep-path . @@ -81,7 +81,7 @@ $(BIN): $(OBJS) depend: .depend clean: - @rm -f $(BIN) *.o *~ .*.swp .built + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean diff --git a/apps/examples/mount/Makefile b/apps/examples/mount/Makefile index 46a8c0576..04d2d21f6 100644 --- a/apps/examples/mount/Makefile +++ b/apps/examples/mount/Makefile @@ -48,7 +48,7 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -BIN = ../../libapps$(LIBEXT) +BIN = $(APPDIR)/libapps$(LIBEXT) ROOTDEPPATH = --dep-path . @@ -81,7 +81,7 @@ $(BIN): $(OBJS) depend: .depend clean: - @rm -f $(BIN) *.o *~ .*.swp .built + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean diff --git a/apps/examples/nettest/Makefile b/apps/examples/nettest/Makefile index 37d00914e..52e205f34 100644 --- a/apps/examples/nettest/Makefile +++ b/apps/examples/nettest/Makefile @@ -54,7 +54,7 @@ TARG_COBJS = $(TARG_CSRCS:.c=$(OBJEXT)) TARG_SRCS = $(TARG_ASRCS) $(TARG_CSRCS) TARG_OBJS = $(TARG_AOBJS) $(TARG_COBJS) -TARG_BIN = ../../libapps$(LIBEXT) +TARG_BIN = $(APPDIR)/libapps$(LIBEXT) HOSTCFLAGS += -DCONFIG_EXAMPLE_NETTEST_HOST=1 ifeq ($(CONFIG_EXAMPLE_NETTEST_SERVER),y) diff --git a/apps/examples/nsh/Makefile b/apps/examples/nsh/Makefile index 92fd8e157..1887d3bbe 100644 --- a/apps/examples/nsh/Makefile +++ b/apps/examples/nsh/Makefile @@ -48,7 +48,7 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -BIN = ../../libapps$(LIBEXT) +BIN = $(APPDIR)/libapps$(LIBEXT) ROOTDEPPATH = --dep-path . @@ -81,7 +81,7 @@ $(BIN): $(OBJS) depend: .depend clean: - @rm -f $(BIN) *.o *~ .*.swp .built + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean diff --git a/apps/examples/null/Makefile b/apps/examples/null/Makefile index 2b4171e7f..9d842638a 100644 --- a/apps/examples/null/Makefile +++ b/apps/examples/null/Makefile @@ -48,7 +48,7 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -BIN = ../../libapps$(LIBEXT) +BIN = $(APPDIR)/libapps$(LIBEXT) ROOTDEPPATH = --dep-path . @@ -81,7 +81,7 @@ $(BIN): $(OBJS) depend: .depend clean: - @rm -f $(BIN) *.o *~ .*.swp .built + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean diff --git a/apps/examples/nx/Makefile b/apps/examples/nx/Makefile index bfb0d473e..72ba1915f 100644 --- a/apps/examples/nx/Makefile +++ b/apps/examples/nx/Makefile @@ -51,7 +51,7 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -BIN = ../../libapps$(LIBEXT) +BIN = $(APPDIR)/libapps$(LIBEXT) ROOTDEPPATH = --dep-path . @@ -84,7 +84,7 @@ $(BIN): $(OBJS) depend: .depend clean: - @rm -f $(BIN) *.o *~ .*.swp .built + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean diff --git a/apps/examples/nxflat/Makefile b/apps/examples/nxflat/Makefile index b5f3e2d8c..73a5a95d1 100644 --- a/apps/examples/nxflat/Makefile +++ b/apps/examples/nxflat/Makefile @@ -48,7 +48,7 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -BIN = ../../libapps$(LIBEXT) +BIN = $(APPDIR)/libapps$(LIBEXT) ROOTDEPPATH = --dep-path . @@ -86,7 +86,7 @@ $(BIN): $(OBJS) depend: .depend clean: - @rm -f $(BIN) *.o *~ .*.swp .built + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean diff --git a/apps/examples/ostest/Makefile b/apps/examples/ostest/Makefile index 0e50db434..469fe032a 100644 --- a/apps/examples/ostest/Makefile +++ b/apps/examples/ostest/Makefile @@ -88,7 +88,7 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -BIN = ../../libapps$(LIBEXT) +BIN = $(APPDIR)/libapps$(LIBEXT) ROOTDEPPATH = --dep-path . @@ -121,7 +121,7 @@ $(BIN): $(OBJS) depend: .depend clean: - @rm -f $(BIN) *.o *~ .*.swp .built + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean diff --git a/apps/examples/pashello/Makefile b/apps/examples/pashello/Makefile index 501ac2d19..6e2579191 100644 --- a/apps/examples/pashello/Makefile +++ b/apps/examples/pashello/Makefile @@ -55,7 +55,7 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -BIN = ../../libapps$(LIBEXT) +BIN = $(APPDIR)/libapps$(LIBEXT) ROOTDEPPATH = --dep-path . @@ -88,7 +88,7 @@ $(BIN): $(OBJS) depend: .depend clean: - @rm -f $(BIN) *.o *~ .*.swp .built + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean diff --git a/apps/examples/pipe/Makefile b/apps/examples/pipe/Makefile index 886409f62..e46bbdd82 100644 --- a/apps/examples/pipe/Makefile +++ b/apps/examples/pipe/Makefile @@ -48,7 +48,7 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -BIN = ../../libapps$(LIBEXT) +BIN = $(APPDIR)/libapps$(LIBEXT) ROOTDEPPATH = --dep-path . @@ -81,7 +81,7 @@ $(BIN): $(OBJS) depend: .depend clean: - @rm -f $(BIN) *.o *~ .*.swp .built + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean diff --git a/apps/examples/poll/Makefile b/apps/examples/poll/Makefile index 0bfc97ec1..e33e493f1 100644 --- a/apps/examples/poll/Makefile +++ b/apps/examples/poll/Makefile @@ -48,7 +48,7 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -BIN = ../../libapps$(LIBEXT) +BIN = $(APPDIR)/libapps$(LIBEXT) ROOTDEPPATH = --dep-path . @@ -81,7 +81,7 @@ $(BIN): $(OBJS) depend: .depend clean: - @rm -f $(BIN) *.o *~ .*.swp .built + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean diff --git a/apps/examples/romfs/Makefile b/apps/examples/romfs/Makefile index 70b5e869c..7e12866f8 100644 --- a/apps/examples/romfs/Makefile +++ b/apps/examples/romfs/Makefile @@ -48,7 +48,7 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -BIN = ../../libapps$(LIBEXT) +BIN = $(APPDIR)/libapps$(LIBEXT) ROOTDEPPATH = --dep-path . @@ -97,7 +97,7 @@ $(BIN): romfs_testdir.h $(OBJS) depend: .depend clean: - @rm -f $(BIN) *.o *~ .*.swp .built + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean diff --git a/apps/examples/sendmail/Makefile b/apps/examples/sendmail/Makefile index def179856..81aed5ca6 100644 --- a/apps/examples/sendmail/Makefile +++ b/apps/examples/sendmail/Makefile @@ -48,7 +48,7 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -BIN = ../../libapps$(LIBEXT) +BIN = $(APPDIR)/libapps$(LIBEXT) ROOTDEPPATH = --dep-path . @@ -81,7 +81,7 @@ $(BIN): $(OBJS) depend: .depend clean: - @rm -f $(BIN) *.o *~ .*.swp .built + @rm -f *.o *~ .*.swp .built $(call CLEAN) @make -f Makefile.host clean TOPDIR=$(TOPDIR) APPDIR=$(APPDIR) diff --git a/apps/examples/serloop/Makefile b/apps/examples/serloop/Makefile index 99b1aab67..c3c0274db 100644 --- a/apps/examples/serloop/Makefile +++ b/apps/examples/serloop/Makefile @@ -48,7 +48,7 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -BIN = ../../libapps$(LIBEXT) +BIN = $(APPDIR)/libapps$(LIBEXT) ROOTDEPPATH = --dep-path . @@ -81,7 +81,7 @@ $(BIN): $(OBJS) depend: .depend clean: - @rm -f $(BIN) *.o *~ .*.swp .built + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean diff --git a/apps/examples/thttpd/Makefile b/apps/examples/thttpd/Makefile index acc49d9ac..91c8c19e1 100644 --- a/apps/examples/thttpd/Makefile +++ b/apps/examples/thttpd/Makefile @@ -48,7 +48,7 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -BIN = ../../libapps$(LIBEXT) +BIN = $(APPDIR)/libapps$(LIBEXT) ROOTDEPPATH = --dep-path . @@ -84,7 +84,7 @@ $(BIN): headers $(OBJS) depend: .depend clean: - @rm -f $(BIN) *.o *~ .*.swp .built + @rm -f *.o *~ .*.swp .built @make -C content clean TOPDIR=$(TOPDIR) APPDIR=$(APPDIR) CROSSDEV=$(CROSSDEV) $(call CLEAN) diff --git a/apps/examples/udp/Makefile b/apps/examples/udp/Makefile index e0789eda8..ddffda703 100644 --- a/apps/examples/udp/Makefile +++ b/apps/examples/udp/Makefile @@ -54,7 +54,7 @@ TARG_COBJS = $(TARG_CSRCS:.c=$(OBJEXT)) TARG_SRCS = $(TARG_ASRCS) $(TARG_CSRCS) TARG_OBJS = $(TARG_AOBJS) $(TARG_COBJS) -TARG_BIN = ../../libapps$(LIBEXT) +TARG_BIN = $(APPDIR)/libapps$(LIBEXT) HOSTCFLAGS += -DCONFIG_EXAMPLE_UDP_HOST=1 ifeq ($(CONFIG_EXAMPLE_UDP_SERVER),y) diff --git a/apps/examples/uip/Makefile b/apps/examples/uip/Makefile index 2dd209df3..08abe15b0 100644 --- a/apps/examples/uip/Makefile +++ b/apps/examples/uip/Makefile @@ -48,7 +48,7 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -BIN = ../../libapps$(LIBEXT) +BIN = $(APPDIR)/libapps$(LIBEXT) ROOTDEPPATH = --dep-path . @@ -81,7 +81,7 @@ $(BIN): $(OBJS) depend: .depend clean: - @rm -f $(BIN) *.o *~ .*.swp .built + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean diff --git a/apps/examples/usbserial/Makefile b/apps/examples/usbserial/Makefile index 61fba5244..2ac0cb085 100644 --- a/apps/examples/usbserial/Makefile +++ b/apps/examples/usbserial/Makefile @@ -48,7 +48,7 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -BIN = ../../libapps$(LIBEXT) +BIN = $(APPDIR)/libapps$(LIBEXT) ROOTDEPPATH = --dep-path . @@ -81,9 +81,9 @@ $(BIN): $(OBJS) depend: .depend clean: - @rm -f $(BIN) *.o *~ .*.swp .built + @rm -f *.o *~ .*.swp .built $(call CLEAN) - @(MAKE) -f Makefile.host clean TOPDIR=$(TOPDIR) APPDIR=$(APPDIR) + @$(MAKE) -f Makefile.host clean TOPDIR=$(TOPDIR) APPDIR=$(APPDIR) distclean: clean @rm -f Make.dep .depend diff --git a/apps/examples/usbserial/Makefile.host b/apps/examples/usbserial/Makefile.host index 8c8884b42..cd9319ab3 100644 --- a/apps/examples/usbserial/Makefile.host +++ b/apps/examples/usbserial/Makefile.host @@ -39,7 +39,7 @@ -include $(TOPDIR)/Make.defs SRC = host.c -BIN = host +BIN = host$(EXEEXT) DEFINES = ifeq ($(CONFIG_EXAMPLES_USBSERIAL_INONLY),y) @@ -55,12 +55,13 @@ ifeq ($(CONFIG_EXAMPLES_USBSERIAL_ONLYBIG),y) DEFINES += -DCONFIG_EXAMPLES_USBSERIAL_ONLYBIG=1 endif -all: $(BIN)$(EXEEXT) +all: $(BIN) -$(BIN)$(EXEEXT): $(SRC) +$(BIN): $(SRC) @$(HOSTCC) $(HOSTCFLAGS) $(DEFINES) $^ -o $@ clean: @rm -f $(BIN) *~ .*.swp *.o $(call CLEAN) + diff --git a/apps/examples/usbstorage/Makefile b/apps/examples/usbstorage/Makefile index 7f777dfec..5e8983f46 100644 --- a/apps/examples/usbstorage/Makefile +++ b/apps/examples/usbstorage/Makefile @@ -48,7 +48,7 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -BIN = ../../libapps$(LIBEXT) +BIN = $(APPDIR)/libapps$(LIBEXT) ROOTDEPPATH = --dep-path . @@ -81,7 +81,7 @@ $(BIN): $(OBJS) depend: .depend clean: - @rm -f $(BIN) *.o *~ .*.swp .built + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean diff --git a/apps/examples/wget/Makefile b/apps/examples/wget/Makefile index e39d5f68a..b9cc15510 100644 --- a/apps/examples/wget/Makefile +++ b/apps/examples/wget/Makefile @@ -48,7 +48,7 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -BIN = ../../libapps$(LIBEXT) +BIN = $(APPDIR)/libapps$(LIBEXT) ROOTDEPPATH = --dep-path . @@ -81,7 +81,7 @@ $(BIN): $(OBJS) depend: .depend clean: - @rm -f $(BIN) *.o *~ .*.swp .built + @rm -f *.o *~ .*.swp .built $(call CLEAN) @make -f Makefile.host clean TOPDIR=$(TOPDIR) APPDIR=$(APPDIR) diff --git a/apps/examples/wlan/Makefile b/apps/examples/wlan/Makefile index 53f871543..756389571 100755 --- a/apps/examples/wlan/Makefile +++ b/apps/examples/wlan/Makefile @@ -49,7 +49,7 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -BIN = ../../libapps$(LIBEXT) +BIN = $(APPDIR)/libapps$(LIBEXT) ROOTDEPPATH = --dep-path . @@ -82,7 +82,7 @@ $(BIN): $(OBJS) depend: .depend clean: - @rm -f $(BIN) *.o *~ .*.swp .built + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean diff --git a/apps/netutils/dhcpc/Makefile b/apps/netutils/dhcpc/Makefile index f1273407b..26f9c9e12 100644 --- a/apps/netutils/dhcpc/Makefile +++ b/apps/netutils/dhcpc/Makefile @@ -52,7 +52,7 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -BIN = ../../libapps$(LIBEXT) +BIN = $(APPDIR)/libapps$(LIBEXT) ROOTDEPPATH = --dep-path . @@ -86,7 +86,7 @@ endif depend: .depend clean: - @rm -f $(BIN) *.o *~ .*.swp .built + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean diff --git a/apps/netutils/dhcpd/Makefile b/apps/netutils/dhcpd/Makefile index cf9762d26..5731d551f 100644 --- a/apps/netutils/dhcpd/Makefile +++ b/apps/netutils/dhcpd/Makefile @@ -52,7 +52,7 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -BIN = ../../libapps$(LIBEXT) +BIN = $(APPDIR)/libapps$(LIBEXT) ROOTDEPPATH = --dep-path . @@ -86,7 +86,7 @@ endif depend: .depend clean: - @rm -f $(BIN) *.o *~ .*.swp .built + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean diff --git a/apps/netutils/resolv/Makefile b/apps/netutils/resolv/Makefile index e4f49e407..07b68b995 100644 --- a/apps/netutils/resolv/Makefile +++ b/apps/netutils/resolv/Makefile @@ -52,7 +52,7 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -BIN = ../../libapps$(LIBEXT) +BIN = $(APPDIR)/libapps$(LIBEXT) ROOTDEPPATH = --dep-path . @@ -86,7 +86,7 @@ endif depend: .depend clean: - @rm -f $(BIN) *.o *~ .*.swp .built + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean diff --git a/apps/netutils/smtp/Makefile b/apps/netutils/smtp/Makefile index c4d2383df..75a929b58 100644 --- a/apps/netutils/smtp/Makefile +++ b/apps/netutils/smtp/Makefile @@ -52,7 +52,7 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -BIN = ../../libapps$(LIBEXT) +BIN = $(APPDIR)/libapps$(LIBEXT) ROOTDEPPATH = --dep-path . @@ -86,7 +86,7 @@ endif depend: .depend clean: - @rm -f $(BIN) *.o *~ .*.swp .built + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean diff --git a/apps/netutils/telnetd/Makefile b/apps/netutils/telnetd/Makefile index 0917b64ef..3d53a693b 100644 --- a/apps/netutils/telnetd/Makefile +++ b/apps/netutils/telnetd/Makefile @@ -52,7 +52,7 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -BIN = ../../libapps$(LIBEXT) +BIN = $(APPDIR)/libapps$(LIBEXT) ROOTDEPPATH = --dep-path . @@ -86,7 +86,7 @@ endif depend: .depend clean: - @rm -f $(BIN) *.o *~ .*.swp .built + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean diff --git a/apps/netutils/tftpc/Makefile b/apps/netutils/tftpc/Makefile index be9abacdd..c3f49c906 100644 --- a/apps/netutils/tftpc/Makefile +++ b/apps/netutils/tftpc/Makefile @@ -54,7 +54,7 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -BIN = ../../libapps$(LIBEXT) +BIN = $(APPDIR)/libapps$(LIBEXT) ROOTDEPPATH = --dep-path . @@ -88,7 +88,7 @@ endif depend: .depend clean: - @rm -f $(BIN) *.o *~ .*.swp .built + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean diff --git a/apps/netutils/thttpd/Makefile b/apps/netutils/thttpd/Makefile index b47fe3a44..133139a77 100644 --- a/apps/netutils/thttpd/Makefile +++ b/apps/netutils/thttpd/Makefile @@ -52,7 +52,7 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -BIN = ../../libapps$(LIBEXT) +BIN = $(APPDIR)/libapps$(LIBEXT) ROOTDEPPATH = --dep-path . @@ -113,7 +113,7 @@ endif depend: .depend clean: - @rm -f $(BIN) *.o *~ .*.swp .built + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean diff --git a/apps/netutils/uiplib/Makefile b/apps/netutils/uiplib/Makefile index 49949a145..84708a639 100644 --- a/apps/netutils/uiplib/Makefile +++ b/apps/netutils/uiplib/Makefile @@ -61,7 +61,7 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -BIN = ../../libapps$(LIBEXT) +BIN = $(APPDIR)/libapps$(LIBEXT) ROOTDEPPATH = --dep-path . @@ -93,7 +93,7 @@ $(BIN): $(OBJS) depend: .depend clean: - @rm -f $(BIN) *.o *~ .*.swp .built + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean diff --git a/apps/netutils/webclient/Makefile b/apps/netutils/webclient/Makefile index 2fdb192ea..a59eaca92 100644 --- a/apps/netutils/webclient/Makefile +++ b/apps/netutils/webclient/Makefile @@ -52,7 +52,7 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -BIN = ../../libapps$(LIBEXT) +BIN = $(APPDIR)/libapps$(LIBEXT) ROOTDEPPATH = --dep-path . @@ -86,7 +86,7 @@ endif depend: .depend clean: - @rm -f $(BIN) *.o *~ .*.swp .built + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean diff --git a/apps/netutils/webserver/Makefile b/apps/netutils/webserver/Makefile index 553d52722..8d7a74773 100644 --- a/apps/netutils/webserver/Makefile +++ b/apps/netutils/webserver/Makefile @@ -52,7 +52,7 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -BIN = ../../libapps$(LIBEXT) +BIN = $(APPDIR)/libapps$(LIBEXT) ROOTDEPPATH = --dep-path . @@ -86,7 +86,7 @@ endif depend: .depend clean: - @rm -f $(BIN) *.o *~ .*.swp .built + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean diff --git a/apps/nshlib/Makefile b/apps/nshlib/Makefile index 943fc8713..ecd2e5576 100644 --- a/apps/nshlib/Makefile +++ b/apps/nshlib/Makefile @@ -73,7 +73,7 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -BIN = ../libapps$(LIBEXT) +BIN = $(APPDIR)/libapps$(LIBEXT) ROOTDEPPATH = --dep-path . @@ -102,14 +102,14 @@ $(BIN): $(OBJS) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ -# Register application depend: .depend clean: - @rm -f $(BIN) *.o *~ .*.swp .built + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean @rm -f Make.dep .depend -include Make.dep + diff --git a/apps/nuttapp/Makefile b/apps/nuttapp/Makefile new file mode 100644 index 000000000..092236027 --- /dev/null +++ b/apps/nuttapp/Makefile @@ -0,0 +1,95 @@ +############################################################################ +# apps/nshlib/Makefile +# +# Copyright (C) 2011 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config +-include $(TOPDIR)/Make.defs +include $(APPDIR)/Make.defs + +# NSH Library + +# Source and object files + +ASRCS = +CSRCS = exec_nuttapp.c + +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +BIN = $(APPDIR)/libapps$(LIBEXT) + +ROOTDEPPATH = --dep-path . +VPATH = + +# Build Targets + +all: .built +.PHONY: depend .depend clean distclean + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +$(BIN): $(OBJS) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $@, $${obj}); \ + done ; ) + @touch .built + +.built: $(BIN) + +.depend: Makefile $(SRCS) + @echo "/* List of application requirements, generated during make depend. */" > exec_nuttapp_list.h + @echo "/* List of application entry points, generated during make depend. */" > exec_nuttapp_proto.h + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + @touch $@ + +depend: .depend + +clean: + @rm -f *.o *~ .*.swp .built + $(call CLEAN) + +distclean: clean + @rm -f Make.dep .depend + @rm -f exec_nuttapp_list.h + @rm -f exec_nuttapp_proto.h + +-include Make.dep + diff --git a/apps/exec_nuttapp.c b/apps/nuttapp/exec_nuttapp.c similarity index 100% rename from apps/exec_nuttapp.c rename to apps/nuttapp/exec_nuttapp.c diff --git a/apps/vsn/Makefile b/apps/vsn/Makefile index 29b4f1b6a..b3fed59c2 100644 --- a/apps/vsn/Makefile +++ b/apps/vsn/Makefile @@ -33,6 +33,8 @@ # ############################################################################ +-include $(TOPDIR)/.config # Current configuration + # Sub-directories SUBDIRS = free hello poweroff ramtron sdcard @@ -42,17 +44,20 @@ all: nothing nothing: -define DOMAKE - @(MAKE) -C $1 $2 TOPDIR="$(TOPDIR) APPDIR=$(APPDIR)" -endef - depend: - $(foreach DIR, $(SUBDIRS), $(eval $(call DOMAKE,$(DIR),depend))) + @for dir in $(SUBDIRS) ; do \ + $(MAKE) -C $$dir depend TOPDIR="$(TOPDIR)" APPDIR=$(APPDIR); \ + done clean: - $(foreach DIR, $(SUBDIRS), $(eval $(call DOMAKE,$(DIR),clean))) + @for dir in $(SUBDIRS) ; do \ + $(MAKE) -C $$dir clean TOPDIR="$(TOPDIR)" APPDIR=$(APPDIR); \ + done distclean: clean - $(foreach DIR, $(SUBDIRS), $(eval $(call DOMAKE,$(DIR),distclean))) + @for dir in $(SUBDIRS) ; do \ + $(MAKE) -C $$dir distclean TOPDIR="$(TOPDIR)" APPDIR=$(APPDIR); \ + done -include Make.dep + diff --git a/apps/vsn/free/Makefile b/apps/vsn/free/Makefile index 421544f3c..01545d06d 100644 --- a/apps/vsn/free/Makefile +++ b/apps/vsn/free/Makefile @@ -61,7 +61,7 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -BIN = ../../libapps$(LIBEXT) +BIN = $(APPDIR)/libapps$(LIBEXT) ROOTDEPPATH = --dep-path . @@ -95,7 +95,7 @@ $(BIN): $(OBJS) depend: .depend clean: - @rm -f $(BIN) *.o *~ .*.swp .built + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean diff --git a/apps/vsn/hello/Makefile b/apps/vsn/hello/Makefile index 3f4115ede..45f60e9bd 100644 --- a/apps/vsn/hello/Makefile +++ b/apps/vsn/hello/Makefile @@ -61,7 +61,7 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -BIN = ../../libapps$(LIBEXT) +BIN = $(APPDIR)/libapps$(LIBEXT) ROOTDEPPATH = --dep-path . @@ -95,7 +95,7 @@ $(BIN): $(OBJS) depend: .depend clean: - @rm -f $(BIN) *.o *~ .*.swp .built + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean diff --git a/apps/vsn/poweroff/Makefile b/apps/vsn/poweroff/Makefile index 80bde85b0..d4fc2ed00 100644 --- a/apps/vsn/poweroff/Makefile +++ b/apps/vsn/poweroff/Makefile @@ -61,7 +61,7 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -BIN = ../../libapps$(LIBEXT) +BIN = $(APPDIR)/libapps$(LIBEXT) ROOTDEPPATH = --dep-path . @@ -95,7 +95,7 @@ $(BIN): $(OBJS) depend: .depend clean: - @rm -f $(BIN) *.o *~ .*.swp .built + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean diff --git a/apps/vsn/ramtron/Makefile b/apps/vsn/ramtron/Makefile index 5803f1ffa..c9aeae651 100644 --- a/apps/vsn/ramtron/Makefile +++ b/apps/vsn/ramtron/Makefile @@ -61,7 +61,7 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -BIN = ../../libapps$(LIBEXT) +BIN = $(APPDIR)/libapps$(LIBEXT) ROOTDEPPATH = --dep-path . @@ -95,7 +95,7 @@ $(BIN): $(OBJS) depend: .depend clean: - @rm -f $(BIN) *.o *~ .*.swp .built + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean diff --git a/apps/vsn/sdcard/Makefile b/apps/vsn/sdcard/Makefile index b19ebdec7..ea0f51f35 100644 --- a/apps/vsn/sdcard/Makefile +++ b/apps/vsn/sdcard/Makefile @@ -61,7 +61,7 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -BIN = ../../libapps$(LIBEXT) +BIN = $(APPDIR)/libapps$(LIBEXT) ROOTDEPPATH = --dep-path . @@ -95,7 +95,7 @@ $(BIN): $(OBJS) depend: .depend clean: - @rm -f $(BIN) *.o *~ .*.swp .built + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean diff --git a/nuttx/Makefile b/nuttx/Makefile index 9c20f4f26..b5c4dd6ae 100644 --- a/nuttx/Makefile +++ b/nuttx/Makefile @@ -349,7 +349,7 @@ endif download: $(BIN) $(call DOWNLOAD, $<) -depend: +depend: context @for dir in $(MAKEDIRS) ; do \ $(MAKE) -C $$dir TOPDIR="$(TOPDIR)" depend ; \ done diff --git a/nuttx/tools/configure.sh b/nuttx/tools/configure.sh index ad82b457e..8e56c2a0e 100755 --- a/nuttx/tools/configure.sh +++ b/nuttx/tools/configure.sh @@ -118,8 +118,25 @@ fi # Check for the apps/ dir in the usual place if appdir was not provided if [ -z "${appdir}" ]; then + + # Check for a version file + + unset CONFIG_NUTTX_VERSION + if [ -x "${TOPDIR}/.version" ]; then + source "${TOPDIR}/.version" + fi + + # Check for an unversioned apps/ directory + if [ -d "${TOPDIR}/../apps" ]; then appdir="../apps" + + else + # Check for a versioned apps/ directory + + if [ -d "${TOPDIR}/../apps-${CONFIG_NUTTX_VERSION}" ]; then + appdir="../apps-${CONFIG_NUTTX_VERSION}" + fi fi fi diff --git a/nuttx/tools/zipme.sh b/nuttx/tools/zipme.sh index 7c08bd271..bf8041a4f 100755 --- a/nuttx/tools/zipme.sh +++ b/nuttx/tools/zipme.sh @@ -132,11 +132,15 @@ if [ -f ${ZIP_NAME} ] ; then { echo "rm ${ZIP_NAME} failed!" ; exit 1 ; } fi -# Write a version file +# Write a version file. The syntax of file is such that it may be sourced +# by a bash script or included by a Makefile -echo "CONFIG_NUTTX_VERSION=\"${VERSION}\" >${NUTTX}/.version +echo "#!/bin/bash" >${NUTTX}/.version +echo "" >>${NUTTX}/.version +echo "CONFIG_NUTTX_VERSION=\"${VERSION}\" >>${NUTTX}/.version +chmod 755 ${NUTTX}/.version -# Then zip it +# Then zip-up the directories ${TAR} ${TAR_NAME} nuttx-${VERSION}/nuttx nuttx-${VERSION}/apps || \ { echo "tar of ${TAR_NAME} failed!" ; exit 1 ; }