avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Forcing rebuild in sub-makefiles ?


From: Richard Urwin
Subject: Re: [avr-gcc-list] Forcing rebuild in sub-makefiles ?
Date: Sun, 2 Jan 2005 12:13:18 +0000
User-agent: KMail/1.5.3

On Sunday 02 Jan 2005 10:30 am, Anton Erasmus wrote:
> Hi,
>
> Anobody have an ellegant solution to force the rebuild of all
> sub-makefiles if the main project makefile has been changed ?
> The main makefile calls envokes makefiles in other directories using
> $(MAKE). The main makefile defines some options (Such as MCU) that
> should result in a rebuilding of all the libraries as well. Curently
> I use make clean;make all to do this, but I have forgotten to do this
> in the past when I changed the target MCU. The problem is that code
> built for say an ATMega16 works 99% for an ATMega32, so if one
> forgets to rebuild the libraries for the new MCU, one can end up with
> very strange errors.

The way automake (?) does that is to build a config.h file that all the 
subdirectories depend on.:

export CONFIG_H=config.h

config.h: Makefile
 echo "#define mmcu $mmcu" > config.h
 echo ... >> config.h
 ...

You can then make the libraries with a dependency on $(CONFIG_H). If you 
ever build the libraries stand-alone, then you just have to provide a 
value for $(CONFIG_H) on the command line, or put a default value in 
the library makefile:

 CONFIG_H ?= standalone_config.h

You could have a target for standalone_config.h that either created a 
default file, or just reported an error:

standalone_config.h:
 echo "standalone_config.h must exist, or $CONFIG_H must be defined."
 cat standalone_config.h; # Cause make to fail

-- 
Richard Urwin


reply via email to

[Prev in Thread] Current Thread [Next in Thread]