[flashrom] [PATCH] flashrom dependencies

Carl-Daniel Hailfinger c-d.hailfinger.devel.2006 at gmx.net
Thu Jun 3 15:33:51 CEST 2010


On 30.03.2010 09:48, Stefan Reinauer wrote:
> On 3/30/10 5:12 AM, Carl-Daniel Hailfinger wrote:
>   
>> Unfortunately, this breaks make clean (and therefore make distclean) for
>> non-default configurations because OBJS will only contain the currently
>> selected modules. You can reproduce this easily with
>>
>> # make CONFIG_BITBANG_SPI=yes CONFIG_GFXNVIDIA=yes CONFIG_ATAHPT=yes
>> CONFIG_DEDIPROG=yes
>> # make clean
>>     
>
> Yes, it assumes, that you specify the same build flags on make clean,
> too. If that's not what you want, just change the $(OBJS)
> stuff to *.o *.d. I initially decided against this as some people are
> allergic when make clean does not only clean the stuff make created but
> operates with wild cards.
>   

Hm yes. The alternative would be to operate with two object lists: One
for files that are compiled in, and one for files that are not compiled in.

I've followed your suggestion about replacing $(OBJS) with *.o *.d and
updated the patch to apply against svn trunk. Since the changes are
minimal, I kept your signoff. If you're unhappy with that, please tell
me and I'll remove it.
Tested with gcc and clang, works for me and seems to reduce compile time
by ~5%.

This patch needs matching svn:ignore on commit.

Create dependencies on the fly rather than in a separate step.

Signed-off-by: Stefan Reinauer <stepan at coresystems.de>

Index: flashrom-stefan_dependencies_onestep/Makefile
===================================================================
--- flashrom-stefan_dependencies_onestep/Makefile	(Revision 1026)
+++ flashrom-stefan_dependencies_onestep/Makefile	(Arbeitskopie)
@@ -65,7 +65,7 @@
 
 PROGRAMMER_OBJS = udelay.o programmer.o
 
-all: pciutils features dep $(PROGRAM)
+all: pciutils features $(PROGRAM)
 
 # Set the flashrom version string from the highest revision number
 # of the checked out flashrom files.
@@ -253,19 +253,16 @@
 TAROPTIONS = $(shell LC_ALL=C tar --version|grep -q GNU && echo "--owner=root --group=root")
 
 %.o: %.c .features
-	$(CC) $(CFLAGS) $(CPPFLAGS) $(FEATURE_CFLAGS) $(SVNDEF) -o $@ -c $<
+	$(CC) -MMD $(CFLAGS) $(CPPFLAGS) $(FEATURE_CFLAGS) $(SVNDEF) -o $@ -c $<
 
 # Make sure to add all names of generated binaries here.
 # This includes all frontends and libflashrom.
 clean:
-	rm -f $(PROGRAM) $(PROGRAM).exe *.o
+	rm -f $(PROGRAM) $(PROGRAM).exe *.o *.d
 
 distclean: clean
-	rm -f .dependencies .features .libdeps
+	rm -f .features .libdeps
 
-dep:
-	@$(CC) $(CPPFLAGS) $(SVNDEF) -MM $(OBJS:.o=.c) > .dependencies
-
 strip: $(PROGRAM)
 	$(STRIP) $(STRIP_ARGS) $(PROGRAM)
 
@@ -365,6 +362,6 @@
 djgpp-dos: clean
 	make CC=i586-pc-msdosdjgpp-gcc STRIP=i586-pc-msdosdjgpp-strip WARNERROR=no OS_ARCH=DOS
 
-.PHONY: all clean distclean dep compiler pciutils features export tarball dos
+.PHONY: all clean distclean compiler pciutils features export tarball dos
 
--include .dependencies
+-include $(OBJS:.o=.d)


-- 
http://www.hailfinger.org/





More information about the flashrom mailing list