xref: /freebsd/bin/sh/Makefile (revision 2be1a816b9ff69588e55be0a84cbe2a31efc0f2f)
1#	@(#)Makefile	8.4 (Berkeley) 5/5/95
2# $FreeBSD$
3
4PROG=	sh
5INSTALLFLAGS= -S
6SHSRCS=	alias.c arith.y arith_lex.l cd.c echo.c error.c eval.c exec.c expand.c \
7	histedit.c input.c jobs.c mail.c main.c memalloc.c miscbltin.c \
8	mystring.c options.c output.c parser.c redir.c show.c \
9	test.c trap.c var.c
10GENSRCS= builtins.c init.c nodes.c syntax.c
11GENHDRS= builtins.h nodes.h syntax.h token.h
12SRCS= ${SHSRCS} ${GENSRCS} ${GENHDRS} y.tab.h
13
14# MLINKS for Shell built in commands for which there are no userland
15# utilities of the same name are handled with the associated manpage,
16# builtin.1 in share/man/man1/.
17
18DPADD= ${LIBL} ${LIBEDIT} ${LIBTERMCAP}
19LDADD= -ll -ledit -ltermcap
20
21LFLAGS= -8	# 8-bit lex scanner for arithmetic
22CFLAGS+=-DSHELL -I. -I${.CURDIR}
23# for debug:
24# CFLAGS+= -g -DDEBUG=2
25WARNS?=	2
26WFORMAT=0
27
28.PATH:	${.CURDIR}/bltin \
29	${.CURDIR}/../../bin/test
30
31CLEANFILES+= mkinit mkinit.o mknodes mknodes.o \
32	mksyntax mksyntax.o
33CLEANFILES+= ${GENSRCS} ${GENHDRS}
34
35build-tools: mkinit mknodes mksyntax
36
37.ORDER: builtins.c builtins.h
38builtins.c builtins.h: mkbuiltins builtins.def
39	cd ${.CURDIR}; sh mkbuiltins ${.OBJDIR}
40
41init.c: mkinit alias.c eval.c exec.c input.c jobs.c options.c parser.c \
42	redir.c trap.c var.c
43	./mkinit ${.ALLSRC:S/^mkinit$//}
44
45# XXX this is just to stop the default .c rule being used, so that the
46# intermediate object has a fixed name.
47# XXX we have a default .c rule, but no default .o rule.
48.o:
49	${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
50mkinit: mkinit.o
51mknodes: mknodes.o
52mksyntax: mksyntax.o
53
54.ORDER: nodes.c nodes.h
55nodes.c nodes.h: mknodes nodetypes nodes.c.pat
56	./mknodes ${.CURDIR}/nodetypes ${.CURDIR}/nodes.c.pat
57
58.ORDER: syntax.c syntax.h
59syntax.c syntax.h: mksyntax
60	./mksyntax
61
62token.h: mktokens
63	sh ${.CURDIR}/mktokens
64
65.include <bsd.prog.mk>
66