Merge from vendor branch LIBARCHIVE:
[dragonfly.git] / usr.bin / make / Makefile
1 .INTERRUPT:
2         echo Hey that hurt!
3 #       @(#)Makefile    5.2 (Berkeley) 12/28/90
4 # $FreeBSD: src/usr.bin/make/Makefile,v 1.13.2.1 2001/05/25 08:33:40 sobomax Exp $
5 # $DragonFly: src/usr.bin/make/Makefile,v 1.37 2007/08/27 16:50:56 pavalos Exp $
6
7 PROG=   make
8 CFLAGS+=-I${.CURDIR}
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  \
11         util.c var.c
12
13 WARNS_WERROR=   YES
14 NOSHARED?=      YES
15
16 CFLAGS+=-DMAKE_VERSION=\"5200408120\"
17
18 # Make object files which depend on preprocessor symbols defined
19 # in the Makefile which are not compilation options but rather
20 # configuration options dependend on the Makefile. main.c needs
21 # MAKE_VERSION, and DEFSHELLNAME.  This will cause recompilation
22 # in the case the definition is changed in the makefile. It will
23 # of course not cause recompilation if one does 'make MAKE_SHELL=csh'.
24 main.o: ${MAKEFILE}
25
26 # Directive and keyword tables. We use hash tables. These hash tables have been
27 # generated with mph which can be found on the usual GNU mirrors.
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 ' * $$''DragonFly$$' ;                                   \
53           echo -n ' * auto-generated from ' ;                           \
54           echo ${.CURDIR}/parse.c ;                                     \
55           echo ' * DO NOT EDIT' ;                                       \
56           echo ' */' ;                                                  \
57           echo '#include <sys/types.h>' ;                               \
58           echo ;                                                        \
59           echo '#include "hash_tables.h"' ;                             \
60           echo ;                                                        \
61           cat ${.CURDIR}/parse.c | sed                                  \
62             -e '1,/DIRECTIVES-START-TAG/d'                              \
63             -e '/DIRECTIVES-END-TAG/,$$d'                               \
64             -e 's/^[^"]*"\([^"]*\)".*$$/\1/' |                          \
65             ${MPH} -d2 -m1 | ${EMITC} -l -s |                           \
66             sed                                                         \
67             -e 's/^static int g\[\]/static const signed char directive_g[]/' \
68             -e 's/^static int T0\[\]/static const u_char directive_T0[]/' \
69             -e 's/^static int T1\[\]/static const u_char directive_T1[]/' \
70             -e '/^#define uchar unsigned char/d'                        \
71             -e 's/uchar/u_char/g'                                       \
72             -e 's/^hash(/directive_hash(/'                              \
73             -e 's/; \*kp;/; kp < key + len;/'                           \
74             -e 's/int len)/size_t len)/'                                \
75             -e 's/= T0\[/= directive_T0\[/'                             \
76             -e 's/= T1\[/= directive_T1\[/'                             \
77             -e 's/g\[f/directive_g[f/g' ;                               \
78           cat ${.CURDIR}/parse.c | sed                                  \
79             -e '1,/KEYWORD-START-TAG/d'                                 \
80             -e '/KEYWORD-END-TAG/,$$d'                                  \
81             -e 's/^[^"]*"\([^"]*\)".*$$/\1/' |                          \
82             ${MPH} -d2 -m1 | ${EMITC} -l -s |                           \
83             sed                                                         \
84             -e 's/^static int g\[\]/static const signed char keyword_g[]/' \
85             -e 's/^static int T0\[\]/static const u_char keyword_T0[]/' \
86             -e 's/^static int T1\[\]/static const u_char keyword_T1[]/' \
87             -e '/^#define uchar unsigned char/d'                        \
88             -e 's/uchar/u_char/g'                                       \
89             -e 's/^hash(/keyword_hash(/'                                \
90             -e 's/int len)/size_t len)/'                                \
91             -e 's/= T0\[/= keyword_T0\[/'                               \
92             -e 's/= T1\[/= keyword_T1\[/'                               \
93             -e 's/g\[f/keyword_g[f/g'                                   \
94         ) > ${.CURDIR}/hash_tables.c
95
96 # Set the shell which make(1) uses.  Bourne is the default, but a decent
97 # Korn shell works fine, and much faster.  Using the C shell for this
98 # will almost certainly break everything, but it's Unix tradition to
99 # allow you to shoot yourself in the foot if you want to :-)
100
101 MAKE_SHELL?=    sh
102 .if ${MAKE_SHELL} == "csh" || ${MAKE_SHELL} == "sh" || ${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>