I cam across the following command in a makefile:
%-nosyms.$(TARGET).elf: %.co $(PROJECT_OBJECTFILES) $(INTERRUPT_OBJECTFILES) contiki-$(TARGET).a
$(CC) $(CFLAGS) -o $@ $(filter-out %.a,$^) $(filter %.a,$^) $(filter %.a,$^) $(LDFLAGS)
Source: Contiki/cpu/arm/stm32f103/Makefile.stm32f103 .
Does this command generate no-symbols-control-file? What is the use of a no symbol image file?
Piece by piece analysis:
The Makefile's target is:
%-nosyms.$(TARGET).elf
The list of prerequisites is:
%.co $(PROJECT_OBJECTFILES) $(INTERRUPT_OBJECTFILES) contiki-$(TARGET).a
The target recipe is:
Makefile's logic is:
If
*-nosyms.$(TARGET).elf
file exists, compare the file's timestamp to that of all its pre-requisites. Rebuild this file (i.e., run the given recipe) if any of the pre-requisites is newer. If the target is marked as.PHONY
) (seems not to be the case), rebuild without checking the timestamp.Else, go to each prerequisite recipe and execute one by one (or in parallel if
-j
option provided tomake
):%.co
$(PROJECT_OBJECTFILES)
$(INTERRUPT_OBJECTFILES)
contiki-$(TARGET).a
Then, handle the recipe for the current target, by calling:
$(CC) $(CFLAGS) -o $@ $(filter-out %.a,$^) $(filter %.a,$^) $(filter %.a,$^) $(LDFLAGS)
Where:
$@
: the name of the current target (i.e.*-nosyms.$(TARGET).elf
)$^
: The list of prerequisites (i.e.%.co $(PROJECT_OBJECTFILES) $(INTERRUPT_OBJECTFILES) contiki-$(TARGET).a
)$(filter-out %.a,$^)
: the non-*.a
files from the prerequisite list.$(filter %.a,$^)
: the*.a
files from the prerequisite list.