Update make dependency for elf/module/nxflat/posix_spawn/sotest/thttpd

Update make dependency for elf/module/nxflat/posix_spawn/sotest/thttpd examples which make use of
mksymtab.sh. This could avoid them built twice in 'make depend' and 'make all' which would result
in file truncated build break. Now only build once by 'make all'.

Change-Id: I5d8f1ebbf73e3b12d7d2118f1f51b4233d0ed007
Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
This commit is contained in:
liuhaitao
2020-05-14 11:32:35 +08:00
committed by Xiang Xiao
parent ba3baa57a5
commit 0c60624276
30 changed files with 201 additions and 134 deletions

View File

@@ -44,21 +44,27 @@ MODULE = $(CONFIG_EXAMPLES_MODULE)
# Module Example
MAINSRC = module_main.c
ifeq ($(CONFIG_BUILD_FLAT),y)
CSRCS += mod_symtab.c
ifeq ($(CONFIG_EXAMPLES_MODULE_ROMFS),y)
CSRCS = romfs.c
endif
ifeq ($(CONFIG_EXAMPLES_MODULE_CROMFS),y)
CSRCS = cromfs.c
endif
CSRCS += mod_symtab.c
MAINSRC = module_main.c
VPATH += drivers
ROOTDEPPATH += --dep-path drivers
# Build targets
module_main.c: build
ifeq ($(CONFIG_BUILD_FLAT),y)
drivers/mod_symtab.c: build
ifeq ($(CONFIG_EXAMPLES_MODULE_ROMFS),y)
drivers/romfs.c: build
endif
ifeq ($(CONFIG_EXAMPLES_MODULE_CROMFS),y)
drivers/cromfs.c: build
endif
drivers/mod_symtab.c: build
.PHONY: build
build:

View File

@@ -1,5 +1,5 @@
/fsroot
/romfs.h
/cromfs.h
/romfs.c
/cromfs.c
/romfs.img
/mod_symtab.c

View File

@@ -51,13 +51,13 @@ endif
ifeq ($(CONFIG_EXAMPLES_MODULE_BUILTINFS),y)
ifeq ($(CONFIG_EXAMPLES_MODULE_ROMFS),y)
ROMFS_IMG = $(DRIVER_DIR)/romfs.img
FSIMG_HDR = $(DRIVER_DIR)/romfs.h
FSIMG_SRC = $(DRIVER_DIR)/romfs.c
else ifeq ($(CONFIG_EXAMPLES_MODULE_CROMFS),y)
NXTOOLDIR = $(TOPDIR)/tools
GENCROMFSSRC = gencromfs.c
GENCROMFSEXE = gencromfs$(EXEEXT)
FSIMG_HDR = $(DRIVER_DIR)/cromfs.h
FSIMG_SRC = $(DRIVER_DIR)/cromfs.c
endif
endif
@@ -66,7 +66,7 @@ $(1)_$(2):
+$(Q) $(MAKE) -C $(1) $(2) TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" FSROOT_DIR="$(FSROOT_DIR)" CROSSDEV=$(CROSSDEV)
endef
all: $(FSIMG_HDR) $(SYMTAB_SRC) $(PASS1_SYMTAB)
all: $(FSIMG_SRC) $(SYMTAB_SRC) $(PASS1_SYMTAB)
.PHONY: all clean install
$(foreach DIR, $(ALL_SUBDIRS), $(eval $(call DIR_template,$(DIR),clean)))
@@ -84,10 +84,10 @@ $(ROMFS_IMG): install
$(Q) genromfs -f $@.tmp -d $(FSROOT_DIR) -V "MODULETEST"
$(Q) $(call TESTANDREPLACEFILE, $@.tmp, $@)
# Create the romfs.h header file from the romfs.img file
# Create the romfs.c file from the romfs.img file
$(FSIMG_HDR): $(ROMFS_IMG)
$(Q) (cd $(DRIVER_DIR); xxd -i romfs.img | sed -e "s/^unsigned/static const unsigned/g" >$@)
$(FSIMG_SRC): $(ROMFS_IMG)
$(Q) (cd $(DRIVER_DIR); xxd -i romfs.img | sed -e "s/^unsigned/const unsigned/g" >$@)
else ifeq ($(CONFIG_EXAMPLES_MODULE_CROMFS),y)
# Make sure that the NuttX gencromfs tool has been built
@@ -95,9 +95,9 @@ else ifeq ($(CONFIG_EXAMPLES_MODULE_CROMFS),y)
$(NXTOOLDIR)/$(GENCROMFSEXE): $(NXTOOLDIR)/$(GENCROMFSSRC)
$(Q) $(MAKE) -C $(NXTOOLDIR) -f Makefile.host $(GENCROMFSEXE)
# Create the cromfs.h header file from the populated cromfs directory
# Create the cromfs.c file from the populated cromfs directory
$(FSIMG_HDR): install $(NXTOOLDIR)/$(GENCROMFSEXE)
$(FSIMG_SRC): install $(NXTOOLDIR)/$(GENCROMFSEXE)
$(Q) $(NXTOOLDIR)/$(GENCROMFSEXE) $(FSIMG_DIR) $@.tmp
$(Q) $(call TESTANDREPLACEFILE, $@.tmp, $@)
@@ -120,5 +120,5 @@ endif
# Clean each subdirectory
clean: $(foreach DIR, $(ALL_SUBDIRS), $(DIR)_clean)
$(Q) rm -f $(FSIMG_HDR) $(ROMFS_IMG) $(SYMTAB_SRC)
$(Q) rm -f $(FSIMG_SRC) $(ROMFS_IMG) $(SYMTAB_SRC)
$(Q) rm -rf $(FSROOT_DIR)

View File

@@ -59,9 +59,6 @@
#if defined(CONFIG_EXAMPLES_MODULE_ROMFS)
# include <nuttx/drivers/ramdisk.h>
# include "drivers/romfs.h"
#elif defined(CONFIG_EXAMPLES_MODULE_CROMFS)
# include "drivers/cromfs.h"
#endif
/****************************************************************************
@@ -131,6 +128,11 @@ static const char g_write_string[] = "Hi there, installed driver\n";
* Symbols from Auto-Generated Code
****************************************************************************/
#if defined(CONFIG_EXAMPLES_MODULE_ROMFS) || defined(CONFIG_EXAMPLES_MODULE_CROMFS)
extern const unsigned char romfs_img[];
extern const unsigned int romfs_img_len;
#endif
#ifdef CONFIG_BUILD_FLAT
extern const struct symtab_s g_mod_exports[];
extern const int g_mod_nexports;