1#         $NetBSD: Makefile,v 1.24 2024/05/20 09:48:42 martin Exp $
2
3.include <bsd.own.mk>
4
5USE_SHLIBDIR=       yes
6
7LIB=                terminfo
8WARNS?=             5
9
10CPPFLAGS+=          -I${.CURDIR}
11
12SRCS=               term.c ti.c setupterm.c curterm.c tparm.c tputs.c
13SRCS+=              hash.c
14INCS=               term.h
15INCSDIR=  /usr/include
16
17# For ramdisks there is no database to read from so remove compat
18# and the need to read from them.
19# While here, remove the ability to compile terminfo descriptions
20# from $TERMINFO as well.
21# This means the library requires any terminal needed built into it.
22.if !defined(SMALLPROG)
23CPPFLAGS+=          -DTERMINFO_COMPILE -DTERMINFO_DB -DTERMINFO_COMPAT
24SRCS+=              compile.c
25.endif
26
27COPTS.tparm.c = -Wno-format-nonliteral
28
29MAN=                terminfo.3 terminfo.5
30MLINKS=             terminfo.3 setupterm.3 \
31                    terminfo.3 set_curterm.3 terminfo.3 del_curterm.3 \
32                    terminfo.3 termname.3 terminfo.3 longname.3 \
33                    terminfo.3 tigetnum.3 terminfo.3 tigetflag.3 \
34                    terminfo.3 tigetstr.3 terminfo.3 tparm.3 terminfo.3 tputs.3 \
35                    terminfo.3 putp.3 \
36                    terminfo.3 ti_setupterm.3 terminfo.3 ti_getflag.3 \
37                    terminfo.3 ti_getnum.3 terminfo.3 ti_getstr.3 \
38                    terminfo.3 tiparm.3 terminfo.3 ti_tiparm.3 \
39                    terminfo.3 ti_puts.3 terminfo.3 ti_putp.3
40
41# Build in termcap emulation
42SRCS+=              termcap.c
43INCS+=              termcap.h
44MAN+=               termcap.3
45MLINKS+=  termcap.3 tgetent.3 termcap.3 tgetflag.3 termcap.3 tgetnum.3 \
46                    termcap.3 tgetstr.3 termcap.3 tgoto.3
47
48CPPFLAGS+=          -I${.OBJDIR}
49
50.include "Makefile.hash"
51
52# Generate our man pages
53terminfo.5: genman terminfo.5.in term.h termcap_map.c
54                    @echo "Generating terminfo man pages"
55                    ${SCRIPT_ENV} ${HOST_SH} ${.ALLSRC} > ${.TARGET}
56
57CLEANFILES+=        terminfo.5
58
59man: terminfo.5
60
61.include <bsd.shlib.mk>
62
63.if ${MKLINKLIB} != "no"
64SYMLINKS+=          libterminfo.a ${LIBDIR}/libtermcap.a
65SYMLINKS+=          libterminfo.a ${LIBDIR}/libtermlib.a
66.endif
67
68.if ${MKPROFILE} != "no"
69SYMLINKS+=          libterminfo_p.a ${LIBDIR}/libtermcap_p.a
70SYMLINKS+=          libterminfo_p.a ${LIBDIR}/libtermlib_p.a
71.endif
72
73.if ${MKPIC} != "no"
74
75.if ${MKPICINSTALL} != "no"
76SYMLINKS+=          libterminfo_pic.a ${LIBDIR}/libtermcap_pic.a
77SYMLINKS+=          libterminfo_pic.a ${LIBDIR}/libtermlib_pic.a
78.endif
79
80.if exists(${.CURDIR}/shlib_version)
81SYMLINKS+=          libterminfo.so.${SHLIB_FULLVERSION} \
82                    ${_LIBSODIR}/libtermcap.so.0.6
83SYMLINKS+=          libterminfo.so.${SHLIB_FULLVERSION} \
84                    ${_LIBSODIR}/libtermlib.so.0.6
85.if ${_LIBSODIR} != ${LIBDIR}
86SYMLINKS+=          libterminfo.so.${SHLIB_FULLVERSION} \
87                    ${LIBDIR}/libtermcap.so.0.6
88SYMLINKS+=          libterminfo.so.${SHLIB_FULLVERSION} \
89                    ${LIBDIR}/libtermlib.so.0.6
90.endif
91
92SYMLINKS+=          libterminfo.so.${SHLIB_MAJOR} \
93                    ${_LIBSODIR}/libtermcap.so.0
94SYMLINKS+=          libterminfo.so ${_LIBSODIR}/libtermcap.so
95SYMLINKS+=          libterminfo.so.${SHLIB_MAJOR} \
96                    ${_LIBSODIR}/libtermlib.so.0
97SYMLINKS+=          libterminfo.so ${_LIBSODIR}/libtermlib.so
98.if ${_LIBSODIR} != ${LIBDIR}
99SYMLINKS+=          libterminfo.so.${SHLIB_MAJOR} \
100                    ${LIBDIR}/libtermcap.so.0
101SYMLINKS+=          libterminfo.so ${LIBDIR}/libtermcap.so
102SYMLINKS+=          libterminfo.so.${SHLIB_MAJOR} \
103                    ${LIBDIR}/libtermlib.so.0
104SYMLINKS+=          libterminfo.so ${LIBDIR}/libtermlib.so
105.endif
106.endif    # exists shlib_version
107
108.endif    # ${MKPIC} != "no"
109
110.include <bsd.lib.mk>
111