Automate dependency generation.

git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@62 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
Brian S. Dean 2001-02-25 17:39:58 +00:00
parent f17016a7b8
commit e026cf022b
2 changed files with 44 additions and 8 deletions

View File

@ -22,20 +22,17 @@ INSTALL_DATA = ${INSTALL} -m 444
INSTALL_MANUAL = ${INSTALL_DATA} INSTALL_MANUAL = ${INSTALL_DATA}
OBJS = avr.o fileio.o main.o ppi.o term.o
LIBS = -lreadline LIBS = -lreadline
all : ${TARGET} .include "Makefile.inc"
all :
make depend
make ${TARGET}
${TARGET} : ${OBJS} ${TARGET} : ${OBJS}
${CC} ${LDFLAGS} -o ${TARGET} ${OBJS} ${LIBS} ${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 : clean :
rm -f *~ *.core ${TARGET} *.o rm -f *~ *.core ${TARGET} *.o

39
Makefile.inc Normal file
View File

@ -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