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