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