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