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