Makefile revision 150601
1193579Sraj# @(#)Makefile 5.2 (Berkeley) 12/28/90 2193579Sraj# $Id: Makefile,v 1.6 1994/06/30 05:33:39 cgd Exp $ 3193579Sraj# $FreeBSD: head/usr.bin/make/Makefile 150601 2005-09-26 22:07:59Z phk $ 4193579Sraj 5193579SrajPROG= make 6193579SrajCFLAGS+=-I${.CURDIR} 7193579SrajSRCS= arch.c buf.c cond.c dir.c for.c hash.c hash_tables.c job.c \ 8193579Sraj lst.c main.c make.c parse.c proc.c shell.c str.c suff.c targ.c \ 9193579Sraj util.c var.c 10193579Sraj 11193579SrajNO_WERROR= 12193579SrajWARNS?= 6 13193579SrajNO_SHARED?= YES 14193579Sraj 15193579SrajCFLAGS+=-DMAKE_VERSION=\"5200408120\" 16193579Sraj.if defined(_UPGRADING) 17193579SrajCFLAGS+=-D__FBSDID=__RCSID 18193579Sraj.endif 19193579Sraj 20193579Sraj# There is no obvious performance improvement currently. 21193579Sraj# CFLAGS+=-DUSE_KQUEUE 22193579Sraj 23193579Sraj# Make object files which depend on preprocessor symbols defined in 24193579Sraj# the Makefile which are not compilation options but rather configuration 25193579Sraj# options dependend on the Makefile. main.c needs MAKE_VERSION while 26193579Sraj# shell.c uses DEFSHELLNAME. This will cause recompilation in the case 27193579Sraj# the definition is changed in the makefile. It will of course not cause 28193579Sraj# recompilation if one does 'make MAKE_SHELL=csh'. 29193579Srajmain.o shell.o: ${MAKEFILE} 30193579Sraj 31193579Sraj# Directive and keyword tables. We use hash tables. These hash tables have been 32193579Sraj# generated with mph (ports/devel/mph) 33193579Sraj# If you change the directives or keywords (adding, deleting, reordering) you 34193579Sraj# need to create new tables and hash functions (directive_hash, keyword_hash). 35193579Sraj# 36193579Sraj# The following changes have been made to the generated code: 37193579Sraj# 38193579Sraj# o prefix the names of the g, T0 and T1 arrays with 'directive_' 39193579Sraj# resp. 'keyword_'. 40193579Sraj# 41193579Sraj# o make the type of the tables 'const [un]signed char' (if you change 42193579Sraj# anything make sure that the numbers fit into a char). 43193579Sraj# 44193579Sraj# o make the hash function use the length for termination, 45193579Sraj# not the trailing '\0', via the -l flag in emitc and some editing 46193579Sraj# (only for directive_hash). 47193579Sraj 48193579SrajLOCALBASE ?= /usr/local 49193579SrajMPH ?= ${LOCALBASE}/bin/mph 50193579SrajEMITC ?= ${LOCALBASE}/bin/emitc 51193579Sraj 52193579Sraj.PRECIOUS: hash 53193579Sraj 54193579Srajhash: 55193579Sraj ( echo '/*' ; \ 56193579Sraj echo ' * DO NOT EDIT' ; \ 57193579Sraj echo ' * $$''FreeBSD$$' ; \ 58193579Sraj echo -n ' * auto-generated from ' ; \ 59193579Sraj sed -nEe '/\$$FreeBSD/s/^.*\$$(.*)\$$.*$$/\1/p' \ 60193579Sraj ${.CURDIR}/parse.c ; \ 61193579Sraj echo ' * DO NOT EDIT' ; \ 62193579Sraj echo ' */' ; \ 63193579Sraj echo '#include <sys/types.h>' ; \ 64193579Sraj echo ; \ 65193579Sraj echo '#include "hash_tables.h"' ; \ 66193579Sraj echo ; \ 67193579Sraj cat ${.CURDIR}/parse.c | sed \ 68193579Sraj -e '1,/DIRECTIVES-START-TAG/d' \ 69193579Sraj -e '/DIRECTIVES-END-TAG/,$$d' \ 70193579Sraj -e 's/^[^"]*"\([^"]*\)".*$$/\1/' | \ 71193579Sraj ${MPH} -d2 -m1 | ${EMITC} -l -s | \ 72193579Sraj sed \ 73193579Sraj -e 's/^static int g\[\]/static const signed char directive_g[]/' \ 74193579Sraj -e 's/^static int T0\[\]/static const u_char directive_T0[]/' \ 75193579Sraj -e 's/^static int T1\[\]/static const u_char directive_T1[]/' \ 76193579Sraj -e '/^#define uchar unsigned char/d' \ 77193579Sraj -e 's/uchar/u_char/g' \ 78193579Sraj -e 's/^hash(/directive_hash(/' \ 79193579Sraj -e 's/; \*kp;/; kp < key + len;/' \ 80193579Sraj -e 's/int len)/size_t len)/' \ 81193579Sraj -e 's/= T0\[/= directive_T0\[/' \ 82193579Sraj -e 's/= T1\[/= directive_T1\[/' \ 83193579Sraj -e 's/g\[f/directive_g[f/g' ; \ 84193579Sraj cat ${.CURDIR}/parse.c | sed \ 85193579Sraj -e '1,/KEYWORD-START-TAG/d' \ 86193579Sraj -e '/KEYWORD-END-TAG/,$$d' \ 87193579Sraj -e 's/^[^"]*"\([^"]*\)".*$$/\1/' | \ 88193579Sraj ${MPH} -d2 -m1 | ${EMITC} -l -s | \ 89193579Sraj sed \ 90193579Sraj -e 's/^static int g\[\]/static const signed char keyword_g[]/' \ 91193579Sraj -e 's/^static int T0\[\]/static const u_char keyword_T0[]/' \ 92193579Sraj -e 's/^static int T1\[\]/static const u_char keyword_T1[]/' \ 93193579Sraj -e '/^#define uchar unsigned char/d' \ 94193579Sraj -e 's/uchar/u_char/g' \ 95193579Sraj -e 's/^hash(/keyword_hash(/' \ 96193579Sraj -e 's/int len)/size_t len)/' \ 97193579Sraj -e 's/= T0\[/= keyword_T0\[/' \ 98193579Sraj -e 's/= T1\[/= keyword_T1\[/' \ 99193579Sraj -e 's/g\[f/keyword_g[f/g' \ 100193579Sraj ) > ${.CURDIR}/hash_tables.c 101193579Sraj 102193579Sraj# Set the shell which make(1) uses. Bourne is the default, but a decent 103193579Sraj# Korn shell works fine, and much faster. Using the C shell for this 104193579Sraj# will almost certainly break everything, but it's Unix tradition to 105193579Sraj# allow you to shoot yourself in the foot if you want to :-) 106193579Sraj 107193579SrajMAKE_SHELL?= sh 108193579Sraj.if ${MAKE_SHELL} == "csh" || ${MAKE_SHELL} == "sh" || ${MAKE_SHELL} == "ksh" 109193579SrajCFLAGS+= -DDEFSHELLNAME=\"${MAKE_SHELL}\" 110193579Sraj.else 111193579Sraj.error "MAKE_SHELL must be set to one of \"csh\", \"sh\" or \"ksh\"." 112193579Sraj.endif 113193579Sraj 114193579Sraj.include <bsd.prog.mk> 115193579Sraj