1 # @(#)Makefile 5.2 (Berkeley) 12/28/90
2 # $FreeBSD: src/usr.bin/make/Makefile,v 1.13.2.1 2001/05/25 08:33:40 sobomax Exp $
3 # $DragonFly: src/usr.bin/make/Makefile,v 1.30 2005/05/23 18:24:59 okumoto Exp $
7 SRCS= arch.c buf.c cond.c dir.c for.c hash.c hash_tables.c job.c \
8 lst.c main.c make.c parse.c proc.c shell.c str.c suff.c targ.c \
15 CFLAGS+=-DMAKE_VERSION=\"5200408120\"
17 # There is no obvious performance improvement currently.
18 # CFLAGS+=-DUSE_KQUEUE
22 # Directive and keyword tables. We use hash tables. These hash tables have been
23 # generated with mph which can be found on the usual GNU mirrors.
24 # If you change the directives or keywords (adding, deleting, reordering) you
25 # need to create new tables and hash functions (directive_hash, keyword_hash).
27 # The following changes have been made to the generated code:
29 # o prefix the names of the g, T0 and T1 arrays with 'directive_'
32 # o make the type of the tables 'const [un]signed char' (if you change
33 # anything make sure that the numbers fit into a char).
35 # o make the hash function use the length for termination,
36 # not the trailing '\0', via the -l flag in emitc and some editing
37 # (only for directive_hash).
39 LOCALBASE ?= /usr/local
40 MPH ?= ${LOCALBASE}/bin/mph
41 EMITC ?= ${LOCALBASE}/bin/emitc
47 echo ' * DO NOT EDIT' ; \
48 echo ' * $$''DragonFly$$' ; \
49 echo -n ' * auto-generated from ' ; \
50 echo ${.CURDIR}/parse.c ; \
51 echo ' * DO NOT EDIT' ; \
53 echo '#include <sys/types.h>' ; \
55 echo '#include "hash_tables.h"' ; \
57 cat ${.CURDIR}/parse.c | sed \
58 -e '1,/DIRECTIVES-START-TAG/d' \
59 -e '/DIRECTIVES-END-TAG/,$$d' \
60 -e 's/^[^"]*"\([^"]*\)".*$$/\1/' | \
61 ${MPH} -d2 -m1 | ${EMITC} -l -s | \
63 -e 's/^static int g\[\]/static const signed char directive_g[]/' \
64 -e 's/^static int T0\[\]/static const u_char directive_T0[]/' \
65 -e 's/^static int T1\[\]/static const u_char directive_T1[]/' \
66 -e '/^#define uchar unsigned char/d' \
67 -e 's/uchar/u_char/g' \
68 -e 's/^hash(/directive_hash(/' \
69 -e 's/; \*kp;/; kp < key + len;/' \
70 -e 's/int len)/size_t len)/' \
71 -e 's/= T0\[/= directive_T0\[/' \
72 -e 's/= T1\[/= directive_T1\[/' \
73 -e 's/g\[f/directive_g[f/g' ; \
74 cat ${.CURDIR}/parse.c | sed \
75 -e '1,/KEYWORD-START-TAG/d' \
76 -e '/KEYWORD-END-TAG/,$$d' \
77 -e 's/^[^"]*"\([^"]*\)".*$$/\1/' | \
78 ${MPH} -d2 -m1 | ${EMITC} -l -s | \
80 -e 's/^static int g\[\]/static const signed char keyword_g[]/' \
81 -e 's/^static int T0\[\]/static const u_char keyword_T0[]/' \
82 -e 's/^static int T1\[\]/static const u_char keyword_T1[]/' \
83 -e '/^#define uchar unsigned char/d' \
84 -e 's/uchar/u_char/g' \
85 -e 's/^hash(/keyword_hash(/' \
86 -e 's/int len)/size_t len)/' \
87 -e 's/= T0\[/= keyword_T0\[/' \
88 -e 's/= T1\[/= keyword_T1\[/' \
89 -e 's/g\[f/keyword_g[f/g' \
90 ) > ${.CURDIR}/hash_tables.c
92 # Set the shell which make(1) uses. Bourne is the default, but a decent
93 # Korn shell works fine, and much faster. Using the C shell for this
94 # will almost certainly break everything, but it's Unix tradition to
95 # allow you to shoot yourself in the foot if you want to :-)
98 .if ${MAKE_SHELL} == "csh"
99 CFLAGS+= -DDEFSHELLNAME=\"${MAKE_SHELL}\"
100 .elif ${MAKE_SHELL} == "sh"
101 CFLAGS+= -DDEFSHELLNAME=\"${MAKE_SHELL}\"
102 .elif ${MAKE_SHELL} == "ksh"
103 CFLAGS+= -DDEFSHELLNAME=\"${MAKE_SHELL}\"
105 .error "MAKE_SHELL must be set to one of \"csh\", \"sh\" or \"ksh\"."
108 .include <bsd.prog.mk>