Fix command registration for modules. 'rgbled test' works now.

This commit is contained in:
px4dev
2013-04-06 10:20:03 -07:00
parent dc11bcfb42
commit aa369dfef1
+9 -5
View File
@@ -298,10 +298,12 @@ endif
# #
BUILTIN_CSRC = $(WORK_DIR)builtin_commands.c BUILTIN_CSRC = $(WORK_DIR)builtin_commands.c
# add command definitions from modules # command definitions from modules (may be empty at Makefile parsing time...)
BUILTIN_COMMAND_FILES := $(wildcard $(WORK_DIR)builtin_commands/COMMAND.*) MODULE_COMMANDS = $(subst COMMAND.,,$(notdir $(wildcard $(WORK_DIR)builtin_commands/COMMAND.*)))
BUILTIN_COMMANDS += $(subst COMMAND.,,$(notdir $(BUILTIN_COMMAND_FILES)))
# We must have at least one pre-defined builtin command in order to generate
# any of this.
#
ifneq ($(BUILTIN_COMMANDS),) ifneq ($(BUILTIN_COMMANDS),)
# (BUILTIN_PROTO,<cmdspec>,<outputfile>) # (BUILTIN_PROTO,<cmdspec>,<outputfile>)
@@ -315,17 +317,19 @@ define BUILTIN_DEF
endef endef
# Don't generate until modules have updated their command files # Don't generate until modules have updated their command files
$(BUILTIN_CSRC): $(GLOBAL_DEPS) $(BUILTIN_COMMAND_FILES) $(BUILTIN_CSRC): $(GLOBAL_DEPS) $(MODULE_OBJS) $(BUILTIN_COMMAND_FILES)
@$(ECHO) %% generating $@ @$(ECHO) %% generating $@
$(Q) $(ECHO) '/* builtin command list - automatically generated, do not edit */' > $@ $(Q) $(ECHO) '/* builtin command list - automatically generated, do not edit */' > $@
$(Q) $(ECHO) '#include <nuttx/config.h>' >> $@ $(Q) $(ECHO) '#include <nuttx/config.h>' >> $@
$(Q) $(ECHO) '#include <nuttx/binfmt/builtin.h>' >> $@ $(Q) $(ECHO) '#include <nuttx/binfmt/builtin.h>' >> $@
$(Q) $(foreach spec,$(BUILTIN_COMMANDS),$(call BUILTIN_PROTO,$(subst ., ,$(spec)),$@)) $(Q) $(foreach spec,$(BUILTIN_COMMANDS),$(call BUILTIN_PROTO,$(subst ., ,$(spec)),$@))
$(Q) $(foreach spec,$(MODULE_COMMANDS),$(call BUILTIN_PROTO,$(subst ., ,$(spec)),$@))
$(Q) $(ECHO) 'const struct builtin_s g_builtins[] = {' >> $@ $(Q) $(ECHO) 'const struct builtin_s g_builtins[] = {' >> $@
$(Q) $(foreach spec,$(BUILTIN_COMMANDS),$(call BUILTIN_DEF,$(subst ., ,$(spec)),$@)) $(Q) $(foreach spec,$(BUILTIN_COMMANDS),$(call BUILTIN_DEF,$(subst ., ,$(spec)),$@))
$(Q) $(foreach spec,$(MODULE_COMMANDS),$(call BUILTIN_DEF,$(subst ., ,$(spec)),$@))
$(Q) $(ECHO) ' {NULL, 0, 0, NULL}' >> $@ $(Q) $(ECHO) ' {NULL, 0, 0, NULL}' >> $@
$(Q) $(ECHO) '};' >> $@ $(Q) $(ECHO) '};' >> $@
$(Q) $(ECHO) 'const int g_builtin_count = $(words $(BUILTIN_COMMANDS));' >> $@ $(Q) $(ECHO) 'const int g_builtin_count = $(words $(BUILTIN_COMMANDS) $(MODULE_COMMANDS));' >> $@
SRCS += $(BUILTIN_CSRC) SRCS += $(BUILTIN_CSRC)