From: Wolfgang Denk Date: Tue, 18 Dec 2007 09:53:26 +0100 Subject: [U-Boot-Users] [PATCH 1/2] [BUILD] Generate include/autoconf.mk from board config files In-Reply-To: Your message of "Tue, 20 Nov 2007 22:51:07 MST." <20071121055107.19848.96219.stgit@trillian.cg.shawcable.net> Message-ID: <20071218085326.75E1E24064@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de In message <20071121055107.19848.96219.stgit@trillian.cg.shawcable.net> you wrote: > > Use cpp and sed to postprocess config.h and import the defined values > into include/autoconf.mk. autoconf.mk is then included by config.mk to > give 'make' access to the board configuration. > > Doing this enables conditional compilation at the Makefile level instead > of by wrapping every .c file with #ifdef/#endif wrappers. Unfortunately this breaks building with older (GCC-3.x) compilers. > +$(OBJTREE)/include/autoconf.mk: $(obj)include/config.h > + @echo Generating include/autoconf.mk > + @# Generate the dependancies > + @$(CC) -M $(HOST_CFLAGS) $(CPPFLAGS) -MQ $@ include/common.h > $@.dep ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Does not work with GCC-3.x: + ppc_8xx-gcc -M -g -Os -fPIC -ffixed-r14 -meabi -fno-strict-aliasing -D__KERNEL__ -DTEXT_BASE=0x40000000 -I/home/wd/git/u-boot/work/include -fno-builtin -ffreestanding -nostdinc -isystem /opt/eldk-3.1.1/usr/bin/../lib/gcc-lib/ppc-linux/3.3.3/include -pipe -DCONFIG_PPC -D__powerpc__ -DCONFIG_8xx -ffixed-r2 -ffixed-r29 -mstring -mcpu=860 -msoft-float -MQ /home/wd/git/u-boot/work/include/autoconf.mk include/common.h ppc_8xx-gcc: compilation of header file requested + echo RC=1 RC=1 [Tested with ELDK 3.1.1] The effect is even more nasty, as make will not stop afgter the error; if you ignore the "compilation of header file requested" message, but continues until it runs into problems later (when linking). Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de C makes it easy for you to shoot yourself in the foot. C++ makes that harder, but when you do, it blows away your whole leg. -- Bjarne Stroustrup