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