mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-05 06:11:36 +08:00
The ELF loader is basically functional (needs more testing)
git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5265 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user