[En-Nut-Discussion] Allow to specify dependancies

Harald Kipp harald.kipp at egnite.de
Tue Jul 3 14:34:49 CEST 2012

Hi Uwe,

I'm not sure whether it is a good idea to respond to this without investing much more time to look into the details. True to the open source motto "release early, release often", I'll add my 2 cents.

On 03.07.2012 13:13, Uwe Bonnes wrote:
> I just checked in to SVN a patch for tools/nutconf/src/nutcomponent.c and
> tools/qnutconf/src/nutcomponent.c to allow to specify dependancies. The CM3
> NXP and STM32 drivers make often use of a device-instance specific setup file
> that includes a instance-independant device driver. Changing the

Although I introduced this in the AVR UART driver, in general I do not like to include C source files. Main reason is, that automatic tools are not prepared for such constructions. Even some debuggers may struggle with it.

Anyway, in opposite to large software packages, which are configured at runtime, Nut/OS tries to implement configurations at compile time to exclude as much unused code as possible. To achieve this without too much duplicate source code, including C files is sometimes the easiest solution.

The intention of all my babble: Including C files is legal, but should be avoided.

> instance-independant device driver and recompiling the library has no
> effect, as make doesn't know about this inclusion. So now in the .nut file
> one can specify these dependancies like
>       sources = { "cm3/dev/stm/ih_stm32_exti9_5.c" },
>       depends = { "cm3/dev/stm/ih_stm32_exti.c" },
> which will result in the Makefile in a line
> cm3/dev/stm/ih_stm32_exti9_5.o: cm3/dev/stm/ih_stm32_exti.c

What I did not get: Where is the difference between including C-files and header files. If I change a header file, nothing will be rebuild as well, because the compiler doesn't know any dependencies, neither .c nor .h. Did I miss something?

Also note, that the GNU preprocessor is able to create dependency files. Makerules.gcc already contains

%.dep: %.c
 $(CC) -MM $(CPPFLAGS) $(CFLAGS) -o $@ $<

No idea, whether this is used anywhere. Still, I'd prefer a compiler-independent solution, but do not see how to economically add tons of header files.

Right now 'make clean all' is required.



More information about the En-Nut-Discussion mailing list