linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH]: Makefile automatic header dependency
@ 2008-12-25  4:04 Christopher Li
  2008-12-25  9:30 ` Sam Ravnborg
  0 siblings, 1 reply; 3+ messages in thread
From: Christopher Li @ 2008-12-25  4:04 UTC (permalink / raw)
  To: Linux-Sparse, Josh Triplett, Alexey Zaytsev

Hi,

Can some one help me test the c2xml build? I don't
have libxml-2.0 to verify it.

Chris

Makefile automatic header dependency

It use the gcc generated dependency file to track
header file changes.

Use pattern rules to build programs.
Makefile is much shorter now. Easier to add
new objs or new programs.

Singed-Off-By: Christopher Li<sparse@chrisli.org>

Index: sparse.chrisl/Makefile
===================================================================
--- sparse.chrisl.orig/Makefile
+++ sparse.chrisl/Makefile
@@ -8,6 +8,7 @@ CFLAGS = -O2 -finline-functions -fno-str
 CFLAGS += -Wall -Wwrite-strings
 LDFLAGS += -g
 AR = ar
+PROG_LINK_CMD = $(QUIET_LINK)$(CC) $(LDFLAGS) -o $@ $^  $($@_EXTRA_OBJS)

 #
 # For debugging, uncomment the next one
@@ -18,6 +19,7 @@ HAVE_LIBXML=$(shell pkg-config --exists


 CFLAGS += -DGCC_BASE=\"$(shell $(CC) --print-file-name=)\"
+CFLAGS += -Wp,-MD,$(@D)/.$(@F).d

 DESTDIR=
 PREFIX=$(HOME)
@@ -28,16 +30,15 @@ MAN1DIR=$(MANDIR)/man1
 INCLUDEDIR=$(PREFIX)/include
 PKGCONFIGDIR=$(LIBDIR)/pkgconfig

-PROGRAMS=test-lexing test-parsing obfuscate compile graph sparse
test-linearize example \
-	 test-unssa test-dissect ctags
-
-
+PROGRAMS=test-lexing test-parsing obfuscate compile graph sparse \
+	 test-linearize example test-unssa test-dissect ctags
 INST_PROGRAMS=sparse cgcc
 INST_MAN1=sparse.1 cgcc.1

 ifeq ($(HAVE_LIBXML),yes)
 PROGRAMS+=c2xml
 INST_PROGRAMS+=c2xml
+c2xml_EXTRA_OBJS = `pkg-config --libs libxml-2.0`
 endif

 LIB_H=    token.h parse.h lib.h symbol.h scope.h expression.h target.h \
@@ -98,44 +99,12 @@ install: $(INST_PROGRAMS) $(LIBS) $(LIB_
 sparse.pc: sparse.pc.in
 	$(QUIET_GEN)sed
's|@version@|$(VERSION)|g;s|@prefix@|$(PREFIX)|g;s|@libdir@|$(LIBDIR)|g;s|@includedir@|$(INCLUDEDIR)|g'
sparse.pc.in > sparse.pc

-test-lexing: test-lexing.o $(LIBS)
-	$(QUIET_LINK)$(CC) $(LDFLAGS) -o $@ $< $(LIBS)
-
-test-parsing: test-parsing.o $(LIBS)
-	$(QUIET_LINK)$(CC) $(LDFLAGS) -o $@ $< $(LIBS)
-
-test-linearize: test-linearize.o $(LIBS)
-	$(QUIET_LINK)$(CC) $(LDFLAGS) -o $@ $< $(LIBS)
-
-test-sort: test-sort.o $(LIBS)
-	$(QUIET_LINK)$(CC) $(LDFLAGS) -o $@ $< $(LIBS)
-
+	
 compile: compile.o compile-i386.o $(LIBS)
-	$(QUIET_LINK)$(CC) $(LDFLAGS) -o $@ $< compile-i386.o $(LIBS)
-
-obfuscate: obfuscate.o $(LIBS)
-	$(QUIET_LINK)$(CC) $(LDFLAGS) -o $@ $< $(LIBS)
-
-sparse: sparse.o $(LIBS)
-	$(QUIET_LINK)$(CC) $(LDFLAGS) -o $@ $< $(LIBS)
-
-graph: graph.o $(LIBS)
-	$(QUIET_LINK)$(CC) $(LDFLAGS) -o $@ $< $(LIBS)
-
-example: example.o $(LIBS)
-	$(QUIET_LINK)$(CC) $(LDFLAGS) -o $@ $< $(LIBS)
-
-test-unssa: test-unssa.o $(LIBS)
-	$(QUIET_LINK)$(CC) $(LDFLAGS) -o $@ $< $(LIBS)
-
-test-dissect: test-dissect.o $(LIBS)
-	$(QUIET_LINK)$(CC) $(LDFLAGS) -o $@ $< $(LIBS)
-
-ctags: ctags.o $(LIBS)
-	$(QUIET_LINK)$(CC) $(LDFLAGS) -o $@ $< $(LIBS)
+	$(PROG_LINK_CMD)

-c2xml: c2xml.o $(LIBS)
-	$(QUIET_LINK)$(CC) $(LDFLAGS)  -o $@ $< $(LIBS) `pkg-config --libs libxml-2.0`
+%: %.o $(LIBS)
+	$(PROG_LINK_CMD)

 $(LIB_FILE): $(LIB_OBJS)
 	$(QUIET_AR)$(AR) rcs $@ $(LIB_OBJS)
@@ -143,48 +112,13 @@ $(LIB_FILE): $(LIB_OBJS)
 $(SLIB_FILE): $(LIB_OBJS)
 	$(QUIET_LINK)$(CC) $(LDFLAGS) -Wl,-soname,$@ -shared -o $@ $(LIB_OBJS)

-evaluate.o: $(LIB_H)
-expression.o: $(LIB_H)
-lib.o: $(LIB_H)
-allocate.o: $(LIB_H)
-ptrlist.o: $(LIB_H)
-parse.o: $(LIB_H)
-pre-process.o: $(LIB_H)
-scope.o: $(LIB_H)
-show-parse.o: $(LIB_H)
-symbol.o: $(LIB_H)
-expand.o: $(LIB_H)
-linearize.o: $(LIB_H)
-flow.o: $(LIB_H)
-cse.o: $(LIB_H)
-simplify.o: $(LIB_H)
-memops.o: $(LIB_H)
-liveness.o: $(LIB_H)
-sort.o: $(LIB_H)
-inline.o: $(LIB_H)
-target.o: $(LIB_H)
-test-lexing.o: $(LIB_H)
-test-parsing.o: $(LIB_H)
-test-linearize.o: $(LIB_H)
-test-dissect.o: $(LIB_H)
-test-unssa.o: $(LIB_H)
-ctags.o: $(LIB_H)
-compile.o: $(LIB_H) compile.h
-compile-i386.o: $(LIB_H) compile.h
-tokenize.o: $(LIB_H)
-sparse.o: $(LIB_H)
-obfuscate.o: $(LIB_H)
-example.o: $(LIB_H)
-storage.o: $(LIB_H)
-dissect.o: $(LIB_H)
-graph.o: $(LIB_H)
+include $(wildcard .*.o.d)

 c2xml.o: c2xml.c $(LIB_H)
 	$(QUIET_CC)$(CC) `pkg-config --cflags libxml-2.0` -o $@ -c $(CFLAGS) $<

-compat-linux.o: compat/strtold.c compat/mmap-blob.c \
-	$(LIB_H)
-compat-solaris.o: compat/mmap-blob.c $(LIB_H)
+compat-linux.o: compat/strtold.c compat/mmap-blob.c
+compat-solaris.o: compat/mmap-blob.c
 compat-mingw.o: $(LIB_H)
 compat-cygwin.o: $(LIB_H)

@@ -192,7 +126,7 @@ compat-cygwin.o: $(LIB_H)
 	$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $<

 clean: clean-check
-	rm -f *.[oa] *.so $(PROGRAMS) $(SLIB_FILE) pre-process.h sparse.pc
+	rm -f *.[oad] *.so $(PROGRAMS) $(SLIB_FILE) pre-process.h sparse.pc

 dist:
 	@if test "`git describe`" != "$(VERSION)" ; then \

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH]: Makefile automatic header dependency
  2008-12-25  4:04 [PATCH]: Makefile automatic header dependency Christopher Li
@ 2008-12-25  9:30 ` Sam Ravnborg
  2008-12-26  0:14   ` Christopher Li
  0 siblings, 1 reply; 3+ messages in thread
From: Sam Ravnborg @ 2008-12-25  9:30 UTC (permalink / raw)
  To: Christopher Li; +Cc: Linux-Sparse, Josh Triplett, Alexey Zaytsev

Hi Chris.

I tried to apply your patch here.
It was word wrapped but that was easy to fix.

A few comments below.

> Singed-Off-By: Christopher Li<sparse@chrisli.org>

s/Singed/Signed/

> Index: sparse.chrisl/Makefile
> ===================================================================
> --- sparse.chrisl.orig/Makefile
> +++ sparse.chrisl/Makefile
> @@ -8,6 +8,7 @@ CFLAGS = -O2 -finline-functions -fno-str
>  CFLAGS += -Wall -Wwrite-strings
>  LDFLAGS += -g
>  AR = ar
> +PROG_LINK_CMD = $(QUIET_LINK)$(CC) $(LDFLAGS) -o $@ $^  $($@_EXTRA_OBJS)
> 
>  #
>  # For debugging, uncomment the next one
> @@ -18,6 +19,7 @@ HAVE_LIBXML=$(shell pkg-config --exists
> 
> 
>  CFLAGS += -DGCC_BASE=\"$(shell $(CC) --print-file-name=)\"
> +CFLAGS += -Wp,-MD,$(@D)/.$(@F).d

This works well with gcc - but if we want to build sparse with a wider
set of tool chains then this may fail.

> 
>  DESTDIR=
>  PREFIX=$(HOME)
> @@ -28,16 +30,15 @@ MAN1DIR=$(MANDIR)/man1
>  INCLUDEDIR=$(PREFIX)/include
>  PKGCONFIGDIR=$(LIBDIR)/pkgconfig
> 
> -PROGRAMS=test-lexing test-parsing obfuscate compile graph sparse
> test-linearize example \
> -	 test-unssa test-dissect ctags
> -
> -
> +PROGRAMS=test-lexing test-parsing obfuscate compile graph sparse \
> +	 test-linearize example test-unssa test-dissect ctags
>  INST_PROGRAMS=sparse cgcc
>  INST_MAN1=sparse.1 cgcc.1
> 
>  ifeq ($(HAVE_LIBXML),yes)
>  PROGRAMS+=c2xml
>  INST_PROGRAMS+=c2xml
> +c2xml_EXTRA_OBJS = `pkg-config --libs libxml-2.0`
>  endif
> 
>  LIB_H=    token.h parse.h lib.h symbol.h scope.h expression.h target.h \
> @@ -98,44 +99,12 @@ install: $(INST_PROGRAMS) $(LIBS) $(LIB_
>  sparse.pc: sparse.pc.in
>  	$(QUIET_GEN)sed
> 's|@version@|$(VERSION)|g;s|@prefix@|$(PREFIX)|g;s|@libdir@|$(LIBDIR)|g;s|@includedir@|$(INCLUDEDIR)|g'
> sparse.pc.in > sparse.pc

When you are patching the Makefile then I suggest breaking this line up somehow.
Should be a follow-up patch.

> 
> -test-lexing: test-lexing.o $(LIBS)
> -	$(QUIET_LINK)$(CC) $(LDFLAGS) -o $@ $< $(LIBS)
> -
> -test-parsing: test-parsing.o $(LIBS)
> -	$(QUIET_LINK)$(CC) $(LDFLAGS) -o $@ $< $(LIBS)
> -
> -test-linearize: test-linearize.o $(LIBS)
> -	$(QUIET_LINK)$(CC) $(LDFLAGS) -o $@ $< $(LIBS)
> -
> -test-sort: test-sort.o $(LIBS)
> -	$(QUIET_LINK)$(CC) $(LDFLAGS) -o $@ $< $(LIBS)
> -
> +	
>  compile: compile.o compile-i386.o $(LIBS)
> -	$(QUIET_LINK)$(CC) $(LDFLAGS) -o $@ $< compile-i386.o $(LIBS)
> -
> -obfuscate: obfuscate.o $(LIBS)
> -	$(QUIET_LINK)$(CC) $(LDFLAGS) -o $@ $< $(LIBS)
> -
> -sparse: sparse.o $(LIBS)
> -	$(QUIET_LINK)$(CC) $(LDFLAGS) -o $@ $< $(LIBS)
> -
> -graph: graph.o $(LIBS)
> -	$(QUIET_LINK)$(CC) $(LDFLAGS) -o $@ $< $(LIBS)
> -
> -example: example.o $(LIBS)
> -	$(QUIET_LINK)$(CC) $(LDFLAGS) -o $@ $< $(LIBS)
> -
> -test-unssa: test-unssa.o $(LIBS)
> -	$(QUIET_LINK)$(CC) $(LDFLAGS) -o $@ $< $(LIBS)
> -
> -test-dissect: test-dissect.o $(LIBS)
> -	$(QUIET_LINK)$(CC) $(LDFLAGS) -o $@ $< $(LIBS)
> -
> -ctags: ctags.o $(LIBS)
> -	$(QUIET_LINK)$(CC) $(LDFLAGS) -o $@ $< $(LIBS)
> +	$(PROG_LINK_CMD)
> 
> -c2xml: c2xml.o $(LIBS)
> -	$(QUIET_LINK)$(CC) $(LDFLAGS)  -o $@ $< $(LIBS) `pkg-config --libs libxml-2.0`
> +%: %.o $(LIBS)
> +	$(PROG_LINK_CMD)

Such a catch-all rule may likely give problems 
in the future. But for now it looks good.

I tried with:
$(PROGRAMS): %.o: $(LIBS)

but that failed due to the special treatment of compile
in the rule above.

> 
>  $(LIB_FILE): $(LIB_OBJS)
>  	$(QUIET_AR)$(AR) rcs $@ $(LIB_OBJS)
> @@ -143,48 +112,13 @@ $(LIB_FILE): $(LIB_OBJS)
>  $(SLIB_FILE): $(LIB_OBJS)
>  	$(QUIET_LINK)$(CC) $(LDFLAGS) -Wl,-soname,$@ -shared -o $@ $(LIB_OBJS)
> 
> -evaluate.o: $(LIB_H)
> -expression.o: $(LIB_H)
> -lib.o: $(LIB_H)
> -allocate.o: $(LIB_H)
> -ptrlist.o: $(LIB_H)
> -parse.o: $(LIB_H)
> -pre-process.o: $(LIB_H)
> -scope.o: $(LIB_H)
> -show-parse.o: $(LIB_H)
> -symbol.o: $(LIB_H)
> -expand.o: $(LIB_H)
> -linearize.o: $(LIB_H)
> -flow.o: $(LIB_H)
> -cse.o: $(LIB_H)
> -simplify.o: $(LIB_H)
> -memops.o: $(LIB_H)
> -liveness.o: $(LIB_H)
> -sort.o: $(LIB_H)
> -inline.o: $(LIB_H)
> -target.o: $(LIB_H)
> -test-lexing.o: $(LIB_H)
> -test-parsing.o: $(LIB_H)
> -test-linearize.o: $(LIB_H)
> -test-dissect.o: $(LIB_H)
> -test-unssa.o: $(LIB_H)
> -ctags.o: $(LIB_H)
> -compile.o: $(LIB_H) compile.h
> -compile-i386.o: $(LIB_H) compile.h
> -tokenize.o: $(LIB_H)
> -sparse.o: $(LIB_H)
> -obfuscate.o: $(LIB_H)
> -example.o: $(LIB_H)
> -storage.o: $(LIB_H)
> -dissect.o: $(LIB_H)
> -graph.o: $(LIB_H)
> +include $(wildcard .*.o.d)

This gives a warning when there is no .*.o.d files.
You need to do something like:
$(if $(wildcard .*.o.d), include $(wildcard .*.o.d))


> 
>  c2xml.o: c2xml.c $(LIB_H)
>  	$(QUIET_CC)$(CC) `pkg-config --cflags libxml-2.0` -o $@ -c $(CFLAGS) $<
> 
> -compat-linux.o: compat/strtold.c compat/mmap-blob.c \
> -	$(LIB_H)
> -compat-solaris.o: compat/mmap-blob.c $(LIB_H)
> +compat-linux.o: compat/strtold.c compat/mmap-blob.c
> +compat-solaris.o: compat/mmap-blob.c
>  compat-mingw.o: $(LIB_H)
>  compat-cygwin.o: $(LIB_H)
> 
> @@ -192,7 +126,7 @@ compat-cygwin.o: $(LIB_H)
>  	$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $<
> 
>  clean: clean-check
> -	rm -f *.[oa] *.so $(PROGRAMS) $(SLIB_FILE) pre-process.h sparse.pc
> +	rm -f *.[oad] *.so $(PROGRAMS) $(SLIB_FILE) pre-process.h sparse.pc
> 
>  dist:
>  	@if test "`git describe`" != "$(VERSION)" ; then \


	Sam

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH]: Makefile automatic header dependency
  2008-12-25  9:30 ` Sam Ravnborg
