privatize libedit (used by numerous base programs)
[dragonfly.git] / bin / sh / Makefile
blob9a16db48bc77ee2ffbfadda61d45b2e2e9ccb21d
1 # Makefile for /bin/sh
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}
15 # would be needed if WARNS upgraded to 3, but lets keep the stderr output
16 # clean, so WARNS has been lowered to 2.
18 # NO_WERROR= yes # [-Werror=clobbered] on gcc50
19 WARNS?= 2
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/.
25 CFLAGS+=-DSHELL -I. -I${.CURDIR}
26 # for debug:
27 # DEBUG_FLAGS+= -g -DDEBUG=2 -fno-inline
29 .if defined(BOOTSTRAPPING)
30 CFLAGS+= -DNO_HISTORY
31 . if exists(/usr/lib/libedit.a)
32 DPADD= /usr/lib/libedit.a ${LIBTERMCAP}
33 LDADD= -ledit -ltermcap
34 . else
35 DPADD= ${LIBEDIT} ${LIBTERMCAP}
36 LDADD= -lprivate_edit -ltermcap
37 . endif
38 .else
39 DPADD= ${LIBEDIT} ${LIBTERMCAP}
40 LDADD= -lprivate_edit -ltermcap
41 .endif
43 .PATH: ${.CURDIR}/bltin \
44 ${.CURDIR}/../kill \
45 ${.CURDIR}/../test \
46 ${.CURDIR}/../../usr.bin/printf
48 CLEANFILES+= mknodes.nx mknodes.no \
49 mksyntax.nx mksyntax.no
50 CLEANFILES+= ${GENSRCS} ${GENHDRS}
52 build-tools: mknodes.nx mksyntax.nx
54 .ORDER: builtins.c builtins.h
55 builtins.c builtins.h: mkbuiltins builtins.def
56 sh ${.CURDIR}/mkbuiltins ${.CURDIR}
58 # XXX this is just to stop the default .c rule being used, so that the
59 # intermediate object has a fixed name.
60 # XXX we have a default .c rule, but no default .o rule.
61 .o:
62 ${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
63 mknodes.nx: mknodes.no
64 mksyntax.nx: mksyntax.no
66 .ORDER: nodes.c nodes.h
67 nodes.c nodes.h: mknodes.nx nodetypes nodes.c.pat
68 ./mknodes.nx ${.CURDIR}/nodetypes ${.CURDIR}/nodes.c.pat
70 .ORDER: syntax.c syntax.h
71 syntax.c syntax.h: mksyntax.nx
72 ./mksyntax.nx
74 token.h: mktokens
75 sh ${.CURDIR}/mktokens
77 regress: sh
78 cd ${.CURDIR}/../../tools/regression/bin/sh && ${MAKE} SH=${.OBJDIR}/sh
79 .include <bsd.prog.mk>