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