[En-Nut-Discussion] Make hides compiler command lines

Harald Kipp harald.kipp at egnite.de
Wed Jul 4 09:56:18 CEST 2012


Hi Ulrich,

On 03.07.2012 22:36, Ulrich Prinz wrote:
 
> the intention of that hiding was simple: Overview.
...
> The silencing was only a side effect of finding all the points where a 
> new compiler has to be added in the Makefiles. I remember that I 
> collected all the tools in one file and defined them there.
> I replaced all bla-blub-gcc by $(GCC) and all rm by $(RM), bla-blub-ld 
> by $(LD) and so on.
> 
> So silencing was only a simple thing
> GCC=$(CROSS_COMPILE)gcc
> is printing every call and a @ in front
> GCC=@$(CROSS_COMPILE)gcc
> avoids that printing something.

But unfortunately it is not done that way. Instead we have

Makerules.gcc:  @$(CC) -MM $(CPPFLAGS) $(CFLAGS) -o $@ $<
Makerules.gcc:  @$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
Makerules.gcc:  @$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -o $@ $<
Makerules.gcc:  @$(AS) -c $(CPPFLAGS) $(ASFLAGS) -o $@ $<
Makerules.gcc:  @$(AR) $(ARFLAGS) $@ $?

plus

Makerules.all:  @-rm -f $(SRCS:.c=.bak)
Makerules.all:  @-rm -f $(SRCS:.c=.c~)
Makevars.all:CP = @cp
Makevars.gcc:AR     = @$(TRGT)ar
Makevars.gcc:CP     = @cp
Makevars.gcc:RM     = @rm -f

Still no big deal to change them, but I have to do this after each checkout.


> The way to suppress the messages by compiling inside (q)nutconf was not 
> an option as the 16 nut/os based projects part of one big project and 
> are build from scripts (including the option to build the all at once)

How about using

 make >NUL

in your script? Btw. if using scripts, you can do more. The Lua script that builds the Windows distribution, collects all errors with some additional information in a special log. As an example (trying to build the current trunk):

------------------------------------------------------------------------
Target : lisa-cm3-gccdbg-app
Command: SET PATH=e:\ethernut\nut-trunk\nut\tools\win32;%ProgramFiles(x86)%\yagarto\bin;e:\apps\bin;%SystemRoot%\system32;%SystemRoo
t%;%SystemRoot%\System32\Wbem;&make clean all install
Error  : 2
------------------------------------------------------------------------
"  [CC] caltime.c"
caltime.c: In function 'main':
caltime.c:406:5: warning: implicit declaration of function 'NutRegisterRtc' [-Wimplicit-function-declaration]
caltime.c:406:25: error: 'rtcLpc17xx' undeclared (first use in this function)
caltime.c:406:25: note: each undeclared identifier is reported only once for each function it appears in
caltime.c:411:9: warning: implicit declaration of function 'NutRtcGetStatus' [-Wimplicit-function-declaration]
caltime.c:412:24: error: 'RTC_STATUS_PF' undeclared (first use in this function)
make[1]: *** [caltime.o] Error 1
make[1]: Leaving directory `E:/ethernut/ethernut-5.0.5/lisa-cm3-gccdbg-app/caltime'
make: *** [all] Error 2


------------------------------------------------------------------------
Target : mbed_npx_lpc1768-cm3-gcc-app
Command: SET PATH=e:\ethernut\nut-trunk\nut\tools\win32;%ProgramFiles(x86)%\yagarto\bin;e:\apps\bin;%SystemRoot%\system32;%SystemRoo
t%;%SystemRoot%\System32\Wbem;&make clean all install
Error  : 2
------------------------------------------------------------------------
make[1]: Leaving directory `E:/ethernut/ethernut-5.0.5/mbed_npx_lpc1768-cm3-gcc-app/uart'
make -C caltime
make[1]: Entering directory `E:/ethernut/ethernut-5.0.5/mbed_npx_lpc1768-cm3-gcc-app/caltime'
"  [CC] caltime.c"
caltime.c: In function 'main':
caltime.c:379:24: error: 'devUart0' undeclared (first use in this function)
caltime.c:379:24: note: each undeclared identifier is reported only once for each function it appears in
make[1]: *** [caltime.o] Error 1
make[1]: Leaving directory `E:/ethernut/ethernut-5.0.5/mbed_npx_lpc1768-cm3-gcc-app/caltime'
make: *** [all] Error 2


------------------------------------------------------------------------
Target : mbed_npx_lpc1768-cm3-gccdbg-app
Command: SET PATH=e:\ethernut\nut-trunk\nut\tools\win32;%ProgramFiles(x86)%\yagarto\bin;e:\apps\bin;%SystemRoot%\system32;%SystemRoo
t%;%SystemRoot%\System32\Wbem;&make clean all install
Error  : 2
------------------------------------------------------------------------
make[1]: Leaving directory `E:/ethernut/ethernut-5.0.5/mbed_npx_lpc1768-cm3-gccdbg-app/uart'
make -C caltime
make[1]: Entering directory `E:/ethernut/ethernut-5.0.5/mbed_npx_lpc1768-cm3-gccdbg-app/caltime'
"  [CC] caltime.c"
caltime.c: In function 'main':
caltime.c:379:24: error: 'devUart0' undeclared (first use in this function)
caltime.c:379:24: note: each undeclared identifier is reported only once for each function it appears in
make[1]: *** [caltime.o] Error 1
make[1]: Leaving directory `E:/ethernut/ethernut-5.0.5/mbed_npx_lpc1768-cm3-gccdbg-app/caltime'
make: *** [all] Error 2

This gives a nice overview about all unsolved problems. Of course you could do something similar with DOS batch files or shell scripts.

As a side effect of the "@" silencing, this script also does no longer list the command line, which sometimes contained valuable informations, specifically when adding new devices.


> Btw. I added "make burn" as a second 'programming' target. It simply 
> programs without recompiling anything, what is helpful if you just need 
> to test your things on a series of targets.

Do you remember, where you needed to add this? Just curious, because I'm using "make burn" (without recompiling) for years.

Regards,

Harald



More information about the En-Nut-Discussion mailing list