1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-12-23 13:51:09 +02:00

genex/Makefile: add dependency generation (.d method)

Straight from fped/Makefile
This commit is contained in:
Werner Almesberger 2012-04-17 17:14:24 -03:00
parent 41448e8962
commit 40a76e1d4a

View File

@ -9,9 +9,11 @@
# (at your option) any later version.
#
CFLAGS = -Wall -g
OBJS = genex.o comp.o libs.o pdf.o
SHELL = /bin/bash
CFLAGS = -Wall -g
CC_normal := $(CC)
DEPEND_normal := $(CPP) $(CFLAGS) -MM -MG
@ -36,8 +38,18 @@ all: genex
genex: $(OBJS)
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LDLIBS)
%.o: %.c
$(CC) -c $(CFLAGS) $*.c -o $*.o
$(DEPEND) $*.c | \
sed -e \
'/^\(.*:\)\? */{p;s///;s/ *\\\?$$/ /;s/ */:\n/g;H;}' \
-e '$${g;p;}' -e d >$*.d; \
[ "$${PIPESTATUS[*]}" = "0 0" ] || { rm -f $*.d; exit 1; }
-include $(OBJS:.o=.d)
clean:
rm -f $(OBJS)
rm -f $(OBJS) $(OBJS:.o=.d)
spotless: clean
rm -f genex