1
0
mirror of git://projects.qi-hardware.com/fped.git synced 2024-06-24 15:46:22 +03: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)
YACC_normal := $(YACC)
LEX_normal := $(LEX)
DEPEND_normal = \
$(CPP) $(CFLAGS) -MM -MG *.c >.depend || \
{ rm -f .depend; exit 1; }
DEPEND_normal := $(CPP) $(CFLAGS) -MM -MG
CC_quiet = @echo " CC " $@ && $(CC_normal)
YACC_quiet = @echo " YACC " $@ && $(YACC_normal)
LEX_quiet = @echo " LEX " $@ && $(LEX_normal)
GEN_quiet = @echo " GENERATE " $@ &&
DEPEND_quiet = @echo " DEPENDENCIES" && $(DEPEND_normal)
DEPEND_quiet = @$(DEPEND_normal)
ifeq ($(V),1)
CC = $(CC_normal)
@ -88,6 +86,17 @@ endif
.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
.fig.ppm:
@ -142,16 +151,16 @@ montage:
# ----- Dependencies ----------------------------------------------------------
dep depend .depend: lex.yy.c y.tab.h y.tab.c *.h *.c
$(DEPEND)
dep depend .depend:
@echo 'no need to run "make depend" anymore' 1>&2
-include .depend
-include $(OBJS:.o=.d)
# ----- Cleanup ---------------------------------------------------------------
clean:
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*
# ----- Install / uninstall ---------------------------------------------------