1LIB=    private_ncurses${LIB_SUFFIX}
2
3SHLIBDIR?=	/lib/priv
4LIBDIR?=	/usr/lib/priv
5PROFLIBDIR?=	/usr/lib/priv/profile
6
7.include "../Makefile.inc"
8
9NCURSESBASEDIR=${NCURSESDIR}/ncurses/base
10NCURSESSERIALDIR=${NCURSESDIR}/ncurses/tty
11NCURSESTINFODIR=${NCURSESDIR}/ncurses/tinfo
12NCURSESTRACEDIR=${NCURSESDIR}/ncurses/trace
13NCURSESWCHARDIR=${NCURSESDIR}/ncurses/widechar
14.PATH: ${NCURSESBASEDIR} ${NCURSESSERIALDIR} ${NCURSESTINFODIR} ${NCURSESTRACEDIR} \
15	${.OBJDIR} ${.CURDIR}/../include ${NCURSESDIR}/include/
16
17CFLAGS+=	-DTRACE
18CFLAGS+=	-DDRAGONFLY_NATIVE
19
20ncurses_def.h:
21	AWK=awk sh ${NCURSESDIR}/include/MKncurses_def.sh \
22	  ${NCURSESDIR}/include/ncurses_defs > ${.TARGET}
23
24curses.h: $(TERMINFO_CAPS) \
25		curses.head \
26		${NCURSESDIR}/include/curses.tail \
27		${NCURSESDIR}/include//MKkey_defs.sh
28	cat  ${.CURDIR}/../include/curses.head >$@
29	AWK=awk sh ${NCURSESDIR}/include/MKkey_defs.sh $(TERMINFO_CAPS) >>$@
30.if defined(ENABLE_WIDEC)
31	cat ${NCURSESDIR}/include/curses.wide >>$@
32.endif
33	cat ${NCURSESDIR}/include/curses.tail >>$@
34
35term.h: MKterm.h.awk ncurses_cfg.h
36	awk -f ${.CURDIR}/../include/MKterm.h.awk ${TERMINFO_CAPS} > $@
37	sh ${NCURSESDIR}/include/edit_cfg.sh ${.CURDIR}/../include/ncurses_cfg.h $@
38
39hashsize.h:
40	sh ${NCURSESDIR}/include/MKhashsize.sh ${TERMINFO_CAPS} >$@
41
42parametrized.h:
43	sh ${NCURSESDIR}/include/MKparametrized.sh ${TERMINFO_CAPS} >$@
44
45init_keytry.h: make_keys keys.list
46	./make_keys keys.list > $@
47
48make_keys: ${NCURSESTINFODIR}/make_keys.c names.c ncurses_def.h ${VERSION_MAP}
49	${NXCC} ${NXCFLAGS} -static ${NCURSESTINFODIR}/make_keys.c ${NXLDLIBS} -o ${.TARGET}
50
51keys.list:
52	sh ${NCURSESTINFODIR}/MKkeys_list.sh ${TERMINFO_CAPS} | sort > $@
53
54names.c: ${NCURSESTINFODIR}/MKnames.awk
55	awk -f ${NCURSESTINFODIR}/MKnames.awk bigstrings=$(USE_BIG_STRINGS) ${TERMINFO_CAPS} >$@
56
57codes.c: ${NCURSESTINFODIR}/MKcodes.awk
58	awk -f ${NCURSESTINFODIR}/MKcodes.awk bigstrings=$(USE_BIG_STRINGS) ${TERMINFO_CAPS} >$@
59
60comp_captab.c: make_hash
61	sh -e ${NCURSESTINFODIR}/MKcaptab.sh awk 0 ${NCURSESTINFODIR}/MKcaptab.awk ${TERMINFO_CAPS} > $@
62
63make_hash: ${NCURSESTINFODIR}/make_hash.c
64	${NXCC} ${NXCFLAGS} -static -DMAIN_PROGRAM ${NXLDLIBS} -o ${.TARGET} ${NCURSESTINFODIR}/make_hash.c
65
66make_hash: hashsize.h ncurses_def.h curses.h
67
68expanded.c:
69	sh ${NCURSESSERIALDIR}/MKexpanded.sh "${CC}" -E ${CFLAGS} > $@
70fallback.c:
71	sh ${NCURSESTINFODIR}/MKfallback.sh /usr/share/terminfo ${NCURSESDIR}/misc/terminfo.src >$@
72lib_gen.c: curses.h
73	sh ${NCURSESBASEDIR}/MKlib_gen.sh "${CC} -E ${CFLAGS}" awk generated <curses.h >$@
74lib_keyname.c: keys.list
75	awk -f ${NCURSESBASEDIR}/MKkeyname.awk keys.list > $@
76unctrl.c:
77	echo | awk -f ${NCURSESBASEDIR}/MKunctrl.awk >$@
78
79CLEANFILES=     curses.h ncurses_def.h term.h hashsize.h parametrized.h comp_captab.c
80CLEANFILES+=    namehdr boolnames boolfnames numnames numfnames strnames strfnames nameftr
81CLEANFILES+=    codes.c init_keytry.h numcodes strcodes boolcodes codeftr make_keys names.c
82CLEANFILES+=    make_hash expanded.c fallback.c lib_gen.c lib_keyname.c unctrl.c keys.list
83
84SRCS=	\
85	curses.h \
86	ncurses_def.h \
87	term.h \
88	hashsize.h \
89	parametrized.h \
90	init_keytry.h
91
92# Base
93SRCS+=	\
94	define_key.c \
95	key_defined.c \
96	keybound.c \
97	keyok.c \
98	legacy_coding.c \
99	lib_addch.c \
100	lib_addstr.c \
101	lib_beep.c \
102	lib_bkgd.c \
103	lib_box.c \
104	lib_chgat.c \
105	lib_clear.c \
106	lib_clearok.c \
107	lib_clrbot.c \
108	lib_clreol.c \
109	lib_color.c \
110	lib_colorset.c \
111	lib_delch.c \
112	lib_delwin.c \
113	lib_dft_fgbg.c \
114	lib_echo.c \
115	lib_endwin.c \
116	lib_erase.c \
117	lib_flash.c \
118	lib_freeall.c \
119	lib_getch.c \
120	lib_getstr.c \
121	lib_hline.c \
122	lib_immedok.c \
123	lib_inchstr.c \
124	lib_initscr.c \
125	lib_insch.c \
126	lib_insdel.c \
127	lib_instr.c \
128	lib_insnstr.c \
129	lib_isendwin.c \
130	lib_leaveok.c \
131	lib_mouse.c \
132	lib_move.c \
133	lib_mvwin.c \
134	lib_newterm.c \
135	lib_newwin.c \
136	lib_nl.c \
137	lib_overlay.c \
138	lib_pad.c \
139	lib_printw.c \
140	lib_redrawln.c \
141	lib_refresh.c \
142	lib_restart.c \
143	lib_scanw.c \
144	lib_screen.c \
145	lib_scroll.c \
146	lib_scrollok.c \
147	lib_scrreg.c \
148	lib_set_term.c \
149	lib_slk.c \
150	lib_slkatr_set.c \
151	lib_slkatrof.c \
152	lib_slkatron.c \
153	lib_slkatrset.c \
154	lib_slkattr.c \
155	lib_slkclear.c \
156	lib_slkcolor.c \
157	lib_slkinit.c \
158	lib_slklab.c \
159	lib_slkrefr.c \
160	lib_slkset.c \
161	lib_slktouch.c \
162	lib_touch.c \
163	lib_ungetch.c \
164	lib_vline.c \
165	lib_wattroff.c \
166	lib_wattron.c \
167	lib_winch.c \
168	lib_window.c \
169	memmove.c \
170	nc_panel.c \
171	resizeterm.c \
172	safe_sprintf.c \
173	tries.c \
174	use_window.c \
175	version.c \
176	vsscanf.c \
177	wresize.c
178
179# Serial
180SRCS+=	\
181	hardscroll.c \
182	hashmap.c \
183	lib_mvcur.c \
184	lib_tstp.c \
185	lib_twait.c \
186	lib_vidattr.c \
187	tty_update.c
188
189# Tinfo
190SRCS+=	\
191	access.c \
192	add_tries.c \
193	alloc_entry.c \
194	alloc_ttype.c \
195	captoinfo.c \
196	comp_error.c \
197	comp_expand.c \
198	comp_hash.c \
199	comp_parse.c \
200	comp_scan.c \
201	doalloc.c \
202	db_iterator.c \
203	entries.c \
204	free_ttype.c \
205	getenv_num.c \
206	hashed_db.c \
207	home_terminfo.c \
208	init_keytry.c \
209	lib_acs.c \
210	lib_baudrate.c \
211	lib_cur_term.c \
212	lib_data.c \
213	lib_has_cap.c \
214	lib_kernel.c \
215	lib_longname.c \
216	lib_napms.c \
217	lib_options.c \
218	lib_print.c \
219	lib_raw.c \
220	lib_setup.c \
221	lib_termcap.c \
222	lib_termname.c \
223	lib_tgoto.c \
224	lib_ti.c \
225	lib_tparm.c \
226	lib_tputs.c \
227	lib_ttyflags.c \
228	name_match.c \
229	parse_entry.c \
230	read_entry.c \
231	read_termcap.c \
232	setbuf.c \
233	strings.c \
234	trim_sgr0.c \
235	use_screen.c \
236	write_entry.c
237
238# Trace
239SRCS+=	\
240	lib_trace.c \
241	lib_traceatr.c \
242	lib_tracebits.c \
243	lib_tracechr.c \
244	lib_tracedmp.c \
245	lib_tracemse.c \
246	trace_buf.c \
247	trace_tries.c \
248	trace_xnames.c \
249	varargs.c \
250	visbuf.c \
251
252# Widechar
253.if defined(ENABLE_WIDEC)
254.PATH: ${NCURSESWCHARDIR}
255SRCS+=	\
256	charable.c \
257	lib_add_wch.c \
258	lib_box_set.c \
259	lib_cchar.c \
260	lib_erasewchar.c \
261	lib_get_wch.c \
262	lib_get_wstr.c \
263	lib_hline_set.c \
264	lib_in_wch.c \
265	lib_in_wchnstr.c \
266	lib_ins_wch.c \
267	lib_inwstr.c \
268	lib_key_name.c \
269	lib_pecho_wchar.c \
270	lib_slk_wset.c \
271	lib_unget_wch.c \
272	lib_vid_attr.c \
273	lib_vline_set.c \
274	lib_wacs.c \
275	lib_wunctrl.c
276.endif
277
278# Generated
279SRCS+=	\
280	codes.c \
281	comp_captab.c \
282	expanded.c \
283	fallback.c \
284	lib_gen.c \
285	lib_keyname.c \
286	names.c \
287	unctrl.c
288
289NCSTATIC=	libprivate_ncurses${LIB_SUFFIX}.a
290NCDYN=		libprivate_ncurses${LIB_SUFFIX}.so
291
292SYMLINKS+=${NCSTATIC} ${LIBDIR}/libprivate_termcap${LIB_SUFFIX}.a
293SYMLINKS+=${NCSTATIC} ${LIBDIR}/libprivate_termlib${LIB_SUFFIX}.a
294SYMLINKS+=${NCSTATIC} ${LIBDIR}/libprivate_tinfo${LIB_SUFFIX}.a
295.if !defined(NOPIC)
296# no need for major at all, it's an ld-time redirection only
297SYMLINKS+=${NCDYN} ${SHLIBDIR}/libprivate_termcap${LIB_SUFFIX}.so
298SYMLINKS+=${NCDYN} ${SHLIBDIR}/libprivate_termlib${LIB_SUFFIX}.so
299SYMLINKS+=${NCDYN} ${SHLIBDIR}/libprivate_tinfo${LIB_SUFFIX}.so
300.endif
301.if !defined(NOPROFILE)
302SYMLINKS+=${NCSTATIC} ${PROFLIBDIR}/libprivate_termcap${LIB_SUFFIX}.a
303SYMLINKS+=${NCSTATIC} ${PROFLIBDIR}/libprivate_termlib${LIB_SUFFIX}.a
304SYMLINKS+=${NCSTATIC} ${PROFLIBDIR}/libprivate_tinfo${LIB_SUFFIX}.a
305.endif
306
307XINCS=	term.h ${.CURDIR}/../include/termcap.h \
308	${.CURDIR}/../include/unctrl.h curses.h \
309	${.CURDIR}/../include/ncurses_dll.h
310
311.if defined(ENABLE_WIDEC)
312INCS= ${XINCS}
313INCSLINKS=curses.h ${INCLUDEDIR}/ncurses.h
314.endif
315
316# Make the generated files depend on the headers, otherwise
317# the make depend step cannot run -j parallel due to not yet
318# knowing what the actual dependencies are.
319#
320codes.c: ${XINCS}
321comp_captab.c: ${XINCS}
322expanded.c: ${XINCS}
323fallback.c: ${XINCS}
324lib_gen.c: ${XINCS}
325lib_keyname.c: ${XINCS}
326names.c: ${XINCS}
327unctrl.c: ${XINCS}
328
329.include <bsd.lib.mk>
330