Initial import from FreeBSD RELENG_4:
[dragonfly.git] / bin / sh / Makefile
1 #       @(#)Makefile    8.4 (Berkeley) 5/5/95
2 # $FreeBSD: src/bin/sh/Makefile,v 1.30.2.1 2001/12/15 10:05:18 knu Exp $
3
4 PROG=   sh
5 SHSRCS= 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 printf.c redir.c show.c \
8         test.c trap.c var.c
9 GENSRCS= builtins.c init.c nodes.c syntax.c
10 GENHDRS= builtins.h nodes.h syntax.h token.h y.tab.h
11 SRCS= ${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
17 DPADD+= ${LIBL} ${LIBEDIT} ${LIBTERMCAP}
18 LDADD+= -ll -ledit -ltermcap
19
20 LFLAGS= -8      # 8-bit lex scanner for arithmetic
21 CFLAGS+=-DSHELL -I. -I${.CURDIR}
22 # for debug:
23 # CFLAGS+= -g -DDEBUG=2
24
25 .PATH:  ${.CURDIR}/bltin \
26         ${.CURDIR}/../../usr.bin/printf \
27         ${.CURDIR}/../../bin/test
28
29 CLEANFILES+= mkinit mkinit.o mknodes mknodes.o \
30         mksyntax mksyntax.o
31 CLEANFILES+= ${GENSRCS} ${GENHDRS}
32
33 build-tools: mkinit mknodes mksyntax
34
35 .ORDER: builtins.c builtins.h
36 builtins.c builtins.h: mkbuiltins builtins.def
37         cd ${.CURDIR}; sh mkbuiltins ${.OBJDIR}
38
39 init.c: mkinit alias.c eval.c exec.c input.c jobs.c options.c parser.c \
40         redir.c trap.c var.c
41         ./mkinit ${.ALLSRC:S/^mkinit$//}
42
43 # XXX this is just to stop the default .c rule being used, so that the
44 # intermediate object has a fixed name.
45 # XXX we have a default .c rule, but no default .o rule.
46 .o:
47         ${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
48 mkinit: mkinit.o
49 mknodes: mknodes.o
50 mksyntax: mksyntax.o
51
52 .ORDER: nodes.c nodes.h
53 nodes.c nodes.h: mknodes nodetypes nodes.c.pat
54         ./mknodes ${.CURDIR}/nodetypes ${.CURDIR}/nodes.c.pat
55
56 .ORDER: syntax.c syntax.h
57 syntax.c syntax.h: mksyntax
58         ./mksyntax
59
60 token.h: mktokens
61         sh ${.CURDIR}/mktokens
62
63 .include <bsd.prog.mk>