xuxin930 commented on code in PR #1979: URL: https://github.com/apache/nuttx-apps/pull/1979#discussion_r1304229569
########## Application.mk: ########## @@ -93,6 +93,32 @@ ifneq ($(BUILD_MODULE),y) OBJS += $(MAINCOBJ) $(MAINCXXOBJ) $(MAINRUSTOBJ) $(MAINZIGOBJ) endif +ifneq ($(PROGNAME),) + PROGOBJ := $(MAINCOBJ) $(MAINCXXOBJ) $(MAINRUSTOBJ) + ifneq ($(words $(PROGOBJ)), $(words $(PROGNAME))) + $(warning "program names $(PROGNAME) does not match mainsrcs $(PROGOBJ)") + endif + PROGLIST := $(addprefix $(BINDIR)$(DELIM),$(PROGNAME)) + REGLIST := $(addprefix $(BUILTIN_REGISTRY)$(DELIM),$(addsuffix .bdat,$(PROGNAME))) + + NLIST := $(shell seq 1 $(words $(PROGNAME))) + $(foreach i, $(NLIST), \ + $(eval PROGNAME_$(word $i,$(PROGOBJ)) := $(word $i,$(PROGNAME))) \ + $(eval PROGOBJ_$(word $i,$(PROGLIST)) := $(word $i,$(PROGOBJ))) \ + $(eval PROGNAME_$(word $i,$(REGLIST)) := $(word $i,$(PROGNAME))) \ Review Comment: > why add the additional intent here Removed ✅ this is for different keys. one for MAINOBJS, and the other for REGLIST. however, i found that REGLIST itself is transformed form PROGNAME. so I did it directly using `$(basename $(notdir $REGLIST)))`. ########## Application.mk: ########## @@ -93,6 +93,32 @@ ifneq ($(BUILD_MODULE),y) OBJS += $(MAINCOBJ) $(MAINCXXOBJ) $(MAINRUSTOBJ) $(MAINZIGOBJ) endif +ifneq ($(PROGNAME),) + PROGOBJ := $(MAINCOBJ) $(MAINCXXOBJ) $(MAINRUSTOBJ) + ifneq ($(words $(PROGOBJ)), $(words $(PROGNAME))) + $(warning "program names $(PROGNAME) does not match mainsrcs $(PROGOBJ)") + endif + PROGLIST := $(addprefix $(BINDIR)$(DELIM),$(PROGNAME)) + REGLIST := $(addprefix $(BUILTIN_REGISTRY)$(DELIM),$(addsuffix .bdat,$(PROGNAME))) + + NLIST := $(shell seq 1 $(words $(PROGNAME))) + $(foreach i, $(NLIST), \ + $(eval PROGNAME_$(word $i,$(PROGOBJ)) := $(word $i,$(PROGNAME))) \ + $(eval PROGOBJ_$(word $i,$(PROGLIST)) := $(word $i,$(PROGOBJ))) \ + $(eval PROGNAME_$(word $i,$(REGLIST)) := $(word $i,$(PROGNAME))) \ Review Comment: > why add the additional intent here Removed ✅ this is for different keys. one for MAINOBJS, and the other for REGLIST. however, i found that REGLIST itself is transformed form PROGNAME. so I did it directly using `$(basename $(notdir $REGLIST)))`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
