1 # @(#)Makefile 5.2 (Berkeley) 12/28/90
2 # $Id: Makefile,v 1.6 1994/06/30 05:33:39 cgd Exp $
9 SRCS= arch.c buf.c cond.c dir.c for.c hash.c hash_tables.c job.c \
10 lst.c main.c make.c parse.c proc.c shell.c str.c suff.c targ.c \
13 .if !defined(MK_SHARED_TOOLCHAIN) || ${MK_SHARED_TOOLCHAIN} == "no"
17 # Version has the RYYYYMMDDX format, where R is from RELENG_<R>
18 CFLAGS+=-DMAKE_VERSION=\"9201210220\"
20 # There is no obvious performance improvement currently.
21 # CFLAGS+=-DUSE_KQUEUE
23 # Make object files which depend on preprocessor symbols defined in
24 # the Makefile which are not compilation options but rather configuration
25 # options dependend on the Makefile. main.c needs MAKE_VERSION while
26 # shell.c uses DEFSHELLNAME. This will cause recompilation in the case
27 # the definition is changed in the makefile. It will of course not cause
28 # recompilation if one does 'make MAKE_SHELL=csh'.
29 main.o shell.o: ${MAKEFILE}
31 # Directive and keyword tables. We use hash tables. These hash tables have been
32 # generated with mph (ports/devel/mph)
33 # If you change the directives or keywords (adding, deleting, reordering) you
34 # need to create new tables and hash functions (directive_hash, keyword_hash).
36 # The following changes have been made to the generated code:
38 # o prefix the names of the g, T0 and T1 arrays with 'directive_'
41 # o make the type of the tables 'const [un]signed char' (if you change
42 # anything make sure that the numbers fit into a char).
44 # o make the hash function use the length for termination,
45 # not the trailing '\0', via the -l flag in emitc and some editing
46 # (only for directive_hash).
48 LOCALBASE ?= /usr/local
49 MPH ?= ${LOCALBASE}/bin/mph
50 EMITC ?= ${LOCALBASE}/bin/emitc
56 echo ' * DO NOT EDIT' ; \
57 echo ' * $$''FreeBSD$$' ; \
58 echo -n ' * auto-generated from ' ; \
59 sed -nEe '/\$$FreeBSD/s/^.*\$$(.*)\$$.*$$/\1/p' \
60 ${.CURDIR}/parse.c ; \
61 echo ' * DO NOT EDIT' ; \
63 echo '#include <sys/types.h>' ; \
65 echo '#include "hash_tables.h"' ; \
67 cat ${.CURDIR}/parse.c | sed \
68 -e '1,/DIRECTIVES-START-TAG/d' \
69 -e '/DIRECTIVES-END-TAG/,$$d' \
70 -e 's/^[^"]*"\([^"]*\)".*$$/\1/' | \
71 ${MPH} -d2 -m1 | ${EMITC} -l -s | \
73 -e 's/^static int g\[\]/static const signed char directive_g[]/' \
74 -e 's/^static int T0\[\]/static const u_char directive_T0[]/' \
75 -e 's/^static int T1\[\]/static const u_char directive_T1[]/' \
76 -e '/^#define uchar unsigned char/d' \
77 -e 's/uchar/u_char/g' \
78 -e 's/^hash(/directive_hash(/' \
79 -e 's/; \*kp;/; kp < key + len;/' \
80 -e 's/int len)/size_t len)/' \
81 -e 's/= T0\[/= directive_T0\[/' \
82 -e 's/= T1\[/= directive_T1\[/' \
83 -e 's/g\[f/directive_g[f/g' ; \
84 cat ${.CURDIR}/parse.c | sed \
85 -e '1,/KEYWORD-START-TAG/d' \
86 -e '/KEYWORD-END-TAG/,$$d' \
87 -e 's/^[^"]*"\([^"]*\)".*$$/\1/' | \
88 ${MPH} -d2 -m1 | ${EMITC} -l -s | \
90 -e 's/^static int g\[\]/static const signed char keyword_g[]/' \
91 -e 's/^static int T0\[\]/static const u_char keyword_T0[]/' \
92 -e 's/^static int T1\[\]/static const u_char keyword_T1[]/' \
93 -e '/^#define uchar unsigned char/d' \
94 -e 's/uchar/u_char/g' \
95 -e 's/^hash(/keyword_hash(/' \
96 -e 's/int len)/size_t len)/' \
97 -e 's/= T0\[/= keyword_T0\[/' \
98 -e 's/= T1\[/= keyword_T1\[/' \
99 -e 's/g\[f/keyword_g[f/g' \
100 ) > ${.CURDIR}/hash_tables.c
102 # Set the shell which make(1) uses. Bourne is the default, but a decent
103 # Korn shell works fine, and much faster. Using the C shell for this
104 # will almost certainly break everything, but it's Unix tradition to
105 # allow you to shoot yourself in the foot if you want to :-)
108 .if ${MAKE_SHELL} == "csh" || ${MAKE_SHELL} == "sh" || ${MAKE_SHELL} == "ksh"
109 CFLAGS+= -DDEFSHELLNAME=\"${MAKE_SHELL}\"
111 .error "MAKE_SHELL must be set to one of \"csh\", \"sh\" or \"ksh\"."
114 .include <bsd.prog.mk>