1
0
mirror of git://projects.qi-hardware.com/fped.git synced 2024-11-26 03:01:53 +02:00

Generating full dependencies for each and every change slowed down development

quite a bit. We now use per-file granularity for dependencies, reducing the
overhead by about a factor of 30.

- Makefile: generate per-file dependencies (.d) when compiling, based on
  http://scottmcpeak.com/autodepend/autodepend.html
- Makefile: "depend" target is no longer used



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5850 99fdad57-331a-0410-800a-d7fa5415bdb3
This commit is contained in:
werner 2010-02-20 05:10:24 +00:00
parent ea8e848f72
commit 140b60d074

View File

@ -57,15 +57,13 @@ CPP := $(CPP) # make sure changing CC won't affect CPP
CC_normal := $(CC) CC_normal := $(CC)
YACC_normal := $(YACC) YACC_normal := $(YACC)
LEX_normal := $(LEX) LEX_normal := $(LEX)
DEPEND_normal = \ DEPEND_normal := $(CPP) $(CFLAGS) -MM -MG
$(CPP) $(CFLAGS) -MM -MG *.c >.depend || \
{ rm -f .depend; exit 1; }
CC_quiet = @echo " CC " $@ && $(CC_normal) CC_quiet = @echo " CC " $@ && $(CC_normal)
YACC_quiet = @echo " YACC " $@ && $(YACC_normal) YACC_quiet = @echo " YACC " $@ && $(YACC_normal)
LEX_quiet = @echo " LEX " $@ && $(LEX_normal) LEX_quiet = @echo " LEX " $@ && $(LEX_normal)
GEN_quiet = @echo " GENERATE " $@ && GEN_quiet = @echo " GENERATE " $@ &&
DEPEND_quiet = @echo " DEPENDENCIES" && $(DEPEND_normal) DEPEND_quiet = @$(DEPEND_normal)
ifeq ($(V),1) ifeq ($(V),1)
CC = $(CC_normal) CC = $(CC_normal)
@ -88,6 +86,17 @@ endif
.SUFFIXES: .fig .xpm .ppm .SUFFIXES: .fig .xpm .ppm
# compile and generate dependencies, based on
# http://scottmcpeak.com/autodepend/autodepend.html
%.o: %.c
$(CC) -c $(CFLAGS) $*.c -o $*.o
$(DEPEND) $(CFLAGS) $*.c | \
sed -e \
'/^\(.*:\)\? */{p;s///;s/ *\\\?$$/ /;s/ */:\n/g;H;}' \
-e '$${g;p;}' -e d >$*.d; \
[ "$${PIPESTATUS[*]}" = "0 0" ] || { rm -f $*.d; exit 1; }
# generate 26x26 pixels icons, then drop the 1-pixel frame # generate 26x26 pixels icons, then drop the 1-pixel frame
.fig.ppm: .fig.ppm:
@ -142,16 +151,16 @@ montage:
# ----- Dependencies ---------------------------------------------------------- # ----- Dependencies ----------------------------------------------------------
dep depend .depend: lex.yy.c y.tab.h y.tab.c *.h *.c dep depend .depend:
$(DEPEND) @echo 'no need to run "make depend" anymore' 1>&2
-include .depend -include $(OBJS:.o=.d)
# ----- Cleanup --------------------------------------------------------------- # ----- Cleanup ---------------------------------------------------------------
clean: clean:
rm -f $(OBJS) $(XPMS:%=icons/%) $(XPMS:%.xpm=icons/%.ppm) rm -f $(OBJS) $(XPMS:%=icons/%) $(XPMS:%.xpm=icons/%.ppm)
rm -f lex.yy.c y.tab.c y.tab.h y.output .depend rm -f lex.yy.c y.tab.c y.tab.h y.output .depend $(OBJS:.o=.d)
rm -f __dbg????.png _tmp* rm -f __dbg????.png _tmp*
# ----- Install / uninstall --------------------------------------------------- # ----- Install / uninstall ---------------------------------------------------