summaryrefslogtreecommitdiff
path: root/apps/examples/elf/tests/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'apps/examples/elf/tests/Makefile')
-rw-r--r--apps/examples/elf/tests/Makefile46
1 files changed, 32 insertions, 14 deletions
diff --git a/apps/examples/elf/tests/Makefile b/apps/examples/elf/tests/Makefile
index c4a0eec4c..f834f6c78 100644
--- a/apps/examples/elf/tests/Makefile
+++ b/apps/examples/elf/tests/Makefile
@@ -34,35 +34,53 @@
############################################################################
# Most of these do no build yet
-SUBDIRS = errno hello hello++ longjmp mutex pthread signal task struct
+
+ALL_SUBDIRS = errno hello hello++ longjmp mutex pthread signal task struct
+BUILD_SUBDIRS = errno hello task struct
+
+ifeq ($(CONFIG_HAVE_CXX),y)
+BUILD_SUBDIRS += hello++
+endif
+
+ifeq ($(CONFIG_EXAMPLES_ELF_LONGJMP),y)
+BUILD_SUBDIRS += longjmp
+endif
+
+ifneq ($(CONFIG_DISABLE_PTHREAD),y)
+BUILD_SUBDIRS += mutex pthread
+endif
+
+ifneq ($(CONFIG_DISABLE_SIGNALS),y)
+BUILD_SUBDIRS += signal
+endif
ELF_DIR = $(APPDIR)/examples/elf
TESTS_DIR = $(ELF_DIR)/tests
ROMFS_DIR = $(TESTS_DIR)/romfs
ROMFS_IMG = $(TESTS_DIR)/romfs.img
ROMFS_HDR = $(TESTS_DIR)/romfs.h
-ROMFS_DIRLIST = $(TESTS_DIR)/dirlist.h
-SYMTAB = $(TESTS_DIR)/symtab.h
+DIRLIST_HDR = $(TESTS_DIR)/dirlist.h
+SYMTAB_SRC = $(TESTS_DIR)/symtab.c
define DIR_template
$(1)_$(2):
@$(MAKE) -C $(1) $(3) TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" ROMFS_DIR="$(ROMFS_DIR)" CROSSDEV=$(CROSSDEV)
endef
-all: $(ROMFS_HDR) $(ROMFS_DIRLIST) $(SYMTAB)
+all: $(ROMFS_HDR) $(DIRLIST_HDR) $(SYMTAB_SRC)
.PHONY: all build clean install populate
-$(foreach DIR, $(SUBDIRS), $(eval $(call DIR_template,$(DIR),build, all)))
-$(foreach DIR, $(SUBDIRS), $(eval $(call DIR_template,$(DIR),clean,clean)))
-$(foreach DIR, $(SUBDIRS), $(eval $(call DIR_template,$(DIR),install,install)))
+$(foreach DIR, $(BUILD_SUBDIRS), $(eval $(call DIR_template,$(DIR),build, all)))
+$(foreach DIR, $(ALL_SUBDIRS), $(eval $(call DIR_template,$(DIR),clean,clean)))
+$(foreach DIR, $(BUILD_SUBDIRS), $(eval $(call DIR_template,$(DIR),install,install)))
# Build program(s) in each sud-directory
-build: $(foreach DIR, $(SUBDIRS), $(DIR)_build)
+build: $(foreach DIR, $(BUILD_SUBDIRS), $(DIR)_build)
# Install each program in the romfs directory
-install: $(foreach DIR, $(SUBDIRS), $(DIR)_install)
+install: $(foreach DIR, $(BUILD_SUBDIRS), $(DIR)_install)
# Create the romfs directory
@@ -85,16 +103,16 @@ $(ROMFS_HDR) : $(ROMFS_IMG)
# Create the dirlist.h header file from the romfs directory
-$(ROMFS_DIRLIST) : populate
+$(DIRLIST_HDR) : populate
@$(TESTS_DIR)/mkdirlist.sh $(ROMFS_DIR) >$@
# Create the exported symbol table list from the derived *-thunk.S files
-$(SYMTAB): build
- @$(TESTS_DIR)/mksymtab.sh $(TESTS_DIR) >$@
+$(SYMTAB_SRC): build
+ @$(TESTS_DIR)/mksymtab.sh -t varlist.tmp $(ROMFS_DIR) >$@
# Clean each subdirectory
-clean: $(foreach DIR, $(SUBDIRS), $(DIR)_clean)
- @rm -f $(ROMFS_HDR) $(ROMFS_IMG) $(SYMTAB)
+clean: $(foreach DIR, $(ALL_SUBDIRS), $(DIR)_clean)
+ @rm -f $(ROMFS_HDR) $(ROMFS_IMG) $(SYMTAB_SRC) varlist.tmp
@rm -rf $(ROMFS_DIR)