I am working on a makefile problem where I need to auto-generate a .map file with my makefile.
A repository of the code I am working on can be found here https://github.com/smake5730/makefile_map
I have tried adding in the line
LDFLAGS = -Wl,-Map,multifile-program-distributed.map
%.o: %.c
.SECONDEXPANSION:
%.o: $$(call sourcefile,$$@) %.d | $$(@D)
$(Q)$(CC) $(LDFLAGS) $(CFLAGS) $(DEPFLAGS) -c $< -o $@
as I believe the gcc linker, i.e. ld, requires this, and then the name multifile-program-distributed.map is set to the main target name of the whole makefile. When I do the make command I get no .map output anywhere.
I can generate a .map file using navigating to the BUILD_RESULTS folder and then using the command line command, such as found in https://interrupt.memfault.com/blog/get-the-most-out-of-the-linker-map-file .
Can anyone help me in working out what code I need for the makefile to automatically generate this .map file in the build_results folder?
Regards,