From e026cf022b1301e2f808b24713792ae3a3fc5be1 Mon Sep 17 00:00:00 2001 From: "Brian S. Dean" Date: Sun, 25 Feb 2001 17:39:58 +0000 Subject: [PATCH] Automate dependency generation. git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@62 81a1dc3b-b13d-400b-aceb-764788c761c2 --- Makefile | 13 +++++-------- Makefile.inc | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 8 deletions(-) create mode 100644 Makefile.inc diff --git a/Makefile b/Makefile index d2abae1a..7cba4462 100644 --- a/Makefile +++ b/Makefile @@ -22,20 +22,17 @@ INSTALL_DATA = ${INSTALL} -m 444 INSTALL_MANUAL = ${INSTALL_DATA} -OBJS = avr.o fileio.o main.o ppi.o term.o LIBS = -lreadline -all : ${TARGET} +.include "Makefile.inc" + +all : + make depend + make ${TARGET} ${TARGET} : ${OBJS} ${CC} ${LDFLAGS} -o ${TARGET} ${OBJS} ${LIBS} -main.o : avr.h fileio.h ppi.h term.h pindefs.h -avr.o : avr.h ppi.h pindefs.h -fileio.o : fileio.h avr.h -ppi.o : ppi.h -term.o : term.h avr.h pindefs.h ppi.h - clean : rm -f *~ *.core ${TARGET} *.o diff --git a/Makefile.inc b/Makefile.inc new file mode 100644 index 00000000..e22d5242 --- /dev/null +++ b/Makefile.inc @@ -0,0 +1,39 @@ + +.SUFFIXES: .o .c + +first_rule : all + + +.depend : .PHONY + @echo "# dependencies generated `date +'%D %T'`" > .depend + @echo >> .depend + @echo "# SUBDIR=`pwd`" >> .depend + @echo >> .depend + @echo >> .depend + @echo "SRCS = \\" >> .depend + @for i in *.S *.c; do \ + if [ -f "$$i" ]; then \ + echo " $$i \\" >> .depend; \ + fi ; \ + done + @echo >> .depend + @echo "OBJS = \\" >> .depend + @for i in *.S *.c; do \ + if [ -f "$$i" ]; then \ + echo " $${i%%.*}.o \\" >> .depend; \ + fi ; \ + done + @echo >> .depend + @for i in *.S *.c; do \ + if [ -f "$$i" ]; then \ + $(CC) -E $(CFLAGS) -M $$i >> .depend; \ + fi ; \ + done + @echo >> .depend + +.if exists(.depend) +.include ".depend" +.endif + +depend : .depend +