@ 2008-12-26  0:14   ` Christopher Li
  0 siblings, 0 replies; 3+ messages in thread
From: Christopher Li @ 2008-12-26  0:14 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: Linux-Sparse, Josh Triplett, Alexey Zaytsev

[-- Attachment #1: Type: text/plain, Size: 1450 bytes --]

On Thu, Dec 25, 2008 at 1:30 AM, Sam Ravnborg <sam@ravnborg.org> wrote:
> Hi Chris.
>
> I tried to apply your patch here.
> It was word wrapped but that was easy to fix.
>
> A few comments below.

Thanks, that is exactly what I am looking for.

>> +CFLAGS += -Wp,-MD,$(@D)/.$(@F).d
>
> This works well with gcc - but if we want to build sparse with a wider
> set of tool chains then this may fail.

Good point. I add a test run of the flags before we apply them.

>> 's|@version@|$(VERSION)|g;s|@prefix@|$(PREFIX)|g;s|@libdir@|$(LIBDIR)|g;s|@includedir@|$(INCLUDEDIR)|g'
>> sparse.pc.in > sparse.pc
>
> When you are patching the Makefile then I suggest breaking this line up somehow.
> Should be a follow-up patch.

Will do.

> Such a catch-all rule may likely give problems
> in the future. But for now it looks good.

I am trying to stay away from those scary double $$.
I just convert them using macros. Have to use a few
double $$, but it does not look too bad.

> I tried with:
> $(PROGRAMS): %.o: $(LIBS)
>
> but that failed due to the special treatment of compile
> in the rule above.

You mean:

$(PROGRAMS): % : %o  $(LIBS)

The only exception is "compile" depend on compile.o and compile-i386.o.
So I use a macro to solve that.

> This gives a warning when there is no .*.o.d files.
> You need to do something like:
> $(if $(wildcard .*.o.d), include $(wildcard .*.o.d))

It is fixed.

Thank for the feed back. See the updated patch

Chris

[-- Attachment #2: makefile.patch.txt --]
[-- Type: text/plain, Size: 4882 bytes --]

Makefile automatic header dependency

It use the gcc generated dependency file to track
header file changes.

Use pattern rules to build programes.
Makefile is much shorter now. Easier to add
new objs or new programs.

Signed-Off-By: Christopher Li<sparse@chrisli.org>

Index: sparse.chrisl/Makefile
===================================================================
--- sparse.chrisl.orig/Makefile
+++ sparse.chrisl/Makefile
@@ -15,10 +15,16 @@ AR = ar
 #CFLAGS += -O0 -DDEBUG -g3 -gdwarf-2
 
 HAVE_LIBXML=$(shell pkg-config --exists libxml-2.0 && echo 'yes')
-
+HAVE_GCC_DEP=$(shell touch .gcc-test.c && 				\
+		$(CC) -c -Wp,-MD,.gcc-test.d .gcc-test.c 2>/dev/null && \
+		echo 'yes'; rm -f .gcc-test.d .gcc-test.o .gcc-test.c)
 
 CFLAGS += -DGCC_BASE=\"$(shell $(CC) --print-file-name=)\"
 
+ifeq ($(HAVE_GCC_DEP),yes)
+CFLAGS += -Wp,-MD,$(@D)/.$(@F).d
+endif
+
 DESTDIR=
 PREFIX=$(HOME)
 BINDIR=$(PREFIX)/bin
@@ -28,16 +34,15 @@ MAN1DIR=$(MANDIR)/man1
 INCLUDEDIR=$(PREFIX)/include
 PKGCONFIGDIR=$(LIBDIR)/pkgconfig
 
-PROGRAMS=test-lexing test-parsing obfuscate compile graph sparse test-linearize example \
-	 test-unssa test-dissect ctags
-
-
+PROGRAMS=test-lexing test-parsing obfuscate compile graph sparse \
+	 test-linearize example test-unssa test-dissect ctags
 INST_PROGRAMS=sparse cgcc
 INST_MAN1=sparse.1 cgcc.1
 
 ifeq ($(HAVE_LIBXML),yes)
 PROGRAMS+=c2xml
 INST_PROGRAMS+=c2xml
+c2xml_EXTRA_OBJS = `pkg-config --libs libxml-2.0`
 endif
 
 LIB_H=    token.h parse.h lib.h symbol.h scope.h expression.h target.h \
@@ -98,44 +103,17 @@ install: $(INST_PROGRAMS) $(LIBS) $(LIB_
 sparse.pc: sparse.pc.in
 	$(QUIET_GEN)sed 's|@version@|$(VERSION)|g;s|@prefix@|$(PREFIX)|g;s|@libdir@|$(LIBDIR)|g;s|@includedir@|$(INCLUDEDIR)|g' sparse.pc.in > sparse.pc
 
-test-lexing: test-lexing.o $(LIBS)
-	$(QUIET_LINK)$(CC) $(LDFLAGS) -o $@ $< $(LIBS)
-
-test-parsing: test-parsing.o $(LIBS)
-	$(QUIET_LINK)$(CC) $(LDFLAGS) -o $@ $< $(LIBS)
-
-test-linearize: test-linearize.o $(LIBS)
-	$(QUIET_LINK)$(CC) $(LDFLAGS) -o $@ $< $(LIBS)
-
-test-sort: test-sort.o $(LIBS)
-	$(QUIET_LINK)$(CC) $(LDFLAGS) -o $@ $< $(LIBS)
-
-compile: compile.o compile-i386.o $(LIBS)
-	$(QUIET_LINK)$(CC) $(LDFLAGS) -o $@ $< compile-i386.o $(LIBS)
-
-obfuscate: obfuscate.o $(LIBS)
-	$(QUIET_LINK)$(CC) $(LDFLAGS) -o $@ $< $(LIBS)
-
-sparse: sparse.o $(LIBS)
-	$(QUIET_LINK)$(CC) $(LDFLAGS) -o $@ $< $(LIBS)
-
-graph: graph.o $(LIBS)
-	$(QUIET_LINK)$(CC) $(LDFLAGS) -o $@ $< $(LIBS)
-
-example: example.o $(LIBS)
-	$(QUIET_LINK)$(CC) $(LDFLAGS) -o $@ $< $(LIBS)
 
-test-unssa: test-unssa.o $(LIBS)
-	$(QUIET_LINK)$(CC) $(LDFLAGS) -o $@ $< $(LIBS)
+compile_EXTRA_DEPS = compile-i386.o
 
-test-dissect: test-dissect.o $(LIBS)
-	$(QUIET_LINK)$(CC) $(LDFLAGS) -o $@ $< $(LIBS)
+PROG_LINK_CMD = $(QUIET_LINK)$(CC) $(LDFLAGS) -o $@ $^ $($@_EXTRA_OBJS) 
 
-ctags: ctags.o $(LIBS)
-	$(QUIET_LINK)$(CC) $(LDFLAGS) -o $@ $< $(LIBS)
+define BUILD_PROGRAM
+$(prog): $(prog).o $$($(prog)_EXTRA_DEPS) $$(LIBS)
+	$$(PROG_LINK_CMD)
+endef
 
-c2xml: c2xml.o $(LIBS)
-	$(QUIET_LINK)$(CC) $(LDFLAGS)  -o $@ $< $(LIBS) `pkg-config --libs libxml-2.0`
+$(foreach prog,$(PROGRAMS),$(eval $(BUILD_PROGRAM)))
 
 $(LIB_FILE): $(LIB_OBJS)
 	$(QUIET_AR)$(AR) rcs $@ $(LIB_OBJS)
@@ -143,47 +121,13 @@ $(LIB_FILE): $(LIB_OBJS)
 $(SLIB_FILE): $(LIB_OBJS)
 	$(QUIET_LINK)$(CC) $(LDFLAGS) -Wl,-soname,$@ -shared -o $@ $(LIB_OBJS)
 
-evaluate.o: $(LIB_H)
-expression.o: $(LIB_H)
-lib.o: $(LIB_H)
-allocate.o: $(LIB_H)
-ptrlist.o: $(LIB_H)
-parse.o: $(LIB_H)
-pre-process.o: $(LIB_H)
-scope.o: $(LIB_H)
-show-parse.o: $(LIB_H)
-symbol.o: $(LIB_H)
-expand.o: $(LIB_H)
-linearize.o: $(LIB_H)
-flow.o: $(LIB_H)
-cse.o: $(LIB_H)
-simplify.o: $(LIB_H)
-memops.o: $(LIB_H)
-liveness.o: $(LIB_H)
-sort.o: $(LIB_H)
-inline.o: $(LIB_H)
-target.o: $(LIB_H)
-test-lexing.o: $(LIB_H)
-test-parsing.o: $(LIB_H)
-test-linearize.o: $(LIB_H)
-test-dissect.o: $(LIB_H)
-test-unssa.o: $(LIB_H)
-ctags.o: $(LIB_H)
-compile.o: $(LIB_H) compile.h
-compile-i386.o: $(LIB_H) compile.h
-tokenize.o: $(LIB_H)
-sparse.o: $(LIB_H)
-obfuscate.o: $(LIB_H)
-example.o: $(LIB_H)
-storage.o: $(LIB_H)
-dissect.o: $(LIB_H)
-graph.o: $(LIB_H)
+DEP_FILES := $(wildcard .*.o.d)
+$(if $(DEP_FILES),$(eval include $(DEP_FILES)))
 
 c2xml.o: c2xml.c $(LIB_H)
 	$(QUIET_CC)$(CC) `pkg-config --cflags libxml-2.0` -o $@ -c $(CFLAGS) $<
 
-compat-linux.o: compat/strtold.c compat/mmap-blob.c \
-	$(LIB_H)
+compat-linux.o: compat/strtold.c compat/mmap-blob.c $(LIB_H)
 compat-solaris.o: compat/mmap-blob.c $(LIB_H)
 compat-mingw.o: $(LIB_H)
 compat-cygwin.o: $(LIB_H)
@@ -192,7 +136,7 @@ compat-cygwin.o: $(LIB_H)
 	$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $<
 
 clean: clean-check
-	rm -f *.[oa] *.so $(PROGRAMS) $(SLIB_FILE) pre-process.h sparse.pc
+	rm -f *.[oa] .*.d *.so $(PROGRAMS) $(SLIB_FILE) pre-process.h sparse.pc
 
 dist:
 	@if test "`git describe`" != "$(VERSION)" ; then \

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-12-26  0:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-25  4:04 [PATCH]: Makefile automatic header dependency Christopher Li
2008-12-25  9:30 ` Sam Ravnborg
2008-12-26  0:14   ` Christopher Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).