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 CFLAGS+=-DMAKE_VERSION=\"5200408120\"
18 # There is no obvious performance improvement currently.
19 # CFLAGS+=-DUSE_KQUEUE
21 # Make object files which depend on preprocessor symbols defined in
22 # the Makefile which are not compilation options but rather configuration
23 # options dependend on the Makefile. main.c needs MAKE_VERSION while
24 # shell.c uses DEFSHELLNAME. This will cause recompilation in the case
25 # the definition is changed in the makefile. It will of course not cause
26 # recompilation if one does 'make MAKE_SHELL=csh'.
27 main.o shell.o: ${MAKEFILE}
29 # Directive and keyword tables. We use hash tables. These hash tables have been
30 # generated with mph (ports/devel/mph)
31 # If you change the directives or keywords (adding, deleting, reordering) you
32 # need to create new tables and hash functions (directive_hash, keyword_hash).
34 # The following changes have been made to the generated code:
36 # o prefix the names of the g, T0 and T1 arrays with 'directive_'
39 # o make the type of the tables 'const [un]signed char' (if you change
40 # anything make sure that the numbers fit into a char).
42 # o make the hash function use the length for termination,
43 # not the trailing '\0', via the -l flag in emitc and some editing
44 # (only for directive_hash).
46 LOCALBASE ?= /usr/local
47 MPH ?= ${LOCALBASE}/bin/mph
48 EMITC ?= ${LOCALBASE}/bin/emitc
54 echo ' * DO NOT EDIT' ; \
55 echo ' * $$''FreeBSD$$' ; \
56 echo -n ' * auto-generated from ' ; \
57 sed -nEe '/\$$FreeBSD/s/^.*\$$(.*)\$$.*$$/\1/p' \
58 ${.CURDIR}/parse.c ; \
59 echo ' * DO NOT EDIT' ; \
61 echo '#include <sys/types.h>' ; \
63 echo '#include "hash_tables.h"' ; \
65 cat ${.CURDIR}/parse.c | sed \
66 -e '1,/DIRECTIVES-START-TAG/d' \
67 -e '/DIRECTIVES-END-TAG/,$$d' \
68 -e 's/^[^"]*"\([^"]*\)".*$$/\1/' | \
69 ${MPH} -d2 -m1 | ${EMITC} -l -s | \
71 -e 's/^static int g\[\]/static const signed char directive_g[]/' \
72 -e 's/^static int T0\[\]/static const u_char directive_T0[]/' \
73 -e 's/^static int T1\[\]/static const u_char directive_T1[]/' \
74 -e '/^#define uchar unsigned char/d' \
75 -e 's/uchar/u_char/g' \
76 -e 's/^hash(/directive_hash(/' \
77 -e 's/; \*kp;/; kp < key + len;/' \
78 -e 's/int len)/size_t len)/' \
79 -e 's/= T0\[/= directive_T0\[/' \
80 -e 's/= T1\[/= directive_T1\[/' \
81 -e 's/g\[f/directive_g[f/g' ; \
82 cat ${.CURDIR}/parse.c | sed \
83 -e '1,/KEYWORD-START-TAG/d' \
84 -e '/KEYWORD-END-TAG/,$$d' \
85 -e 's/^[^"]*"\([^"]*\)".*$$/\1/' | \
86 ${MPH} -d2 -m1 | ${EMITC} -l -s | \
88 -e 's/^static int g\[\]/static const signed char keyword_g[]/' \
89 -e 's/^static int T0\[\]/static const u_char keyword_T0[]/' \
90 -e 's/^static int T1\[\]/static const u_char keyword_T1[]/' \
91 -e '/^#define uchar unsigned char/d' \
92 -e 's/uchar/u_char/g' \
93 -e 's/^hash(/keyword_hash(/' \
94 -e 's/int len)/size_t len)/' \
95 -e 's/= T0\[/= keyword_T0\[/' \
96 -e 's/= T1\[/= keyword_T1\[/' \
97 -e 's/g\[f/keyword_g[f/g' \
98 ) > ${.CURDIR}/hash_tables.c
100 # Set the shell which make(1) uses. Bourne is the default, but a decent
101 # Korn shell works fine, and much faster. Using the C shell for this
102 # will almost certainly break everything, but it's Unix tradition to
103 # allow you to shoot yourself in the foot if you want to :-)
106 .if ${MAKE_SHELL} == "csh" || ${MAKE_SHELL} == "sh" || ${MAKE_SHELL} == "ksh"
107 CFLAGS+= -DDEFSHELLNAME=\"${MAKE_SHELL}\"
109 .error "MAKE_SHELL must be set to one of \"csh\", \"sh\" or \"ksh\"."
112 .include <bsd.prog.mk>