1# $DragonFly: src/lib/libncurses/libncurses/Makefile,v 1.6 2005/07/30 13:59:45 joerg Exp $
2
3LIB=    ncurses
4
5.include "../Makefile.inc"
6
7NCURSESBASEDIR=${NCURSESDIR}/ncurses/base
8NCURSESSERIALDIR=${NCURSESDIR}/ncurses/tty
9NCURSESTINFODIR=${NCURSESDIR}/ncurses/tinfo
10NCURSESTRACEDIR=${NCURSESDIR}/ncurses/trace
11.PATH: ${NCURSESBASEDIR} ${NCURSESSERIALDIR} ${NCURSESTINFODIR} \
12	${NCURSESTRACEDIR} ${.OBJDIR} ${NCURSESDIR}/include/
13
14CFLAGS+= 	-I${NCURSESDIR}/ncurses/
15CFLAGS+=	-DTRACE
16
17TERMINFO_CAPS=  ${NCURSESDIR}/include/Caps
18ncurses_def.h:
19	${NCURSESDIR}/include/MKncurses_def.sh ${NCURSESDIR}/include/ncurses_defs > ${.TARGET}
20curses.h:
21	cat ${.CURDIR}/../include/curses.head >$@
22	${NCURSESDIR}/include/MKkey_defs.sh $(TERMINFO_CAPS) >>$@
23	cat ${NCURSESDIR}/include/curses.tail >>$@
24term.h:
25	awk -f ${.CURDIR}/../include/MKterm.h.awk ${TERMINFO_CAPS} > $@
26	${NCURSESDIR}/include/edit_cfg.sh ${.CURDIR}/../include/ncurses_cfg.h $@
27hashsize.h:
28	${NCURSESDIR}/include/MKhashsize.sh ${TERMINFO_CAPS} >$@
29parametrized.h:
30	${NCURSESDIR}/include/MKparametrized.sh ${TERMINFO_CAPS} >$@
31init_keytry.h: make_keys keys.list
32	./make_keys keys.list > $@
33
34make_keys: make_keys.c
35	${NXCC} ${NXCFLAGS} ${NXLDFLAGS} ${NCURSESTINFODIR}/make_keys.c ${NXLDLIBS} -o ${.TARGET}
36make_keys.c: names.c ncurses_def.h
37
38keys.list:
39	${NCURSESTINFODIR}/MKkeys_list.sh ${TERMINFO_CAPS} | sort > $@
40
41names.c codes.c:
42	awk -f ${NCURSESTINFODIR}/MKnames.awk ${TERMINFO_CAPS}
43	cat namehdr boolnames boolfnames numnames numfnames strnames strfnames nameftr >names.c
44	cat namehdr boolcodes numcodes strcodes codeftr >codes.c
45comp_captab.c: make_hash
46	sh ${NCURSESTINFODIR}/MKcaptab.awk awk ${TERMINFO_CAPS} > $@
47
48make_hash: ${NCURSESTINFODIR}/comp_hash.c
49	${NXCC} ${NXCFLAGS} ${NXLDFLAGS} -DMAIN_PROGRAM ${NXLDLIBS} -o ${.TARGET} ${NCURSESTINFODIR}/comp_hash.c
50
51make_hash: hashsize.h ncurses_def.h curses.h
52
53expanded.c:
54	sh ${NCURSESSERIALDIR}/MKexpanded.sh "${CC}" -E ${CFLAGS} > $@
55fallback.c:
56	sh ${NCURSESTINFODIR}/MKfallback.sh /usr/share/terminfo ${NCURSESDIR}/misc/terminfo.src >$@
57lib_gen.c: curses.h
58	sh ${NCURSESBASEDIR}/MKlib_gen.sh "${CC} -E ${CFLAGS}" awk generated <curses.h >$@
59lib_keyname.c: keys.list
60	awk -f ${NCURSESBASEDIR}/MKkeyname.awk keys.list > $@
61unctrl.c:
62	echo | awk -f ${NCURSESBASEDIR}/MKunctrl.awk >$@
63
64CLEANFILES=     curses.h ncurses_def.h term.h hashsize.h parametrized.h comp_captab.c
65CLEANFILES+=    namehdr boolnames boolfnames numnames numfnames strnames strfnames nameftr
66CLEANFILES+=    codes.c init_keytry.h numcodes strcodes boolcodes codeftr make_keys names.c
67CLEANFILES+=    make_hash expanded.c fallback.c lib_gen.c lib_keyname.c unctrl.c keys.list
68
69SRCS=	\
70	curses.h \
71	ncurses_def.h \
72	term.h \
73	hashsize.h \
74	parametrized.h \
75	init_keytry.h
76
77# Base
78SRCS+=	\
79	define_key.c \
80	key_defined.c \
81	keybound.c \
82	keyok.c \
83	lib_addch.c \
84	lib_addstr.c \
85	lib_beep.c \
86	lib_bkgd.c \
87	lib_box.c \
88	lib_chgat.c \
89	lib_clear.c \
90	lib_clearok.c \
91	lib_clrbot.c \
92	lib_clreol.c \
93	lib_color.c \
94	lib_colorset.c \
95	lib_delch.c \
96	lib_delwin.c \
97	lib_dft_fgbg.c \
98	lib_echo.c \
99	lib_endwin.c \
100	lib_erase.c \
101	lib_flash.c \
102	lib_freeall.c \
103	lib_getch.c \
104	lib_getstr.c \
105	lib_hline.c \
106	lib_immedok.c \
107	lib_inchstr.c \
108	lib_initscr.c \
109	lib_insch.c \
110	lib_insdel.c \
111	lib_instr.c \
112	lib_isendwin.c \
113	lib_leaveok.c \
114	lib_mouse.c \
115	lib_move.c \
116	lib_mvwin.c \
117	lib_newterm.c \
118	lib_newwin.c \
119	lib_nl.c \
120	lib_overlay.c \
121	lib_pad.c \
122	lib_printw.c \
123	lib_redrawln.c \
124	lib_refresh.c \
125	lib_restart.c \
126	lib_scanw.c \
127	lib_screen.c \
128	lib_scroll.c \
129	lib_scrollok.c \
130	lib_scrreg.c \
131	lib_set_term.c \
132	lib_slk.c \
133	lib_slkatr_set.c \
134	lib_slkatrof.c \
135	lib_slkatron.c \
136	lib_slkatrset.c \
137	lib_slkattr.c \
138	lib_slkclear.c \
139	lib_slkcolor.c \
140	lib_slkinit.c \
141	lib_slklab.c \
142	lib_slkrefr.c \
143	lib_slkset.c \
144	lib_slktouch.c \
145	lib_touch.c \
146	lib_ungetch.c \
147	lib_vline.c \
148	lib_wattroff.c \
149	lib_wattron.c \
150	lib_winch.c \
151	lib_window.c \
152	memmove.c \
153	nc_panel.c \
154	resizeterm.c \
155	safe_sprintf.c \
156	tries.c \
157	version.c \
158	vsscanf.c \
159	wresize.c
160
161# Serial
162SRCS+=	\
163	hardscroll.c \
164	hashmap.c \
165	lib_mvcur.c \
166	lib_tstp.c \
167	lib_twait.c \
168	lib_vidattr.c \
169	tty_update.c
170
171# Tinfo
172SRCS+=	\
173	access.c \
174	add_tries.c \
175	alloc_entry.c \
176	alloc_ttype.c \
177	captoinfo.c \
178	comp_error.c \
179	comp_expand.c \
180	comp_hash.c \
181	comp_parse.c \
182	comp_scan.c \
183	doalloc.c \
184	free_ttype.c \
185	getenv_num.c \
186	home_terminfo.c \
187	init_keytry.c \
188	lib_acs.c \
189	lib_baudrate.c \
190	lib_cur_term.c \
191	lib_data.c \
192	lib_has_cap.c \
193	lib_kernel.c \
194	lib_longname.c \
195	lib_napms.c \
196	lib_options.c \
197	lib_print.c \
198	lib_raw.c \
199	lib_setup.c \
200	lib_termcap.c \
201	lib_termname.c \
202	lib_tgoto.c \
203	lib_ti.c \
204	lib_tparm.c \
205	lib_tputs.c \
206	lib_ttyflags.c \
207	name_match.c \
208	parse_entry.c \
209	read_entry.c \
210	setbuf.c \
211	strings.c \
212	write_entry.c
213
214# Trace
215SRCS+=	\
216	lib_trace.c \
217	lib_traceatr.c \
218	lib_tracebits.c \
219	lib_tracechr.c \
220	lib_tracedmp.c \
221	lib_tracemse.c \
222	trace_buf.c \
223	trace_tries.c \
224	trace_xnames.c \
225	varargs.c \
226	visbuf.c \
227
228# Generated
229SRCS+=	\
230	codes.c \
231	comp_captab.c \
232	expanded.c \
233	fallback.c \
234	lib_gen.c \
235	lib_keyname.c \
236	names.c \
237	unctrl.c
238
239# Use instead of read_termcap.c.
240# From our old libtermcap.
241SRCS+=  termcap.c
242
243SYMLINKS+=libncurses.a ${LIBDIR}/libcurses.a
244SYMLINKS+=libncurses.a ${LIBDIR}/libtinfo.a
245SYMLINKS+=libncurses.a ${LIBDIR}/libmytinfo.a
246SYMLINKS+=libncurses.a ${LIBDIR}/libtermlib.a
247SYMLINKS+=libncurses.a ${LIBDIR}/libtermcap.a
248.if !defined(NOPIC)
249# no need for major at all, it's an ld-time redirection only
250SYMLINKS+=libncurses.so ${SHLIBDIR}/libcurses.so
251SYMLINKS+=libncurses.so ${SHLIBDIR}/libtermcap.so
252SYMLINKS+=libncurses.so ${SHLIBDIR}/libtermlib.so
253SYMLINKS+=libncurses.so ${SHLIBDIR}/libmytinfo.so
254SYMLINKS+=libncurses.so ${SHLIBDIR}/libtinfo.so
255.endif
256.if !defined(NOPROFILE)
257SYMLINKS+=libncurses.a ${PROFLIBDIR}/libcurses.a
258SYMLINKS+=libncurses.a ${PROFLIBDIR}/libtermcap.a
259SYMLINKS+=libncurses.a ${PROFLIBDIR}/libtermlib.a
260SYMLINKS+=libncurses.a ${PROFLIBDIR}/libmytinfo.a
261SYMLINKS+=libncurses.a ${PROFLIBDIR}/libtinfo.aa
262.endif
263
264INCS=	term.h ${.CURDIR}/../include/termcap.h \
265	${.CURDIR}/../include/unctrl.h curses.h
266INCSLINKS=curses.h ${INCLUDEDIR}/ncurses.h
267
268.include <bsd.lib.mk>
269