5da1a3dac83c5e77d7c6c7da70a8d3f5e85addb4
[dragonfly.git] / usr.bin / tic / Makefile
1 NCURSESDIR=     ${.CURDIR}/../../contrib/ncurses
2 TERMINFO_CAPS=  ${NCURSESDIR}/include/Caps
3 PROGSDIR=       ${NCURSESDIR}/progs
4 .PATH:          ${PROGSDIR}
5
6 PROG=           tic
7
8 CFLAGS+=        -D_XOPEN_SOURCE_EXTENDED
9 CFLAGS+=        -DENABLE_WIDEC
10 CFLAGS+=        -DSET_NCURSES_CH_T=cchar_t
11 CFLAGS+=        -DSET_NEED_WCHAR_H=1
12 CFLAGS+=        -I${PROGSDIR}
13 CFLAGS+=        -I.
14 CFLAGS+=        -I${NCURSESDIR}/include
15 CFLAGS+=        -I${.CURDIR}/../../lib/libncurses/include
16 CFLAGS+=        -I${.CURDIR}
17 CFLAGS+=        -I${.OBJDIR}
18
19 # Ideally this should be -lprivate_ncursesw
20 # Wide version can be used when DragonFly 3.3 branch is created
21 .if defined(BOOTSTRAPPING)
22 CFLAGS+=        -DBOOTSTRAPPING
23 .  if exists (/usr/lib/libncurses.a)
24 DPADD=          /usr/lib/libncurses.a
25 LDADD=          -lncurses
26 .  else
27 DPADD=          ${LIBNCURSES}
28 LDADD=          -lprivate_ncurses
29 CFLAGS+=        -I${_SHLIBDIRPREFIX}/usr/include/priv/ncurses
30 LDFLAGS+=       ${PRIVATELIB_BLDFLAGS}
31 .  endif
32 .else
33 DPADD=          ${LIBNCURSES}
34 LDADD=          -lprivate_ncurses
35 CFLAGS+=        -I${_SHLIBDIRPREFIX}/usr/include/priv/ncurses
36 LDFLAGS+=       ${PRIVATELIB_LDFLAGS}
37 .endif
38
39 ncurses_def.h:
40         AWK=awk sh ${NCURSESDIR}/include/MKncurses_def.sh \
41           ${NCURSESDIR}/include/ncurses_defs > ${.TARGET}
42
43 parametrized.h:
44         AWK=awk sh ${NCURSESDIR}/include/MKparametrized.sh \
45           ${TERMINFO_CAPS} > ${.TARGET}
46
47 # Hack: It's really termsort.c, but bootstrap stage chokes on it
48 .if defined(BOOTSTRAPPING)
49 _termsortc=     termsort.h
50 .else
51 _termsortc=     termsort.c
52 beforedepend:   termsort.c
53 .endif
54 ${_termsortc}:
55         sh ${PROGSDIR}/MKtermsort.sh awk ${TERMINFO_CAPS} > termsort.c
56
57 tic.o: ${PROGSDIR}/tic.c
58         ${CC} ${CFLAGS} -c ${PROGSDIR}/tic.c -o ${.TARGET}
59
60 transform.o: ${PROGSDIR}/transform.c
61         ${CC} ${CFLAGS} -c ${PROGSDIR}/transform.c -o ${.TARGET}
62
63 dump_entry.o: ${PROGSDIR}/dump_entry.c ${_termsortc}
64         ${CC} ${CFLAGS} -c ${PROGSDIR}/dump_entry.c -o ${.TARGET}
65
66 CLEANFILES=     ncurses_def.h parametrized.h termsort.c
67
68 SRCS=   ncurses_def.h parametrized.h
69 .if defined(BOOTSTRAPPING)
70 SRCS+=  termsort.h
71 .endif
72 SRCS+=  tic.c dump_entry.c tparm_type.c transform.c
73
74 .include <bsd.prog.mk>