btools: Do not link with LIBEDIT for bin/sh.
[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 show.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
29 .if defined(BOOTSTRAPPING)
30 CFLAGS+= -DNO_HISTORY
31 # LIBEDIT is not needed here
32 .else
33 DPADD= ${LIBEDIT} ${LIBNCURSES}
34 LDADD= -lprivate_edit -lprivate_ncurses
35 LDFLAGS+=       ${PRIVATELIB_LDFLAGS}
36 .endif
37
38
39 .PATH:  ${.CURDIR}/bltin \
40         ${.CURDIR}/../kill \
41         ${.CURDIR}/../test \
42         ${.CURDIR}/../../usr.bin/printf
43
44 CLEANFILES+= mknodes.nx mknodes.no \
45         mksyntax.nx mksyntax.no
46 CLEANFILES+= ${GENSRCS} ${GENHDRS}
47
48 build-tools: mknodes.nx mksyntax.nx
49
50 .ORDER: builtins.c builtins.h
51 builtins.c builtins.h: mkbuiltins builtins.def
52         sh ${.CURDIR}/mkbuiltins ${.CURDIR}
53
54 # XXX this is just to stop the default .c rule being used, so that the
55 # intermediate object has a fixed name.
56 # XXX we have a default .c rule, but no default .o rule.
57 .o:
58         ${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
59 mknodes.nx: mknodes.no
60 mksyntax.nx: mksyntax.no
61
62 .ORDER: nodes.c nodes.h
63 nodes.c nodes.h: mknodes.nx nodetypes nodes.c.pat
64         ./mknodes.nx ${.CURDIR}/nodetypes ${.CURDIR}/nodes.c.pat
65
66 .ORDER: syntax.c syntax.h
67 syntax.c syntax.h: mksyntax.nx
68         ./mksyntax.nx
69
70 token.h: mktokens
71         sh ${.CURDIR}/mktokens
72
73 regress: sh
74         cd ${.CURDIR}/../../tools/regression/bin/sh && ${MAKE} SH=${.OBJDIR}/sh
75 .include <bsd.prog.mk>