Move ProcExec() into proc.c
[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.30 2005/05/23 18:24:59 okumoto Exp $
4
5 PROG=   make
6 CFLAGS+=-I${.CURDIR}
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  \
9         util.c var.c
10
11 WARNS?= 6
12 WARNS_WERROR=   YES
13 NOSHARED?=      YES
14
15 CFLAGS+=-DMAKE_VERSION=\"5200408120\"
16
17 # There is no obvious performance improvement currently.
18 # CFLAGS+=-DUSE_KQUEUE
19
20 main.o: ${MAKEFILE}
21
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).
26 #
27 # The following changes have been made to the generated code:
28 #
29 #       o prefix the names of the g, T0 and T1 arrays with 'directive_'
30 #         resp. 'keyword_'.
31 #
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).
34 #
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).
38
39 LOCALBASE ?= /usr/local
40 MPH     ?= ${LOCALBASE}/bin/mph
41 EMITC   ?= ${LOCALBASE}/bin/emitc
42
43 .PRECIOUS: hash
44
45 hash:
46         ( echo '/*' ;                                                   \
47           echo ' * DO NOT EDIT' ;                                       \
48           echo ' * $$''DragonFly$$' ;                                   \
49           echo -n ' * auto-generated from ' ;                           \
50           echo ${.CURDIR}/parse.c ;                                     \
51           echo ' * DO NOT EDIT' ;                                       \
52           echo ' */' ;                                                  \
53           echo '#include <sys/types.h>' ;                               \
54           echo ;                                                        \
55           echo '#include "hash_tables.h"' ;                             \
56           echo ;                                                        \
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 |                           \
62             sed                                                         \
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 |                           \
79             sed                                                         \
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
91
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 :-)
96
97 MAKE_SHELL?=    sh
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}\"
104 .else
105 .error "MAKE_SHELL must be set to one of \"csh\", \"sh\" or \"ksh\"."
106 .endif
107
108 .include <bsd.prog.mk>