This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

GNU Make + C166

Good day!

Can I get from C166/EC166 compilers information about all nested includes such as -M, -MM, -MD, -MMD keys for GCC compiler?

If not, I can only use make for rebuild target?

  • Correction:
    CONVERPATH does \ to / should be
    / to \
    I use / everywhere in GNU make.

    Older Keil tools and some Win32 commands, didn't handle backslashes very well (??). Not the most beautiful solution, I agree, but it worked.

  • Older Keil tools and some Win32 commands, didn't handle backslashes very well (??).
    

    -> forward slashes *sigh* :-)

  • Welcome. Let me know the results :-)

  • Hi Joost!

    Please explain me following strings:

    ...
    $(OUTPUTDIR)/%.o : $(SOURCEDIR/%.c
      $(ECHO) "Compiling  $< to"
      $(ECHO) "           $@"
    
      $(ECHO) "$(call CONVERTPATH,$<)"  > $(CMD_FILE)
    ...
    

    What is $(call CONVERTPATH,$<)?
    CONVERTPATH is var or macros? Has it declaried earlier?
    I don't have experience in "make" & don't use call function... :)

    I try to make this...

    SOURCEDIR = G:\##\Projects\Infineon XC167\ip++3
    OUTPUTDIR = $(SOURCEDIR)
    
    $(OUTPUTDIR)/%.o: $(SOURCEDIR)/%.cpp
            $(ECHO) "$(call CONVERTPATH,$<)" > c.txt
    

    It not works. (Error 127)

  • See my earlier posts where I explained what CONVERTPATH does. But you're right, I didn't mention that it's not a built-in GNU make macro. I defined it myself because of some complaining tools. Definition:

    # NOTE: do -not- use := to define a function; deferred expansion is needed.
    
    #
    # Function to convert forward slashes to backslashes
    #
    CONVERTPATH        =        $(subst /,\,$(strip $(1)))
    

    Maybe you don't need CONVERTPATH at all. Try removing it. Even MS-DOS <3.x is supposed to support forward slashes but I still experienced problems with some tools. We changed some tools/versions in the meantime so maybe we don't need it anymore, haven't checked. 2008 and still messing with forward/backslashes :-/ Or should I say :-\ :-)

    But do be careful with spaces in paths/filenames and add quotes where necessary.

    I also suggest to only use forward or backslashes in your makefiles and don't mix them. I use forward slashes myself. Check your SOURCEDIR for example.

    In your example, add an initial rule, for example (pseude code):

    
    all: APPLICATION
    
    APPLICATION: APP.abs
    
    APP.abs : main.o fubar.o
        <L166 objects>
    
    $(OUTPUTDIR)/%.o: $(SOURCEDIR)/%.cpp
        <(E)C166 source files>
    
    etc...
    

    Check GNU make manual for more info on $(call <macro>).

    Oh, and $(ECHO) is a macro containing the Unix version of echo, not the Win32/CMD.exe built-in.

    # cmd.exe's internal echo command is awful, using a better one.
    # Option -E = disable special (escaped) characters in strings (i.e. \t = tab)
    #
    # The executable was renamed to echo2.exe to prevent the internal cmd.exe
    # echo command from being used in case of typos.
    
    ECHO_PLAIN    :=    $(PROJECT.TOOLSDIR)\unxutils\echo2 -E
    ECHO          :=    $(QUIET)$(ECHO_PLAIN)
    

    Good luck!
    J

  • ECHO := $(QUIET)$(ECHO_PLAIN)

    What is QUIET? @?
    I attempt to use without any "QUIET" and have following trouble:
    echo2 (unix) doesn't print anything to file, but file creates and empty strings adds. (only from make!!)
    from cmd echo2 works good without any troubles, why?

    this echo2 string good works from cmd, but not works from make:

    [TAB]echo2 "any text" >> 1.dat
    


    -E key don't care.

  • What is QUIET? @?

    Yep. This way you can set/unset the QUIET macro in one place to do some debugging.

    Works in cmd.exe but not in GNU make...? That's weird.

    .PHONY: all
    all:
    [TAB]echo2 "this is a test" >> 1.dat
    

    W:\>gmake -f test.mk
    echo2 "this is a test" >> 1.dat W:\>cat 1.dat
    this is a test W:\>gmake -v
    GNU Make 3.81
    Copyright (C) 2006 Free Software Foundation, Inc.
    This is free software; see the source for copying
    conditions.
    There is NO warranty; not even for MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE. This program built for Windows32 (HAVE_CASE_INSENSITIVE_FS) W:\> _

    Working fine here. GNU make 3.81 .