[En-Nut-Discussion] Readability modification to Makefiles

Ulrich Prinz uprinz2 at netscape.net
Mon Mar 21 22:34:38 CET 2011


I use plain windows dos box for running the makefiles. So I don't have a
BASH too. But I made this modifications to other code I compile under
linux and it works there too using the same actual version of make that
is delivered by the cross-binutils from WinAVR, Yagarto and cygwin.

Shouldn't make any problem though.

Best regards
Ulrich

Am 21.03.2011 22:03, schrieb Nathan Moore:
>>> What does the trick is the following:
>> ...
>>> %.hex: %.elf
>>>       @echo "  [HEX] $@"
>>>       @$(BIN) $(BINFLAGS) -O ihex $<  $@
>>
>> Putting this on every command line has a disadvantage. Sometimes I need
>> to inspect the command for 2 reasons:
>>
>> 1. I want to copy the command to use it "offline" (without calling make).
>> 2. Users often report problems, where the command output of make would
>> show me, what's wrong.
>>
>> If I want that output, there would be too many lines in too many files
>> to be changed.
>>
>>
> I'm not on a machine with make or BASH installed so I can't test this
> (and probably have some syntax
> wrong), but what about something like:
> 
> %.elf: $(OBJS)
>        CMD=$(CC) $(OBJS) $(LDFLAGS) -Wl,--start-group $(LIBS)
> $(ADDLIBS) -Wl,--end-group -o $@
>        if `OUTPUT=$CMD 2&>1`; then
>            echo $CMD
>            echo $OUTPUT
>       else
>           # you can do an abbreviated output here
>       fi
> 
> 
> Nathan
> _______________________________________________
> http://lists.egnite.de/mailman/listinfo/en-nut-discussion


More information about the En-Nut-Discussion mailing list