Add back .makenv compat until everyone's source tree is updated.
[dragonfly.git] / usr.bin / make / Makefile
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.19 2005/04/15 21:09:15 okumoto Exp $
4
5 PROG=   make
6 CFLAGS+=-I${.CURDIR}
7 SRCS=   arch.c buf.c compat.c cond.c dir.c for.c hash.c job.c lst.c main.c \
8         make.c parse.c str.c suff.c targ.c util.c var.c var_modify.c \
9         directive_hash.c
10
11 WARNS?= 6
12 NOSHARED?=      YES
13
14 CFLAGS+=-DMAKE_VERSION=\"5200408120\"
15
16 # There is no obvious performance improvement currently.
17 # CFLAGS+=-DUSE_KQUEUE
18
19 main.o: ${MAKEFILE}
20
21 # Directive table. We use a hash table. This hash table has been
22 # generated with mph which can be found on the usual GNU mirrors.
23 # If you change the directives (adding, deleting, reordering) you
24 # need to create a new table and hash function (directive_hash).
25 #
26 # The following changes have been made to the generated code:
27 #
28 #       o prefix the names of the g, T0 and T1 arrays with 'directive_'.
29 #
30 #       o make the type of the tables 'const [un]signed char' (if you change
31 #         anything make sure that the numbers fit into a char).
32 #
33 #       o make the hash function use the length for termination,
34 #         not the trailing '\0', via the -l flag in emitc and some editing.
35
36 LOCALBASE ?= /usr/local
37 MPH     ?= ${LOCALBASE}/bin/mph
38 EMITC   ?= ${LOCALBASE}/bin/emitc
39
40 .PRECIOUS:
41 hash:
42         echo '/*'                               > directive_hash.c
43         echo ' * DO NOT EDIT'                   >> directive_hash.c
44         echo ' * $$DragonFly: src/usr.bin/make/Makefile,v 1.19 2005/04/15 21:09:15 okumoto Exp $$'                      >> directive_hash.c
45         echo -n ' * auto-generated from '       >> directive_hash.c
46         sed -nEe '/\$$(DragonFly)|(FreeBSD)/s/^.*\$$(.*)\$$.*$$/\1/p' \
47                 ${.CURDIR}/parse.c >>directive_hash.c
48         echo ' * DO NOT EDIT'                   >> directive_hash.c
49         echo ' */'                              >> directive_hash.c
50         echo '#include <sys/types.h>'           >> directive_hash.c
51         echo ''                                 >> directive_hash.c
52         echo '#include "directive_hash.h"'      >> directive_hash.c
53         echo ''                                 >> directive_hash.c
54         cat ${.CURDIR}/parse.c | sed \
55             -e '1,/DIRECTIVES-START-TAG/d' -e '/DIRECTIVES-END-TAG/,$$d' \
56             -e 's/^[^"]*"\([^"]*\)".*$$/\1/' |\
57             ${MPH} -d2 -m1 | ${EMITC} -l -s |\
58             sed \
59             -e 's/^static int g\[\]/static const signed char directive_g[]/' \
60             -e 's/^static int T0\[\]/static const u_char directive_T0[]/' \
61             -e 's/^static int T1\[\]/static const u_char directive_T1[]/' \
62             -e '/^#define uchar unsigned char/d' \
63             -e 's/uchar/u_char/g' \
64             -e 's/^hash(/directive_hash(/' \
65             -e 's/; \*kp;/; kp < key + len;/' \
66             -e 's/int len)/size_t len)/' \
67             -e 's/= T0\[/= directive_T0\[/' \
68             -e 's/= T1\[/= directive_T1\[/' \
69             -e 's/g\[f/directive_g[f/g' \
70             >> directive_hash.c
71
72 # Set the shell which make(1) uses.  Bourne is the default, but a decent
73 # Korn shell works fine, and much faster.  Using the C shell for this
74 # will almost certainly break everything, but it's Unix tradition to
75 # allow you to shoot yourself in the foot if you want to :-)
76
77 MAKE_SHELL?=    sh
78 .if ${MAKE_SHELL} == "csh"
79 CFLAGS+=        -DDEFSHELL=0
80 .elif ${MAKE_SHELL} == "sh"
81 CFLAGS+=        -DDEFSHELL=1
82 .elif ${MAKE_SHELL} == "ksh"
83 CFLAGS+=        -DDEFSHELL=2
84 .else
85 .error "MAKE_SHELL must be set to one of \"csh\", \"sh\" or \"ksh\"."
86 .endif
87
88 .include <bsd.prog.mk>