6acc4cdcdfcadd87e88cedc7a7f31d499411732b
[dragonfly.git] / bin / sh / Makefile
1 # Makefile for /bin/sh
2 #
3
4 PROG=   sh
5 INSTALLFLAGS= -S
6 SHSRCS= alias.c arith_yacc.c arith_yylex.c cd.c echo.c error.c eval.c \
7         exec.c expand.c \
8         histedit.c input.c jobs.c kill.c mail.c main.c memalloc.c miscbltin.c \
9         mystring.c options.c output.c parser.c printf.c redir.c \
10         test.c trap.c var.c
11 GENSRCS= builtins.c nodes.c syntax.c
12 GENHDRS= builtins.h nodes.h syntax.h token.h
13 SRCS= ${SHSRCS} ${GENSRCS} ${GENHDRS}
14
15 # would be needed if WARNS upgraded to 3, but lets keep the stderr output
16 # clean, so WARNS has been lowered to 2.
17 #
18 # NO_WERROR=    yes # [-Werror=clobbered] on gcc50
19 WARNS?= 2
20
21 # MLINKS for Shell built in commands for which there are no userland
22 # utilities of the same name are handled with the associated manpage,
23 # builtin.1 in share/man/man1/.
24
25 CFLAGS+=-DSHELL -I. -I${.CURDIR}
26 # for debug:
27 # DEBUG_FLAGS+= -g -DDEBUG=2 -fno-inline
28 # SHSRCS+=show.c
29
30 .if defined(BOOTSTRAPPING)
31 CFLAGS+= -DNO_HISTORY
32 # LIBEDIT is not needed here
33 .else
34 DPADD= ${LIBEDIT} ${LIBNCURSES}
35 LDADD= ${LIBEDIT} ${LIBNCURSES}
36 .endif
37
38
39 .PATH:  ${.CURDIR}/bltin \
40         ${.CURDIR}/../kill \
41         ${.CURDIR}/../test \
42         ${.CURDIR}/../../usr.bin/printf
43
44 #
45 # NOTE: the headers and sources in pregenerated/ must be updated upon any
46 # changes to the nodetypes nodes.c.pat mkbuiltins mknodes.c mksyntax.c mktokens
47 # files using following scripts and build programs.
48 #
49 .if 1 # not updating sh(1)
50 .PATH: ${.CURDIR}/pregenerated
51 CFLAGS+= -I${.CURDIR}/pregenerated
52 .else
53 CLEANFILES+= ${GENSRCS} ${GENHDRS}
54
55 .ORDER: builtins.c builtins.h
56 builtins.c builtins.h: mkbuiltins builtins.def
57         sh ${.CURDIR}/mkbuiltins ${.CURDIR}
58
59 # XXX this is just to stop the default .c rule being used, so that the
60 # intermediate object has a fixed name.
61 # XXX we have a default .c rule, but no default .o rule.
62 .o:
63         ${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
64
65 .ORDER: nodes.c nodes.h
66 nodes.c nodes.h: nodetypes nodes.c.pat
67         ${.OBJDIR}/mknodes/mknodes.nx ${.ALLSRC}
68
69 .ORDER: syntax.c syntax.h
70 syntax.c syntax.h:
71         ${.OBJDIR}/mksyntax/mksyntax.nx
72
73 token.h: mktokens
74         sh ${.CURDIR}/mktokens
75 .endif
76
77 regress: sh
78         cd ${.CURDIR}/../../tools/regression/bin/sh && ${MAKE} SH=${.OBJDIR}/sh
79 .include <bsd.prog.mk>