1#         $NetBSD: Makefile,v 1.39 2024/12/05 22:45:20 rillig Exp $
2
3WARNS=                        3
4CWARNFLAGS.clang+=  -Wno-error=cast-qual
5
6.include <bsd.own.mk>
7
8CPPFLAGS+=          -I.
9LINTFLAGS+=         -X 384    # function definition using identifier list
10
11PROG=     ksh
12SRCS=     alloc.c c_ksh.c c_sh.c c_test.c c_ulimit.c edit.c emacs.c \
13          eval.c exec.c expr.c history.c io.c jobs.c lex.c mail.c \
14          main.c misc.c path.c shf.c syn.c table.c trap.c tree.c tty.c \
15          var.c version.c vi.c
16DPSRCS=   emacs.out siglist.out
17.if ${MKMAN} != "no"
18DPSRCS+=ksh.1
19.endif
20
21USETBL=             # yes, needed for the man page.
22
23# Environment for scripts executed during build.
24SCRIPT_ENV= \
25          AWK=${TOOL_AWK:Q} \
26          SED=${TOOL_SED:Q}
27
28CLEANFILES+=        siglist.out siglist.out.tmp
29# two steps to prevent the creation of a bogus siglist.out
30siglist.out: config.h sh.h siglist.in siglist.sh
31          ${_MKTARGET_CREATE}
32          ${SCRIPT_ENV} \
33          ${HOST_SH} ${.CURDIR}/siglist.sh "${CC} -E ${CPPFLAGS} ${DEFS} \
34                    -I. -I${.CURDIR}" < ${.CURDIR}/siglist.in > siglist.out.tmp \
35              && mv siglist.out.tmp siglist.out
36
37# two steps to prevent the creation of a bogus emacs.out
38CLEANFILES+=        emacs.out emacs.out.tmp
39emacs.out: emacs.c
40          ${_MKTARGET_CREATE}
41          ${SCRIPT_ENV} \
42          ${HOST_SH} ${.CURDIR}/emacs-gen.sh ${.CURDIR}/emacs.c > emacs.out.tmp \
43              && mv emacs.out.tmp emacs.out
44
45CLEANFILES+=        ksh.1 ksh.1.tmp
46ksh.1: ksh.Man mkman
47          ${_MKTARGET_CREATE}
48          ${SCRIPT_ENV} \
49          ${HOST_SH} ${.CURDIR}/mkman ksh ${.CURDIR}/ksh.Man >ksh.1.tmp \
50              && mv ksh.1.tmp ksh.1
51
52COPTS+=   ${CC_WNO_IMPLICIT_FALLTHROUGH}
53
54.include <bsd.prog.mk>
55