apps/: Modification to build system: Unified application compilation rules

This commit is contained in:
anchao 2018-09-03 09:29:56 -06:00 committed by Gregory Nutt
parent 3e396d8e4e
commit b5cfd93444
606 changed files with 1208 additions and 9232 deletions

View File

@ -42,13 +42,15 @@ include $(APPDIR)/Make.defs
# has the value "m"
ifneq ($(MAINSRC),)
ifneq ($(MODULE),)
ifeq ($(CONFIG_$(MODULE)),m)
BUILD_MODULE = y
endif
ifeq ($($(MODULE)),m)
BUILD_MODULE = y
endif
endif
ifeq ($(CONFIG_BUILD_KERNEL),y)
BUILD_MODULE = y
endif
# Pass the definition to the C/C++ code via the CFLAGS/CXXFLAGS
ifeq ($(BUILD_MODULE),y)
@ -89,16 +91,18 @@ else
INSTALL_DIR = $(BIN_DIR)
endif
ROOTDEPPATH = --dep-path .
ROOTDEPPATH += --dep-path .
VPATH =
VPATH += :.
# Targets follow
all: .built
all:: .built
.PHONY: clean preconfig depend distclean
.PRECIOUS: $(APPDIR)/libapps$(LIBEXT)
ifneq ($(CONFIG_BUILD_LOADABLE),y)
$(AOBJS): %$(OBJEXT): %.S
$(call ASSEMBLE, $<, $@)
@ -116,42 +120,103 @@ $(MAINOBJ): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
endif
else
define ELFASSEMBLE
@echo "AS: $1"
$(Q) $(CC) -c $(AELFFLAGS) $1 -o $2
endef
define ELFCOMPILE
@echo "CC: $1"
$(Q) $(CC) -c $(CELFFLAGS) $1 -o $2
endef
define ELFCOMPILEXX
@echo "CXX: $1"
$(Q) $(CXX) -c $(CXXELFFLAGS) $1 -o $2
endef
$(AOBJS): %$(OBJEXT): %.S
$(if $(AELFFLAGS), \
$(call ELFASSEMBLE, $<, $@), \
$(call ASSEMBLE, $<, $@), \
)
$(COBJS): %$(OBJEXT): %.c
$(if $(CELFFLAGS), \
$(call ELFCOMPILE, $<, $@), \
$(call COMPILE, $<, $@), \
)
$(CXXOBJS): %$(OBJEXT): %$(CXXEXT)
$(if $(CXXELFFLAGS), \
$(call ELFCOMPILEXX, $<, $@), \
$(call COMPILEXX, $<, $@), \
)
ifeq ($(suffix $(MAINSRC)),$(CXXEXT))
$(MAINOBJ): %$(OBJEXT): %$(CXXEXT)
$(if $(CXXELFFLAGS), \
$(call ELFCOMPILEXX, $<, $@), \
$(call COMPILEXX, $<, $@), \
)
else
$(MAINOBJ): %$(OBJEXT): %.c
$(if $(CELFFLAGS), \
$(call ELFCOMPILE, $<, $@), \
$(call COMPILE, $<, $@), \
)
endif
endif
.built: $(OBJS)
$(call ARCHIVE, $(BIN), $(OBJS))
$(Q) touch $@
ifeq ($(BUILD_MODULE), y)
$(BIN_DIR)$(DELIM)$(PROGNAME): $(OBJS) $(MAINOBJ)
@echo "LD: $(PROGNAME)"
$(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $(INSTALL_DIR)$(DELIM)$(PROGNAME) $(ARCHCRT0OBJ) $(MAINOBJ) $(LDLIBS)
$(Q) $(NM) -u $(INSTALL_DIR)$(DELIM)$(PROGNAME)
PROGLIST := $(addprefix $(INSTALL_DIR)$(DELIM),$(PROGNAME))
PROGOBJ := $(MAINOBJ)
install: $(BIN_DIR)$(DELIM)$(PROGNAME)
$(PROGLIST): $(MAINOBJ) $(OBJS)
$(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $(firstword $(PROGLIST)) $(ARCHCRT0OBJ) $(firstword $(PROGOBJ)) $(LDLIBS)
$(Q) $(NM) -u $(firstword $(PROGLIST))
$(eval PROGLIST=$(filter-out $(firstword $(PROGLIST)),$(PROGLIST)))
$(eval PROGOBJ=$(filter-out $(firstword $(PROGOBJ)),$(PROGOBJ)))
install:: $(PROGLIST)
else
install:
install::
endif
preconfig:
preconfig::
ifeq ($(CONFIG_NSH_BUILTIN_APPS),y)
REGLIST := $(addprefix $(BUILTIN_REGISTRY)$(DELIM),$(APPNAME)_main.bdat)
APPLIST := $(APPNAME)
ifneq ($(APPNAME),)
ifneq ($(PRIORITY),)
ifneq ($(STACKSIZE),)
$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile
$(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(if $(BUILD_MODULE),,$(APPNAME)_main))
$(REGLIST): $(DEPCONFIG) Makefile
$(call REGISTER,$(firstword $(APPLIST)),$(firstword $(PRIORITY)),$(firstword $(STACKSIZE)),$(if $(BUILD_MODULE),,$(firstword $(APPLIST))_main))
$(eval APPLIST=$(filter-out $(firstword $(APPLIST)),$(APPLIST)))
$(if $(filter-out $(firstword $(PRIORITY)),$(PRIORITY)),$(eval PRIORITY=$(filter-out $(firstword $(PRIORITY)),$(PRIORITY))))
$(if $(filter-out $(firstword $(STACKSIZE)),$(STACKSIZE)),$(eval STACKSIZE=$(filter-out $(firstword $(STACKSIZE)),$(STACKSIZE))))
context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat
context:: $(REGLIST)
else
context:
context::
endif
else
context:
context::
endif
else
context:
context::
endif
else
context:
context::
endif
.depend: Makefile $(SRCS)
@ -162,13 +227,13 @@ else
endif
$(Q) touch $@
depend: .depend
depend:: .depend
clean:
clean::
$(call DELFILE, .built)
$(call CLEAN)
distclean: clean
distclean:: clean
$(call DELFILE, Make.dep)
$(call DELFILE, .depend)

View File

@ -123,4 +123,6 @@ endif
CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" "$(APPDIR)$(DELIM)include"}
CXXFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" "$(APPDIR)$(DELIM)include"}
LDLIBS = $(APPDIR)/libapps.a
ifneq ($(CONFIG_BUILD_KERNEL),y)
LDLIBS = $(APPDIR)/libapps.a
endif

View File

@ -161,6 +161,7 @@ clean: $(foreach SDIR, $(CLEANDIRS), $(SDIR)_clean)
$(call DELFILE, $(BIN))
$(call DELFILE, Kconfig)
$(call DELDIR, $(BIN_DIR))
$(call DELDIR, $(EXE_DIR))
$(call CLEAN)
distclean: $(foreach SDIR, $(CLEANDIRS), $(SDIR)_distclean)

View File

@ -34,49 +34,16 @@
############################################################################
-include $(TOPDIR)/Make.defs
include $(APPDIR)/Make.defs
# Source and object files
ASRCS =
CSRCS = builtin_forindex.c builtin_list.c exec_builtin.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\libapps$(LIBEXT)
else
ifeq ($(WINTOOL),y)
BIN = ..\\libapps$(LIBEXT)
else
BIN = ../libapps$(LIBEXT)
endif
endif
ROOTDEPPATH = --dep-path .
VPATH =
# Registry entry lists
PDATLIST = $(strip $(call RWILDCARD, registry, *.pdat))
BDATLIST = $(strip $(call RWILDCARD, registry, *.bdat))
# Build Targets
all: .built
.PHONY: context depend clean distclean preconfig
.PRECIOUS: ../libapps$(LIBEXT)
$(AOBJS): %$(OBJEXT): %.S
$(call ASSEMBLE, $<, $@)
$(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
registry$(DELIM).updated:
$(Q) $(MAKE) -C registry .updated TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"
@ -98,35 +65,19 @@ ifneq ($(PDATLIST),)
endif
$(Q) mv .xx_builtin_proto.h builtin_proto.h
.built: $(OBJS)
$(call ARCHIVE, $(BIN), $(OBJS))
$(Q) touch .built
install:
context:
context::
$(Q) $(MAKE) -C registry context TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"
.depend: Makefile $(SRCS) builtin_list.h builtin_proto.h
$(Q) $(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
$(Q) touch $@
depend:: builtin_list.h builtin_proto.h
depend: .depend
clean:
clean::
$(Q) $(MAKE) -C registry clean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"
$(call DELFILE, .built)
$(call DELFILE, .xx_builtin_list.h)
$(call DELFILE, .xx_builtin_proto.h)
$(call CLEAN)
distclean: clean
distclean::
$(Q) $(MAKE) -C registry distclean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"
$(call DELFILE, Make.dep)
$(call DELFILE, .depend)
$(call DELFILE, builtin_list.h)
$(call DELFILE, builtin_proto.h)
preconfig:
-include Make.dep
include $(APPDIR)/Application.mk

View File

@ -34,7 +34,6 @@
############################################################################
-include $(TOPDIR)/Make.defs
include $(APPDIR)/Make.defs
WGET = wget
UNPACK = unzip
@ -52,25 +51,6 @@ APPS_INCDIR = $(APPDIR)$(DELIM)include$(DELIM)canutils
CFLAGS += -std=c99 -I$(APPS_INCDIR) -DCANARD_ASSERT=DEBUGASSERT
CSRCS = $(LIBCANARD_SRCDIR)$(DELIM)canard.c $(LIBCANARD_DRVDIR)$(DELIM)canard_nuttx.c
COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(CSRCS)
OBJS = $(COBJS)
ifeq ($(WINTOOL),y)
BIN = "${shell cygpath -w $(APPDIR)$(DELIM)libapps$(LIBEXT)}"
else
BIN = $(APPDIR)$(DELIM)libapps$(LIBEXT)
endif
DEPBIN = $(APPDIR)/libapps$(LIBEXT)
ROOTDEPPATH = --dep-path .
VPATH =
all: .built
.PHONY: clean depend distclean preconfig
.PRECIOUS: ../../libapps$(LIBEXT)
$(LIBCANARD_PACKNAME):
@echo "Downloading: $@"
@ -92,36 +72,15 @@ $(APPS_INCDIR)$(DELIM)canard.h: $(LIBCANARD_SRCDIR)$(DELIM)canard.h
$(APPS_INCDIR)$(DELIM)canard_nuttx.h: $(LIBCANARD_DRVDIR)$(DELIM)canard_nuttx.h
$(Q) cp $< $@
$(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
context:: $(APPS_INCDIR)$(DELIM)canard.h $(APPS_INCDIR)$(DELIM)canard_nuttx.h
.built: $(OBJS)
$(call ARCHIVE, $(BIN), $(OBJS))
$(Q) touch $@
install:
context: $(APPS_INCDIR)$(DELIM)canard.h $(APPS_INCDIR)$(DELIM)canard_nuttx.h
.depend: Makefile $(SRCS)
$(Q) $(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
$(Q) touch $@
depend: .depend
clean:
$(call DELFILE, .built)
$(call CLEAN)
clean::
$(foreach OBJ, $(OBJS), $(call DELFILE, $(OBJ)))
distclean: clean
$(call DELFILE, Make.dep)
$(call DELFILE, .depend)
distclean::
$(call DELFILE, $(APPS_INCDIR)$(DELIM)canard.h)
$(call DELFILE, $(APPS_INCDIR)$(DELIM)canard_nuttx.h)
$(call DELDIR, $(LIBCANARD_UNPACKNAME))
$(call DELFILE, $(LIBCANARD_PACKNAME))
preconfig:
-include Make.dep
include $(APPDIR)/Application.mk

View File

@ -4,7 +4,7 @@
#
config EXAMPLES_ADC
bool "ADC example"
tristate "ADC example"
default n
depends on ADC && LIB_BOARDCTL
select BOARDCTL_ADCTEST

View File

@ -34,6 +34,6 @@
#
############################################################################
ifeq ($(CONFIG_EXAMPLES_ADC),y)
ifneq ($(CONFIG_EXAMPLES_ADC),)
CONFIGURED_APPS += examples/adc
endif

View File

@ -50,4 +50,6 @@ APPNAME = adc
PRIORITY = SCHED_PRIORITY_DEFAULT
STACKSIZE = 2048
MODULE = CONFIG_EXAMPLES_ADC
include $(APPDIR)/Application.mk

View File

@ -4,7 +4,7 @@
#
config EXAMPLES_ADXL372_TEST
bool "ADXL372 test program"
tristate "ADXL372 test program"
default n
---help---
Enable the ADXL372 sensor SPI test program.

View File

@ -34,6 +34,6 @@
#
############################################################################
ifeq ($(CONFIG_EXAMPLES_ADXL372_TEST),y)
ifneq ($(CONFIG_EXAMPLES_ADXL372_TEST),)
CONFIGURED_APPS += examples/adxl372_test
endif

View File

@ -51,4 +51,6 @@ MAINSRC = adxl372_test_main.c
CONFIG_EXAMPLES_ADXL372_TEST_PROGNAME ?= adxl372_test$(EXEEXT)
PROGNAME = $(CONFIG_EXAMPLES_ADXL372_TEST_PROGNAME)
MODULE = CONFIG_EXAMPLES_ADXL372_TEST
include $(APPDIR)/Application.mk

View File

@ -4,7 +4,7 @@
#
config EXAMPLES_AJOYSTICK
bool "Analog joystick example"
tristate "Analog joystick example"
default n
depends on AJOYSTICK && !DISABLE_SIGNALS
---help---

View File

@ -34,6 +34,6 @@
#
############################################################################
ifeq ($(CONFIG_EXAMPLES_AJOYSTICK),y)
ifneq ($(CONFIG_EXAMPLES_AJOYSTICK),)
CONFIGURED_APPS += examples/ajoystick
endif

View File

@ -50,5 +50,7 @@ APPNAME = ajoy
PRIORITY = SCHED_PRIORITY_DEFAULT
STACKSIZE = 2048
MODULE = CONFIG_EXAMPLES_AJOYSTICK
include $(APPDIR)/Application.mk

View File

@ -4,7 +4,7 @@
#
config EXAMPLES_ALARM
bool "RTC alarm driver example"
tristate "RTC alarm driver example"
default n
depends on RTC_DRIVER && RTC_ALARM
---help---

View File

@ -34,6 +34,6 @@
#
############################################################################
ifeq ($(CONFIG_EXAMPLES_ALARM),y)
ifneq ($(CONFIG_EXAMPLES_ALARM),)
CONFIGURED_APPS += examples/alarm
endif

View File

@ -53,4 +53,6 @@ MAINSRC = alarm_main.c
CONFIG_EXAMPLES_ALARM_PROGNAME ?= alarm$(EXEEXT)
PROGNAME = $(CONFIG_EXAMPLES_ALARM_PROGNAME)
MODULE = CONFIG_EXAMPLES_ALARM
include $(APPDIR)/Application.mk

View File

@ -4,7 +4,7 @@
#
config EXAMPLES_APA102
bool "APA102 LED Strip example"
tristate "APA102 LED Strip example"
default n
---help---
Enable the APA102 example

View File

@ -34,6 +34,6 @@
#
############################################################################
ifeq ($(CONFIG_EXAMPLES_APA102),y)
ifneq ($(CONFIG_EXAMPLES_APA102),)
CONFIGURED_APPS += examples/apa102
endif

View File

@ -50,4 +50,6 @@ MAINSRC = apa102_main.c
CONFIG_EXAMPLES_APA102_PROGNAME ?= apa102$(EXEEXT)
PROGNAME = $(CONFIG_EXAMPLES_APA102_PROGNAME)
MODULE = CONFIG_EXAMPLES_APA102
include $(APPDIR)/Application.mk

View File

@ -4,7 +4,7 @@
#
config EXAMPLES_APDS9960
bool "APDS-9960 Test Application"
tristate "APDS-9960 Test Application"
default n
depends on SENSORS_APDS9960
---help---

View File

@ -34,6 +34,6 @@
#
############################################################################
ifeq ($(CONFIG_EXAMPLES_APDS9960),y)
ifneq ($(CONFIG_EXAMPLES_APDS9960),)
CONFIGURED_APPS += examples/apds9960
endif

View File

@ -53,4 +53,6 @@ MAINSRC = apds9960_main.c
CONFIG_EXAMPLES_APDS9960_PROGNAME ?= apds9960$(EXEEXT)
PROGNAME = $(CONFIG_EXAMPLES_APDS9960_PROGNAME)
MODULE = CONFIG_EXAMPLES_APDS9960
include $(APPDIR)/Application.mk

View File

@ -4,7 +4,7 @@
#
config EXAMPLES_BASTEST
bool "Setup Test Files for BAS"
tristate "Setup Test Files for BAS"
default n
depends on FS_ROMFS && INTERPRETERS_BAS
---help---

View File

@ -34,6 +34,6 @@
#
############################################################################
ifeq ($(CONFIG_EXAMPLES_BASTEST),y)
ifneq ($(CONFIG_EXAMPLES_BASTEST),)
CONFIGURED_APPS += examples/bastest
endif

View File

@ -33,9 +33,7 @@
#
############################################################################
-include $(TOPDIR)/.config
-include $(TOPDIR)/Make.defs
include $(APPDIR)/Make.defs
# BAS test volume mounter
@ -45,37 +43,8 @@ STACKSIZE = 2048
# Hello, World! Example
ASRCS =
CSRCS =
MAINSRC = bastest_main.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
MAINOBJ = $(MAINSRC:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifneq ($(CONFIG_BUILD_LOADABLE),y)
OBJS += $(MAINOBJ)
endif
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT)
else
BIN = ../../libapps$(LIBEXT)
endif
endif
ifeq ($(WINTOOL),y)
INSTALL_DIR = "${shell cygpath -w $(BIN_DIR)}"
else
INSTALL_DIR = $(BIN_DIR)
endif
BASTEST_DIR = $(APPDIR)$(DELIM)examples$(DELIM)bastest
TESTS_DIR = $(BASTEST_DIR)$(DELIM)tests
ROMFS_IMG = romfs.img
@ -83,22 +52,8 @@ ROMFS_HDR = romfs.h
PROGNAME = bastest$(EXEEXT)
ROOTDEPPATH = --dep-path .
# Common build
VPATH =
all: .built
.PHONY: clean depend distclean preconfig
.PRECIOUS: ../../libapps$(LIBEXT)
$(AOBJS): %$(OBJEXT): %.S
$(call ASSEMBLE, $<, $@)
$(COBJS) $(MAINOBJ): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
# Create the romfs.h header file from the tests/ directory
$(ROMFS_IMG) :
@ -109,54 +64,12 @@ $(ROMFS_HDR) : $(ROMFS_IMG)
# Add the BASTEST object to the archive
.built: $(ROMFS_HDR) $(OBJS)
$(call ARCHIVE, $(BIN), $(OBJS))
@touch .built
context:: $(ROMFS_HDR)
# Link and install the program binary
ifeq ($(CONFIG_BUILD_LOADABLE),y)
$(BIN_DIR)$(DELIM)$(PROGNAME): $(OBJS) $(MAINOBJ)
@echo "LD: $(PROGNAME)"
$(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $(INSTALL_DIR)$(DELIM)$(PROGNAME) $(ARCHCRT0OBJ) $(MAINOBJ) $(LDLIBS)
$(Q) $(NM) -u $(INSTALL_DIR)$(DELIM)$(PROGNAME)
install: $(BIN_DIR)$(DELIM)$(PROGNAME)
else
install:
endif
# Register the NSH builtin application
ifeq ($(CONFIG_NSH_BUILTIN_APPS),y)
$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile
$(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(if $(CONFIG_BUILD_LOADABLE),,$(APPNAME)_main))
context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat
else
context:
endif
# Housekeeping stuff
.depend: Makefile $(SRCS)
@$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
@touch $@
depend: .depend
clean:
$(call DELFILE, .built)
$(call CLEAN)
distclean: clean
distclean::
$(call DELFILE, $(ROMFS_HDR))
$(call DELFILE, $(ROMFS_IMG))
$(call DELFILE, Make.dep)
$(call DELFILE, .depend)
preconfig:
MODULE = CONFIG_EXAMPLES_BASTEST
-include Make.dep
include $(APPDIR)/Application.mk

View File

@ -4,7 +4,7 @@
#
config EXAMPLES_BMP180
bool "BMP180 Barometer sensor example"
tristate "BMP180 Barometer sensor example"
default n
depends on SENSORS_BMP180
---help---

View File

@ -34,6 +34,6 @@
#
############################################################################
ifeq ($(CONFIG_EXAMPLES_BMP180),y)
ifneq ($(CONFIG_EXAMPLES_BMP180),)
CONFIGURED_APPS += examples/bmp180
endif

View File

@ -55,4 +55,6 @@ MAINSRC = bmp180_main.c
CONFIG_EXAMPLES_BMP180_PROGNAME ?= bmp180$(EXEEXT)
PROGNAME = $(CONFIG_EXAMPLES_BMP180_PROGNAME)
MODULE = CONFIG_EXAMPLES_BMP180
include $(APPDIR)/Application.mk

View File

@ -4,7 +4,7 @@
#
config EXAMPLES_BRIDGE
bool "UDP bridge example"
tristate "UDP bridge example"
default n
depends on NET_UDP && !NET_IPv6
---help---

View File

@ -34,6 +34,6 @@
#
############################################################################
ifeq ($(CONFIG_EXAMPLES_BRIDGE),y)
ifneq ($(CONFIG_EXAMPLES_BRIDGE),)
CONFIGURED_APPS += examples/bridge
endif

View File

@ -34,34 +34,18 @@
#
############################################################################
-include $(TOPDIR)/.config
-include $(TOPDIR)/Make.defs
include $(APPDIR)/Make.defs
# Discover built-in application info
TARG_APPNAME = bridge
TARG_PRIORITY = SCHED_PRIORITY_DEFAULT
TARG_STACKSIZE = 2048
APPNAME = bridge
PRIORITY = SCHED_PRIORITY_DEFAULT
STACKSIZE = 2048
TARG_ASRCS =
TARG_CSRCS =
MAINSRC = bridge_main.c
TARG_AOBJS = $(TARG_ASRCS:.S=$(OBJEXT))
TARG_COBJS = $(TARG_CSRCS:.c=$(OBJEXT))
TARG_MAINOBJ = $(MAINSRC:.c=$(OBJEXT))
TARG_SRCS = $(TARG_ASRCS) $(TARG_CSRCS) $(MAINSRC)
TARG_OBJS = $(TARG_AOBJS) $(TARG_COBJS)
ifneq ($(CONFIG_BUILD_LOADABLE),y)
TARG_OBJS += $(TARG_MAINOBJ)
endif
HOST_SRCS1 = host_net1.c
HOST_SRCS2 = host_net2.c
HOST_SRCS = $(HOST_SRCS1) $(HOST_SRCS2)
HOST_OBJS1 = $(HOST_SRCS1:.c=.o)
HOST_OBJS2 = $(HOST_SRCS2:.c=.o)
@ -70,48 +54,15 @@ HOST_OBJS = $(HOST_OBJS1) $(HOST_OBJS2)
HOST_BIN1 = host1
HOST_BIN2 = host2
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
TARG_BIN = ..\..\libapps$(LIBEXT)
else
ifeq ($(WINTOOL),y)
TARG_BIN = ..\\..\\libapps$(LIBEXT)
else
TARG_BIN = ../../libapps$(LIBEXT)
endif
endif
ifeq ($(WINTOOL),y)
TARG_INSTALL_DIR = "${shell cygpath -w $(BIN_DIR)}"
else
TARG_INSTALL_DIR = $(BIN_DIR)
endif
CONFIG_EXAMPLES_BRIDGE_PROGNAME ?= bridge$(EXEEXT)
TARG_PROGNAME = $(CONFIG_EXAMPLES_BRIDGE_PROGNAME)
ROOTDEPPATH = --dep-path .
PROGNAME = $(CONFIG_EXAMPLES_BRIDGE_PROGNAME)
# Common build
VPATH =
all: .built
.PHONY: clean depend distclean preconfig
.PRECIOUS: ../../libapps$(LIBEXT)
$(TARG_AOBJS): %$(OBJEXT): %.S
$(call ASSEMBLE, $<, $@)
$(TARG_COBJS) $(TARG_MAINOBJ): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
$(HOST_OBJS): %.o: %.c
@echo "CC: $<"
$(Q) $(HOSTCC) -c $(HOSTCFLAGS) $< -o $@
$(TARG_BIN): $(TARG_OBJS)
$(call ARCHIVE, $(TARG_BIN), $(TARG_OBJS))
bridge_config.h: $(TOPDIR)/include/nuttx/config.h
@echo "CP: brigetconfig.h"
$(Q) cp $(TOPDIR)/include/nuttx/config.h bridge_config.h
@ -124,48 +75,15 @@ $(HOST_BIN2): bridge_config.h $(HOST_OBJS2)
@echo "LD: $@"
$(Q) $(HOSTCC) $(HOSTLDFLAGS) $(HOST_OBJS2) -o $@
.built: $(TARG_BIN) $(HOST_BIN1) $(HOST_BIN2)
@touch .built
context:: $(HOST_BIN1) $(HOST_BIN2)
ifeq ($(CONFIG_BUILD_LOADABLE),y)
$(BIN_DIR)$(DELIM)$(TARG_PROGNAME): $(TARG_OBJS) $(TARG_MAINOBJ)
@echo "LD: $(TARG_PROGNAME)"
$(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $(TARG_INSTALL_DIR)$(DELIM)$(TARG_PROGNAME) $(ARCHCRT0OBJ) $(TARG_MAINOBJ) $(LDLIBS)
$(Q) $(NM) -u $(TARG_INSTALL_DIR)$(DELIM)$(TARG_PROGNAME)
install: $(BIN_DIR)$(DELIM)$(TARG_PROGNAME)
else
install:
endif
ifeq ($(CONFIG_NSH_BUILTIN_APPS),y)
$(BUILTIN_REGISTRY)$(DELIM)$(TARG_APPNAME)_main.bdat: $(DEPCONFIG) Makefile
$(call REGISTER,$(TARG_APPNAME),$(TARG_PRIORITY),$(TARG_STACKSIZE),$(if $(CONFIG_BUILD_LOADABLE),,$(TARG_APPNAME)_main))
context: $(BUILTIN_REGISTRY)$(DELIM)$(TARG_APPNAME)_main.bdat
else
context:
endif
.depend: Makefile $(TARG_SRCS)
@$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(TARG_SRCS) >Make.dep
@touch $@
depend: .depend
clean:
$(call DELFILE, .built)
clean::
$(call DELFILE, $(HOST_BIN1))
$(call DELFILE, $(HOST_BIN2))
$(call CLEAN)
distclean: clean
$(call DELFILE, Make.dep)
$(call DELFILE, .depend)
distclean::
$(call DELFILE, bridge_config.h)
preconfig:
MODULE = CONFIG_EXAMPLES_BRIDGE
-include Make.dep
include $(APPDIR)/Application.mk

View File

@ -4,7 +4,7 @@
#
config EXAMPLES_BUTTONS
bool "Buttons driver example"
tristate "Buttons driver example"
default n
depends on ARCH_HAVE_BUTTONS
---help---

View File

@ -34,6 +34,6 @@
#
############################################################################
ifeq ($(CONFIG_EXAMPLES_BUTTONS),y)
ifneq ($(CONFIG_EXAMPLES_BUTTONS),)
CONFIGURED_APPS += examples/buttons
endif

View File

@ -53,4 +53,6 @@ MAINSRC = buttons_main.c
CONFIG_EXAMPLES_BUTTONS_PROGNAME ?= buttons$(EXEEXT)
PROGNAME = $(CONFIG_EXAMPLES_BUTTONS_PROGNAME)
MODULE = CONFIG_EXAMPLES_BUTTONS
include $(APPDIR)/Application.mk

View File

@ -4,7 +4,7 @@
#
config EXAMPLES_CALIB_UDELAY
bool "Calibration tool for udelay"
tristate "Calibration tool for udelay"
default n
select CLOCK_MONOTONIC
select LIBC_FLOATINGPOINT

View File

@ -34,6 +34,6 @@
#
############################################################################
ifeq ($(CONFIG_EXAMPLES_CALIB_UDELAY),y)
ifneq ($(CONFIG_EXAMPLES_CALIB_UDELAY),)
CONFIGURED_APPS += examples/calib_udelay
endif

View File

@ -53,4 +53,6 @@ ASRCS =
CSRCS =
MAINSRC = calib_udelay_main.c
MODULE = CONFIG_EXAMPLES_CALIB_UDELAY
include $(APPDIR)/Application.mk

View File

@ -4,7 +4,7 @@
#
config EXAMPLES_CAN
bool "CAN example"
tristate "CAN example"
default n
depends on CAN
---help---

View File

@ -34,6 +34,6 @@
#
############################################################################
ifeq ($(CONFIG_EXAMPLES_CAN),y)
ifneq ($(CONFIG_EXAMPLES_CAN),)
CONFIGURED_APPS += examples/can
endif

View File

@ -50,4 +50,6 @@ APPNAME = can
PRIORITY = SCHED_PRIORITY_DEFAULT
STACKSIZE = 2048
MODULE = CONFIG_EXAMPLES_CAN
include $(APPDIR)/Application.mk

View File

@ -4,7 +4,7 @@
#
config EXAMPLES_LIBCANARD
bool "libcandard example"
tristate "libcandard example"
default n
depends on CANUTILS_LIBCANARD && CLOCK_MONOTONIC && SYSTEM_TIME64
---help---

View File

@ -34,6 +34,6 @@
#
############################################################################
ifeq ($(CONFIG_EXAMPLES_LIBCANARD),y)
ifneq ($(CONFIG_EXAMPLES_LIBCANARD),)
CONFIGURED_APPS += examples/canard
endif

View File

@ -49,4 +49,6 @@ CSRCS =
CFLAGS += -I$(APPDIR)/include/canutils
MAINSRC = canard_main.c
MODULE = CONFIG_EXAMPLES_LIBCANARD
include $(APPDIR)/Application.mk

View File

@ -4,7 +4,7 @@
#
config EXAMPLES_CCTYPE
bool "Verify C++ cctype operations"
tristate "Verify C++ cctype operations"
default n
---help---
Enable the a simple test to verify C++ cctype operations.

View File

@ -34,6 +34,6 @@
#
############################################################################
ifeq ($(CONFIG_EXAMPLES_CCTYPE),y)
ifneq ($(CONFIG_EXAMPLES_CCTYPE),)
CONFIGURED_APPS += examples/cctype
endif

View File

@ -51,4 +51,6 @@ APPNAME = cctype
PRIORITY = SCHED_PRIORITY_DEFAULT
STACKSIZE = 2048
MODULE = CONFIG_EXAMPLES_CCTYPE
include $(APPDIR)/Application.mk

View File

@ -4,7 +4,7 @@
#
menuconfig EXAMPLES_CHAT
bool "AT modem chat utility"
tristate "AT modem chat utility"
default n
select NETUTILS_CHAT
---help---

View File

@ -34,6 +34,6 @@
#
############################################################################
ifeq ($(CONFIG_EXAMPLES_CHAT),y)
ifneq ($(CONFIG_EXAMPLES_CHAT),)
CONFIGURED_APPS += examples/chat
endif

View File

@ -33,103 +33,17 @@
#
############################################################################
-include $(TOPDIR)/.config
-include $(TOPDIR)/Make.defs
include $(APPDIR)/Make.defs
ASRCS =
CSRCS =
MAINSRC = chat_main.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
MAINOBJ = $(MAINSRC:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifneq ($(CONFIG_BUILD_LOADABLE),y)
OBJS += $(MAINOBJ)
endif
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT)
else
BIN = ../../libapps$(LIBEXT)
endif
endif
ifeq ($(WINTOOL),y)
INSTALL_DIR = "${shell cygpath -w $(BIN_DIR)}"
else
INSTALL_DIR = $(BIN_DIR)
endif
CONFIG_XYZ_PROGNAME ?= chat$(EXEEXT)
PROGNAME = $(CONFIG_XYZ_PROGNAME)
ROOTDEPPATH = --dep-path .
VPATH =
APPNAME = chat
PRIORITY = SCHED_PRIORITY_DEFAULT
STACKSIZE = 2048
# Build targets
MODULE = CONFIG_EXAMPLES_CHAT
all: .built
.PHONY: context .depend depend clean distclean preconfig
.PRECIOUS: ../../libapps$(LIBEXT)
$(AOBJS): %$(OBJEXT): %.S
$(call ASSEMBLE, $<, $@)
$(COBJS) $(MAINOBJ): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
.built: $(OBJS)
$(call ARCHIVE, $(BIN), $(OBJS))
$(Q) touch .built
ifeq ($(CONFIG_BUILD_LOADABLE),y)
$(BIN_DIR)$(DELIM)$(PROGNAME): $(OBJS) $(MAINOBJ)
@echo "LD: $(PROGNAME)"
$(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $(INSTALL_DIR)$(DELIM)$(PROGNAME) $(ARCHCRT0OBJ) $(MAINOBJ) $(LDLIBS)
$(Q) $(NM) -u $(INSTALL_DIR)$(DELIM)$(PROGNAME)
install: $(BIN_DIR)$(DELIM)$(PROGNAME)
else
install:
endif
ifeq ($(CONFIG_NSH_BUILTIN_APPS),y)
$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile
$(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(if $(CONFIG_BUILD_LOADABLE),,$(APPNAME)_main))
context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat
else
context:
endif
.depend: Makefile $(SRCS)
$(Q) $(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
$(Q) touch $@
depend: .depend
clean:
$(call DELFILE, .built)
$(call CLEAN)
distclean: clean
$(call DELFILE, Make.dep)
$(call DELFILE, .depend)
preconfig:
-include Make.dep
include $(APPDIR)/Application.mk

View File

@ -4,7 +4,7 @@
#
config EXAMPLES_CONFIGDATA
bool "Config Data example / unit test"
tristate "Config Data example / unit test"
default n
---help---
Enable the Config Data example

View File

@ -34,6 +34,6 @@
#
############################################################################
ifeq ($(CONFIG_EXAMPLES_CONFIGDATA),y)
ifneq ($(CONFIG_EXAMPLES_CONFIGDATA),)
CONFIGURED_APPS += examples/configdata
endif

View File

@ -48,4 +48,6 @@ MAINSRC = configdata_main.c
CONFIG_XYZ_PROGNAME ?= configdata$(EXEEXT)
PROGNAME = $(CONFIG_XYZ_PROGNAME)
MODULE = CONFIG_EXAMPLES_CONFIGDATA
include $(APPDIR)/Application.mk

View File

@ -4,7 +4,7 @@
#
config EXAMPLES_CPUHOG
bool "CPU hog"
tristate "CPU hog"
default n
depends on PIPES
---help---

View File

@ -34,6 +34,6 @@
#
############################################################################
ifeq ($(CONFIG_EXAMPLES_CPUHOG),y)
ifneq ($(CONFIG_EXAMPLES_CPUHOG),)
CONFIGURED_APPS += examples/cpuhog
endif

View File

@ -53,4 +53,6 @@ APPNAME = cpuhog
PRIORITY = $(CONFIG_EXAMPLES_CPUHOG_PRIORITY)
STACKSIZE = $(CONFIG_EXAMPLES_CPUHOG_STACKSIZE)
MODULE = CONFIG_EXAMPLES_CPUHOG
include $(APPDIR)/Application.mk

View File

@ -34,6 +34,6 @@
#
############################################################################
ifeq ($(CONFIG_EXAMPLES_CROMFS),y)
ifneq ($(CONFIG_EXAMPLES_CROMFS),)
CONFIGURED_APPS += examples/cromfs
endif

View File

@ -33,72 +33,27 @@
#
############################################################################
-include $(TOPDIR)/.config
-include $(TOPDIR)/Make.defs
include $(APPDIR)/Make.defs
# CROMFS Example
CSRCS = cromfs.c
COBJS = $(CSRCS:.c=$(OBJEXT))
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT)
else
BIN = ../../libapps$(LIBEXT)
endif
endif
NXTOOLDIR = $(TOPDIR)/tools
GENCROMFSSRC = gencromfs.c
GENCROMFSEXE = gencromfs$(EXEEXT)
ROOTDEPPATH = --dep-path .
# Build targets
VPATH = .
all: .built
.PHONY: clean depend distclean preconfig
.PRECIOUS: ../../libapps$(LIBEXT)
$(COBJS) : %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
$(NXTOOLDIR)$(DELIM)$(GENCROMFSEXE): $(NXTOOLDIR)$(DELIM)$(GENCROMFSSRC)
$(Q) $(MAKE) -C $(NXTOOLDIR) -f Makefile.host $(GENCROMFSEXE)
cromfs.c: $(NXTOOLDIR)$(DELIM)$(GENCROMFSEXE)
$(Q) $(NXTOOLDIR)$(DELIM)$(GENCROMFSEXE) cromfs cromfs.c
.built: cromfs.c $(COBJS)
$(call ARCHIVE, $(BIN), $(COBJS))
@touch .built
context:: cromfs.c
install:
context:
# We can't make dependencies in this directory because the required
# header files may not yet exist.
.depend:
@touch $@
depend: .depend
clean:
$(call DELFILE, .built)
$(call CLEAN)
distclean: clean
$(call DELFILE, Make.dep)
$(call DELFILE, .depend)
distclean::
$(call DELFILE, cromfs.c)
preconfig:
-include Make.dep
include $(APPDIR)/Application.mk

View File

@ -4,7 +4,7 @@
#
config EXAMPLES_CXXTEST
bool "C++ test program"
tristate "C++ test program"
default n
depends on HAVE_CXX
---help---

View File

@ -34,6 +34,6 @@
#
############################################################################
ifeq ($(CONFIG_EXAMPLES_CXXTEST),y)
ifneq ($(CONFIG_EXAMPLES_CXXTEST),)
CONFIGURED_APPS += examples/cxxtest
endif

View File

@ -51,4 +51,6 @@ APPNAME = cxxtest
PRIORITY = SCHED_PRIORITY_DEFAULT
STACKSIZE = 4096
MODULE = CONFIG_EXAMPLES_CXXTEST
include $(APPDIR)/Application.mk

View File

@ -1,5 +1,5 @@
config EXAMPLES_DAC
bool "DAC tool"
tristate "DAC tool"
default n
depends on DAC
---help---

View File

@ -1,3 +1,3 @@
ifeq ($(CONFIG_EXAMPLES_DAC),y)
ifneq ($(CONFIG_EXAMPLES_DAC),)
CONFIGURED_APPS += examples/dac
endif

View File

@ -50,4 +50,6 @@ APPNAME = dac
PRIORITY = SCHED_PRIORITY_DEFAULT
STACKSIZE = 2048
MODULE = CONFIG_EXAMPLES_DAC
include $(APPDIR)/Application.mk

View File

@ -4,7 +4,7 @@
#
config EXAMPLES_DHCPD
bool "DHCP server example"
tristate "DHCP server example"
default n
---help---
Enable the DHCP server example

View File

@ -34,6 +34,6 @@
#
############################################################################
ifeq ($(CONFIG_EXAMPLES_DHCPD),y)
ifneq ($(CONFIG_EXAMPLES_DHCPD),)
CONFIGURED_APPS += examples/dhcpd
endif

View File

@ -50,4 +50,6 @@ APPNAME = dhcpd
PRIORITY = SCHED_PRIORITY_DEFAULT
STACKSIZE = 2048
MODULE = CONFIG_EXAMPLES_DHCPD
include $(APPDIR)/Application.mk

View File

@ -42,12 +42,8 @@ CONFIG_EXAMPLES_DHTXX_STACKSIZE ?= 2048
APPNAME = dhtxx
ifeq ($(CONFIG_EXAMPLES_DHTXX),m)
LOADABLE = y
else
PRIORITY = $(CONFIG_EXAMPLES_DHTXX_PRIORITY)
STACKSIZE = $(CONFIG_EXAMPLES_DHTXX_STACKSIZE)
endif
# Dhtxx Example
@ -58,4 +54,6 @@ MAINSRC = dhtxx_main.c
CONFIG_EXAMPLES_DHTXX_PROGNAME ?= dhtxx$(EXEEXT)
PROGNAME = $(CONFIG_EXAMPLES_DHTXX_PROGNAME)
MODULE = CONFIG_EXAMPLES_DHTXX
include $(APPDIR)/Application.mk

View File

@ -4,7 +4,7 @@
#
config EXAMPLES_DISCOVER
bool "UDP Discovery Example"
tristate "UDP Discovery Example"
default n
depends on NET_UDP
select NETUTILS_DISCOVER

View File

@ -34,6 +34,6 @@
#
############################################################################
ifeq ($(CONFIG_EXAMPLES_DISCOVER),y)
ifneq ($(CONFIG_EXAMPLES_DISCOVER),)
CONFIGURED_APPS += examples/discover
endif

View File

@ -51,4 +51,6 @@ MAINSRC = discover_main.c
CONFIG_XYZ_PROGNAME ?= discover$(EXEEXT)
PROGNAME = $(CONFIG_XYZ_PROGNAME)
MODULE = CONFIG_EXAMPLES_DISCOVER
include $(APPDIR)/Application.mk

View File

@ -4,7 +4,7 @@
#
config EXAMPLES_DJOYSTICK
bool "Discrete joystick example"
tristate "Discrete joystick example"
default n
depends on DJOYSTICK && !DISABLE_SIGNALS
---help---

View File

@ -34,6 +34,6 @@
#
############################################################################
ifeq ($(CONFIG_EXAMPLES_DJOYSTICK),y)
ifneq ($(CONFIG_EXAMPLES_DJOYSTICK),)
CONFIGURED_APPS += examples/djoystick
endif

View File

@ -50,4 +50,6 @@ APPNAME = djoy
PRIORITY = SCHED_PRIORITY_DEFAULT
STACKSIZE = 2048
MODULE = CONFIG_EXAMPLES_DJOYSTICK
include $(APPDIR)/Application.mk

View File

@ -4,7 +4,7 @@
#
config EXAMPLES_DSPTEST
bool "LIBDSP library testing"
tristate "LIBDSP library testing"
default n
---help---
Enable the LIBDSP library testing

View File

@ -34,6 +34,6 @@
#
############################################################################
ifeq ($(CONFIG_EXAMPLES_DSPTEST),y)
ifneq ($(CONFIG_EXAMPLES_DSPTEST),)
CONFIGURED_APPS += examples/dsptest
endif

View File

@ -56,4 +56,6 @@ CSRCS += test_observer.c test_transform.c
CONFIG_EXAMPLES_DSPTEST_PROGNAME ?= dsptest$(EXEEXT)
PROGNAME = $(CONFIG_EXAMPLES_DSPTEST_PROGNAME)
MODULE = CONFIG_EXAMPLES_DSPTEST
include $(APPDIR)/Application.mk

View File

@ -34,6 +34,6 @@
#
############################################################################
ifeq ($(CONFIG_EXAMPLES_ELF),y)
ifneq ($(CONFIG_EXAMPLES_ELF),)
CONFIGURED_APPS += examples/elf
endif

View File

@ -33,9 +33,7 @@
#
############################################################################
-include $(TOPDIR)/.config
-include $(TOPDIR)/Make.defs
include $(APPDIR)/Make.defs
# ELF Example
@ -43,99 +41,19 @@ ASRCS =
CSRCS = symtab.c
MAINSRC = elf_main.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
MAINOBJ = $(MAINSRC:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifneq ($(CONFIG_BUILD_LOADABLE),y)
OBJS += $(MAINOBJ)
endif
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT)
else
BIN = ../../libapps$(LIBEXT)
endif
endif
ifeq ($(WINTOOL),y)
INSTALL_DIR = "${shell cygpath -w $(BIN_DIR)}"
else
INSTALL_DIR = $(BIN_DIR)
endif
CONFIG_XYZ_PROGNAME ?= discover$(EXEEXT)
CONFIG_XYZ_PROGNAME ?= elf$(EXEEXT)
PROGNAME = $(CONFIG_XYZ_PROGNAME)
ROOTDEPPATH = --dep-path . --dep-path tests
ROOTDEPPATH := --dep-path tests
# Build targets
VPATH = tests
VPATH += :tests
all: .built
.PHONY: really_build clean_tests clean depend distclean preconfig
.PRECIOUS: ../../libapps$(LIBEXT)
$(AOBJS): %$(OBJEXT): %.S
$(call ASSEMBLE, $<, $@)
$(COBJS) $(MAINOBJ): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
# This is a little messy. The build is broken into two pieces: (1) the
# tests/ subdir build that auto-generates several files, and (2) the real
# build. This is done because we need a fresh build context after auto-
# generating the source files.
really_build: $(OBJS)
$(call ARCHIVE, $(BIN), $(OBJS))
@touch .built
.built:
context::
@$(MAKE) -C tests TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" CROSSDEV=$(CROSSDEV)
@$(MAKE) TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" really_build
ifeq ($(CONFIG_BUILD_LOADABLE),y)
$(BIN_DIR)$(DELIM)$(PROGNAME): $(OBJS) $(MAINOBJ)
@echo "LD: $(PROGNAME)"
$(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $(INSTALL_DIR)$(DELIM)$(PROGNAME) $(ARCHCRT0OBJ) $(MAINOBJ) $(LDLIBS)
$(Q) $(NM) -u $(INSTALL_DIR)$(DELIM)$(PROGNAME)
install: $(BIN_DIR)$(DELIM)$(PROGNAME)
else
install:
endif
context:
# We can't make dependencies in this directory because the required
# header files may not yet exist.
.depend:
@touch $@
depend: .depend
clean_tests:
clean::
@$(MAKE) -C tests TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" CROSSDEV=$(CROSSDEV) clean
clean: clean_tests
$(call DELFILE, .built)
$(call CLEAN)
distclean: clean
$(call DELFILE, Make.dep)
$(call DELFILE, .depend)
preconfig:
-include Make.dep
include $(APPDIR)/Application.mk

View File

@ -4,7 +4,7 @@
#
config EXAMPLES_FB
bool "Framebuffer driver example"
tristate "Framebuffer driver example"
default n
select LCD_PACKEDMSFIRST if LCD
depends on VIDEO_FB

View File

@ -34,6 +34,6 @@
#
############################################################################
ifeq ($(CONFIG_EXAMPLES_FB),y)
ifneq ($(CONFIG_EXAMPLES_FB),)
CONFIGURED_APPS += examples/fb
endif

View File

@ -53,4 +53,6 @@ MAINSRC = fb_main.c
CONFIG_EXAMPLES_FB_PROGNAME ?= fb$(EXEEXT)
PROGNAME = $(CONFIG_EXAMPLES_FB_PROGNAME)
MODULE = CONFIG_EXAMPLES_FB
include $(APPDIR)/Application.mk

View File

@ -4,7 +4,7 @@
#
config EXAMPLES_FBOVERLAY
bool "Framebuffer overlay test tool"
tristate "Framebuffer overlay test tool"
depends on FB_OVERLAY
default n
---help---

View File

@ -34,6 +34,6 @@
#
############################################################################
ifeq ($(CONFIG_EXAMPLES_FBOVERLAY),y)
ifneq ($(CONFIG_EXAMPLES_FBOVERLAY),)
CONFIGURED_APPS += examples/fboverlay
endif

View File

@ -50,4 +50,6 @@ MAINSRC = fboverlay_main.c
CONFIG_EXAMPLES_FBOVERLAY_PROGNAME ?= fboverlay$(EXEEXT)
PROGNAME = $(CONFIG_EXAMPLES_FBOVERLAY_PROGNAME)
MODULE = CONFIG_EXAMPLES_FBOVERLAY
include $(APPDIR)/Application.mk

View File

@ -4,7 +4,7 @@
#
config EXAMPLES_FLASH_TEST
bool "SMART FLASH block device test"
tristate "SMART FLASH block device test"
default n
depends on (!BUILD_PROTECTED && !BUILD_LOADABLE) && MTD_SMART && NSH_BUILTIN_APPS
---help---

View File

@ -34,6 +34,6 @@
#
############################################################################
ifeq ($(CONFIG_EXAMPLES_FLASH_TEST),y)
ifneq ($(CONFIG_EXAMPLES_FLASH_TEST),)
CONFIGURED_APPS += examples/flash_test
endif

View File

@ -53,4 +53,6 @@ MAINSRC = flash_test.c
CONFIG_XYZ_PROGNAME ?= flash_test$(EXEEXT)
PROGNAME = $(CONFIG_XYZ_PROGNAME)
MODULE = CONFIG_EXAMPLES_FLASH_TEST
include $(APPDIR)/Application.mk

View File

@ -4,7 +4,7 @@
#
config EXAMPLES_FLOWC
bool "Serial flow control example"
tristate "Serial flow control example"
default n
depends on SERIAL_TERMIOS
---help---

View File

@ -34,6 +34,6 @@
#
############################################################################
ifeq ($(CONFIG_EXAMPLES_FLOWC),y)
ifneq ($(CONFIG_EXAMPLES_FLOWC),)
CONFIGURED_APPS += examples/flowc
endif

View File

@ -33,77 +33,58 @@
#
############################################################################
-include $(TOPDIR)/.config
-include $(TOPDIR)/Make.defs
include $(APPDIR)/Make.defs
# FLOWC Test
# Target 1
TARG1_CRCS =
ifeq ($(CONFIG_!EXAMPLES_FLOWC_SENDER1),y)
TARG1_CRCS += flowc_sender.c
CSRCS =
MAINSRC =
ifeq ($(CONFIG_EXAMPLES_FLOWC_SENDER1),y)
CSRCS += flowc_sender.c
else
TARG1_CRCS += flowc_receiver.c
CSRCS += flowc_receiver.c
endif
TARG1_MAINSRC = flowc_target1.c
MAINSRC += flowc_target1.c
TARG1_COBJS = $(TARG1_CRCS:.c=$(OBJEXT))
TARG1_MAINOBJ = $(TARG1_MAINSRC:.c=$(OBJEXT))
ifeq ($(CONFIG_!EXAMPLES_FLOWC_SENDER1),y)
ifeq ($(CONFIG_EXAMPLES_FLOWC_SENDER1),y)
CONFIG_EXAMPLES_FLOWC_PROGNAME1 ?= sender
APPNAME1 = sender
else
CONFIG_EXAMPLES_FLOWC_PROGNAME1 ?= receiver
APPNAME1 = receiver
endif
CONFIG_EXAMPLES_FLOWC_PRIORITY1 ?= 100
CONFIG_EXAMPLES_FLOWC_STACKSIZE1 ?= 2048
PROGNAME1 = $(CONFIG_EXAMPLES_FLOWC_PROGNAME1)
PRIORITY1 = $(CONFIG_EXAMPLES_FLOWC_PRIORITY1)
STACKSIZE1 = $(CONFIG_EXAMPLES_FLOWC_STACKSIZE1)
PROGNAME = $(CONFIG_EXAMPLES_FLOWC_PROGNAME1)
PRIORITY = $(CONFIG_EXAMPLES_FLOWC_PRIORITY1)
STACKSIZE = $(CONFIG_EXAMPLES_FLOWC_STACKSIZE1)
# Target 2
ifeq ($(CONFIG_EXAMPLES_FLOWC_TARGET2),y)
TARG2_CSRCS =
ifeq ($(CONFIG_!EXAMPLES_FLOWC_SENDER1),y)
TARG2_CSRCS += flowc_receiver.c
ifeq ($(CONFIG_EXAMPLES_FLOWC_SENDER1),y)
CSRCS += flowc_receiver.c
else
TARG2_CSRCS += flowc_sender.c
CSRCS += flowc_sender.c
endif
TARG2_MAINSRC = flowc_target2.c
MAINSRC += flowc_target2.c
TARG2_COBJS = $(TARG2_CSRCS:.c=$(OBJEXT))
TARG2_MAINOBJ = $(TARG2_MAINSRC:.c=$(OBJEXT))
ifeq ($(CONFIG_!EXAMPLES_FLOWC_SENDER1),y)
ifeq ($(CONFIG_EXAMPLES_FLOWC_SENDER1),y)
CONFIG_EXAMPLES_FLOWC_PROGNAME2 ?= receiver
APPNAME2 = receiver
else
CONFIG_EXAMPLES_FLOWC_PROGNAME2 ?= sender
APPNAME2 = sender
endif
CONFIG_EXAMPLES_FLOWC_PRIORITY2 ?= 100
CONFIG_EXAMPLES_FLOWC_STACKSIZE2 ?= 2048
PROGNAME2 = $(CONFIG_EXAMPLES_FLOWC_PROGNAME2)
PRIORITY2 = $(CONFIG_EXAMPLES_FLOWC_PRIORITY2)
STACKSIZE2 = $(CONFIG_EXAMPLES_FLOWC_STACKSIZE2)
PROGNAME += $(CONFIG_EXAMPLES_FLOWC_PROGNAME2)
PRIORITY += $(CONFIG_EXAMPLES_FLOWC_PRIORITY2)
STACKSIZE += $(CONFIG_EXAMPLES_FLOWC_STACKSIZE2)
endif
TARG_SRCS = $(TARG1_CRCS) $(TARG1_MAINSRC) $(TARG2_CSRCS) $(TARG2_MAINSRC)
TARG_OBJS = $(TARG1_COBJS) $(TARG2_COBJS)
ifneq ($(CONFIG_BUILD_LOADABLE),y)
TARG_OBJS += $(TARG1_MAINOBJ) $(TARG2_MAINOBJ)
endif
# Host
ifneq ($(CONFIG_EXAMPLES_FLOWC_TARGET2),y)
@ -112,7 +93,7 @@ HOSTCFLAGS += -DEXAMPLES_FLOWC_HOST=1
HOSTOBJSEXT ?= hobj
HOST_SRCS = flowc_host.c
ifeq ($(CONFIG_!EXAMPLES_FLOWC_SENDER1),y)
ifeq ($(CONFIG_EXAMPLES_FLOWC_SENDER1),y)
HOST_SRCS += flowc_receiver.c
HOST_BIN = receiver$(EXEEXT)
else
@ -123,45 +104,12 @@ endif
HOST_OBJS = $(HOST_SRCS:.c=.$(HOSTOBJSEXT))
endif
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
TARG_BIN = ..\..\libapps$(LIBEXT)
else
ifeq ($(WINTOOL),y)
TARG_BIN = ..\\..\\libapps$(LIBEXT)
else
TARG_BIN = ../../libapps$(LIBEXT)
endif
endif
ifeq ($(CONFIG_EXAMPLES_FLOWC_TARGET2),y)
MAINNAME1 = flowc1_main
MAINNAME2 = flowc2_main
APPNAME = flowc1 flowc2
else
MAINNAME1 = flowc_main
APPNAME = flowc
endif
ifeq ($(WINTOOL),y)
INSTALL_DIR = "${shell cygpath -w $(BIN_DIR)}"
else
INSTALL_DIR = $(BIN_DIR)
endif
ROOTDEPPATH = --dep-path .
# Common build
VPATH =
all: .built
.PHONY: clean depend distclean preconfig
.PRECIOUS: ../../libapps$(LIBEXT)
$(TARG1_COBJS) $(TARG1_MAINOBJ) $(TARG2_COBJS) $(TARG2_MAINOBJ): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
$(TARG_BIN): $(TARG_OBJS) $(HOST_BIN)
$(call ARCHIVE, $@, $(TARG_OBJS))
ifneq ($(CONFIG_EXAMPLES_FLOWC_TARGET2),y)
$(HOST_OBJS): %.$(HOSTOBJSEXT): %.c
@echo "CC: $<"
@ -177,59 +125,16 @@ $(HOST_BIN): config.h $(HOST_OBJS)
$(Q) $(HOSTCC) $(HOSTLDFLAGS) $(HOST_OBJS) -o $@
endif
.built: config.h $(TARG_BIN) $(HOST_BIN)
$(Q) touch .built
context:: config.h $(HOST_BIN)
ifeq ($(CONFIG_BUILD_LOADABLE),y)
$(BIN_DIR)$(DELIM)$(PROGNAME1): $(OBJS) $(TARG1_MAINOBJ)
@echo "LD: $(PROGNAME1)"
$(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $(INSTALL_DIR)$(DELIM)$(PROGNAME1) $(ARCHCRT0OBJ) $(TARG1_MAINOBJ) $(LDLIBS)
$(Q) $(NM) -u $(INSTALL_DIR)$(DELIM)$(PROGNAME1)
install: $(BIN_DIR)$(DELIM)$(PROGNAME1)
else
install:
endif
ifeq ($(CONFIG_NSH_BUILTIN_APPS),y)
$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME1)_main.bdat: $(DEPCONFIG) Makefile
$(call REGISTER,$(APPNAME1),$(PRIORITY1),$(STACKSIZE1),$(if $(CONFIG_BUILD_LOADABLE),,$(MAINNAME1)))
ifeq ($(CONFIG_EXAMPLES_FLOWC_TARGET2),y)
$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME2)_main.bdat: $(DEPCONFIG) Makefile
$(call REGISTER,$(APPNAME2),$(PRIORITY2),$(STACKSIZE2),$(if $(CONFIG_BUILD_LOADABLE),,$(MAINNAME2)))
context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME1)_main.bdat \
$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME2)_main.bdat
else
context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME1)_main.bdat
endif
else
context:
endif
.depend: Makefile config.h $(TARG_SRCS)
@$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(TARG_SRCS) >Make.dep
@touch $@
depend: .depend
clean:
$(call DELFILE, .built)
clean::
ifneq ($(CONFIG_EXAMPLES_FLOWC_TARGET2),y)
$(call DELFILE, $(HOST_BIN))
$(call DELFILE, *.$(HOSTOBJSEXT))
endif
$(call DELFILE, *.dSYM)
$(call DELFILE, config.h)
$(call CLEAN)
distclean: clean
$(call DELFILE, Make.dep)
$(call DELFILE, .depend)
MODULE = CONFIG_EXAMPLES_FLOWC
preconfig:
-include Make.dep
include $(APPDIR)/Application.mk

View File

@ -48,7 +48,7 @@
* flowc1_main
****************************************************************************/
#if defined(CONFIG_BUILD_LOADABLE)
#if defined(BUILD_MODULE)
int main(int argc, FAR char *argv[])
#elif defined(CONFIG_EXAMPLES_FLOWC_TARGET2)
int flowc1_main(int argc, char *argv[])

View File

@ -48,7 +48,7 @@
* flowc2_main
****************************************************************************/
#if defined(CONFIG_BUILD_LOADABLE)
#if defined(BUILD_MODULE)
int main(int argc, FAR char *argv[])
#else
int flowc2_main(int argc, char *argv[])

View File

@ -4,7 +4,7 @@
#
config EXAMPLES_FSTEST
bool "Generic file system test"
tristate "Generic file system test"
default n
depends on FS_READABLE && FS_WRITABLE
---help---

View File

@ -34,6 +34,6 @@
#
############################################################################
ifeq ($(CONFIG_EXAMPLES_FSTEST),y)
ifneq ($(CONFIG_EXAMPLES_FSTEST),)
CONFIGURED_APPS += examples/fstest
endif

View File

@ -50,4 +50,6 @@ MAINSRC = fstest_main.c
CONFIG_XYZ_PROGNAME ?= fstest$(EXEEXT)
PROGNAME = $(CONFIG_XYZ_PROGNAME)
MODULE = CONFIG_EXAMPLES_FSTEST
include $(APPDIR)/Application.mk

View File

@ -4,7 +4,7 @@
#
config EXAMPLES_FT80X
bool "FT80x example"
tristate "FT80x example"
default n
depends on LCD_FT80X
select GRAPHICS_FT80X

View File

@ -34,6 +34,6 @@
#
############################################################################
ifeq ($(CONFIG_EXAMPLES_FT80X),y)
ifneq ($(CONFIG_EXAMPLES_FT80X),)
CONFIGURED_APPS += examples/ft80x
endif

View File

@ -62,4 +62,6 @@ MAINSRC = ft80x_main.c
CONFIG_EXAMPLES_FT80X_PROGNAME ?= ft80x$(EXEEXT)
PROGNAME = $(CONFIG_EXAMPLES_FT80X_PROGNAME)
MODULE = CONFIG_EXAMPLES_FT80X
include $(APPDIR)/Application.mk

View File

@ -4,7 +4,7 @@
#
config EXAMPLES_FTPC
bool "FTP client example"
tristate "FTP client example"
default n
---help---
Enable the FTP client example

Some files were not shown because too many files have changed in this diff Show More