From: Erik Rozendaal Date: Thu, 9 Dec 2004 13:19:50 +0000 (+0000) Subject: Makefile.in: Automatic generation of dependencies. Clean doesn't X-Git-Tag: release-0.50~729 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=79184c78f780cfadd14da58d2b3ea0f237a530f4;p=thirdparty%2Fldns.git Makefile.in: Automatic generation of dependencies. Clean doesn't remove file generated by autoconf, configure, etc. Use 'realclean' instead. Added '-W' option to OURCFLAGS. --- diff --git a/Makefile.in b/Makefile.in index b7f49f07..cd739b02 100644 --- a/Makefile.in +++ b/Makefile.in @@ -8,36 +8,50 @@ bindir = @bindir@ mandir = @mandir@ CC = @CC@ -OURCFLAGS = -g -Wall -Wwrite-strings #-Wunused-value -Wunused-parameter -CFLAGS = @CFLAGS@ -I$(srcdir) $(OURCFLAGS) +CPPFLAGS = @CPPFLAGS@ @DEFS@ -I$(srcdir) +OURCFLAGS = -Wall -W -Wwrite-strings #-Wunused-value -Wunused-parameter +CFLAGS = @CFLAGS@ $(OURCFLAGS) LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ #INSTALL = $(srcdir)/install-sh -c #INSTALL_PROGRAM = $(INSTALL) -LIBOBJ=rdata.o util.o -HEADER=rdata.h prototype.h rr.h packet.h +LIBDNS_SOURCES=rdata.c util.c +LIBDNS_HEADERS=rdata.h prototype.h rr.h packet.h +LIBDNS_OBJECTS=$(LIBDNS_SOURCES:.c=.o) -COMPILE = $(CC) $(CFLAGS) +ALL_SOURCES=main.c $(LIBDNS_SOURCES) + +COMPILE = $(CC) $(CPPFLAGS) $(CFLAGS) LINK = $(CC) $(CFLAGS) $(LDFLAGS) -%.o: %.c $(HEADER) - $(CC) $(CFLAGS) -c $< +%.o: %.c + $(COMPILE) -c $< -.PHONY: clean +.PHONY: clean realclean -main: main.o $(LIBOBJ) - $(LINK) -o $@ main.o $(LIBOBJ) +main: main.o $(LIBDNS_OBJECTS) + $(LINK) -o $@ $+ clean: - rm -f *.o + rm -f *.o *.d rm -f main rm -rf autom4te.cache/ rm -f aclocal.m4 + +realclean: clean rm -f config.status rm -f config.log rm -f Makefile rm -f config.h rm -f config.h.in rm -f configure + +# Automatic dependencies. +%.d: %.c + $(SHELL) -ec '$(CC) -MM $(CPPFLAGS) $< \ + | sed '\''s!\(.*\)\.o[ :]*!$(dir $@)\1.o $@ : !g'\'' > $@; \ + [ -s $@ ] || rm -f $@' + +include $(ALL_SOURCES:.c=.d)