5 # Copyright 1987 by the Massachusetts Institute of Technology.
7 # For copying and distribution information,
8 # please see the file <mit-copyright.h>.
10 # Utility to build makefile header dependancies from C source.
12 # If you have source for cpp...
14 #ifdef cpp_source_path
15 SRCS = include.c main.c parse.c pr.c cppsetup.c cpp.c cpy.y
17 ${SRCDIR}/util/makedepend/include.c \
18 ${SRCDIR}/util/makedepend/main.c \
19 ${SRCDIR}/util/makedepend/parse.c \
20 ${SRCDIR}/util/makedepend/pr.c \
21 ${SRCDIR}/util/makedepend/cppsetup.c \
22 ${SRCDIR}/util/makedepend/cpp.ed \
23 ${SRCDIR}/util/makedepend/Imakefile \
24 ${SRCDIR}/util/makedepend/Makefile
25 OBJS = include.o main.o parse.o pr.o cppsetup.o cpp.o cpy.o
26 DEFINES = -DCPP '-DINCLUDEDIR="/usr/include"'
27 CPPSRC = cpp_source_path
32 # But if you don't have cpp source...
34 SRCS = include.c main.c parse.c pr.c cppsetup.c
36 ${SRCDIR}/util/makedepend/include.c \
37 ${SRCDIR}/util/makedepend/main.c \
38 ${SRCDIR}/util/makedepend/parse.c \
39 ${SRCDIR}/util/makedepend/pr.c \
40 ${SRCDIR}/util/makedepend/cppsetup.c \
41 ${SRCDIR}/util/makedepend/Imakefile \
42 ${SRCDIR}/util/makedepend/Makefile
43 OBJS = include.o main.o parse.o pr.o cppsetup.o
44 DEFINES = '-DINCLUDEDIR="/usr/include"'
48 CODE=$(SRCS) Imakefile
50 genutil(makedepend,$(OBJS),,)
54 sed -e '/^# *line/d' < y.tab.c > cpy.c
57 cpy.y: $(CPPSRC)/cpy.y
59 $(LN) $(CPPSRC)/cpy.y .
61 yylex.c: $(CPPSRC)/yylex.c
63 sed -e 's/#if pdp11 | vax | mc68000/& | ns16000 | ibm032/' \
64 $(CPPSRC)/yylex.c > yylex.c
66 cpp.c: $(CPPSRC)/cpp.c cpp.ed
68 /lib/cpp $(CPPSRC)/cpp.c \
70 | sed -e '/^$$/d' -e '/^#/d' -e 's/ / /g' > cpp.c
71 sed -e '/^#/d' < cpp.ed | ed - cpp.c
77 $(RM) cpp.c cpy.? yylex.c
80 -mkdir $(DESTDIR)/util
81 -mkdir $(DESTDIR)/util/makedepend
82 for i in $(SOURCES); do \
83 $(RM) ${DESTDIR}/util/makedepend/`basename $$i`; \
84 $(CP) $$i ${DESTDIR}/util/makedepend/`basename $$i`; done