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