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