Thread: How to Modify Makefile to Build a Map File

  1. #1
    Registered User
    Join Date
    Nov 2011
    Posts
    1

    How to Modify Makefile to Build a Map File

    Hi all,
    I have a C makefile that I would like to modify such that it produces a mapfile in addition to the regular exe and bin files. I've been googling around but it's still not 100% clear on where and the exact syntax to use. If anyone can look at this Makefile (attached) and suggest what to try, that would be great.

    Thanks!
    Will
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,907
    The meat and potatoes of the build process is right here:
    Code:
    # rule to build executable
    $(EXEC): $(COBJ) $(SOBJ) $(LDSCRIPT)
            @echo $@
            @..\BuildTools\buildver.bat >$(dir $(EXEC))version.c
            @$(CC) $(RTOSPORT) $(CFLAGS) $(subst +,$(SPACE),$(INCLUDES:%=-I%)) \
                    $(dir $(EXEC))version.c $(CCOUT)$(dir $(EXEC))version.$(OBJEXT)
            @$(LD) $(LDFLAGS) $(LDOUT)$(EXEC) $(SOBJ) $(COBJ) $(dir $(EXEC))version.$(OBJEXT) $(LDFLAGS2)
    There isn't some magic makefile command to produce a map file. It will depend on what compiler you're using, for which you should be able to find the documentation on how to generate map files. All I can tell you is that you probably need to add a line like this somewhere in the snippet above:
    Code:
            @command_to_produce_map_file $(INPUT_FILES_FOR_MAP)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. modify txt file in C
    By byteM in forum C Programming
    Replies: 1
    Last Post: 12-11-2007, 01:12 PM
  2. how can i modify a text in a file
    By Marth in forum C Programming
    Replies: 6
    Last Post: 05-05-2005, 05:08 AM
  3. Retreiving File create/modify date
    By super_stripey in forum C++ Programming
    Replies: 3
    Last Post: 09-21-2004, 07:34 AM
  4. how to delete or modify a record in a file?
    By danielhf in forum C++ Programming
    Replies: 2
    Last Post: 09-22-2003, 09:18 AM
  5. How to modify file open/save dialog?
    By _Elixia_ in forum Windows Programming
    Replies: 3
    Last Post: 07-05-2003, 11:41 AM

Tags for this Thread