buildworld - Fix parallel build race in ncurses
[dragonfly.git] / lib / libncurses / libncurses / Makefile
1 # $DragonFly: src/lib/libncurses/libncurses/Makefile,v 1.11 2005/12/06 02:22:23 corecode Exp $
2
3 LIB=    ncurses
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} \
13         ${NCURSESTRACEDIR} ${NCURSESWCHARDIR} ${.OBJDIR} ${.CURDIR}/../include \
14         ${NCURSESDIR}/include/
15
16 CFLAGS+=        -I${NCURSESDIR}/ncurses/
17 CFLAGS+=        -DTRACE
18
19 TERMINFO_CAPS=  ${NCURSESDIR}/include/Caps
20 ncurses_def.h:
21         sh ${NCURSESDIR}/include/MKncurses_def.sh ${NCURSESDIR}/include/ncurses_defs > ${.TARGET}
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         sh -c 'if test "cchar_t" = "cchar_t" ; then cat ${NCURSESDIR}/include/curses.wide >>$@ ; fi'
29         cat ${NCURSESDIR}/include/curses.tail >>$@
30
31 #curses.h: curses.head curses.tail
32 #       cat ${.CURDIR}/../include/curses.head >$@
33 #       sh ${NCURSESDIR}/include/MKkey_defs.sh $(TERMINFO_CAPS) >>$@
34 #       cat ${NCURSESDIR}/include/curses.wide >>$@
35 #       cat ${NCURSESDIR}/include/curses.tail >>$@
36 term.h: MKterm.h.awk ncurses_cfg.h
37         awk -f ${.CURDIR}/../include/MKterm.h.awk ${TERMINFO_CAPS} > $@
38         sh ${NCURSESDIR}/include/edit_cfg.sh ${.CURDIR}/../include/ncurses_cfg.h $@
39 hashsize.h:
40         sh ${NCURSESDIR}/include/MKhashsize.sh ${TERMINFO_CAPS} >$@
41 parametrized.h:
42         sh ${NCURSESDIR}/include/MKparametrized.sh ${TERMINFO_CAPS} >$@
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
47         ${NXCC} ${NXCFLAGS} ${NXLDFLAGS} ${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         #cat namehdr boolnames boolfnames numnames numfnames strnames strfnames nameftr >names.c
55         #cat namehdr boolcodes numcodes strcodes codeftr >codes.c
56 codes.c: ${NCURSESTINFODIR}/MKcodes.awk
57         awk -f ${NCURSESTINFODIR}/MKcodes.awk bigstrings=$(USE_BIG_STRINGS) ${TERMINFO_CAPS} >$@
58 comp_captab.c: make_hash
59         sh -e ${NCURSESTINFODIR}/MKcaptab.sh awk 0 ${NCURSESTINFODIR}/MKcaptab.awk ${TERMINFO_CAPS} > $@
60
61 make_hash: ${NCURSESTINFODIR}/comp_hash.c
62         ${NXCC} ${NXCFLAGS} ${NXLDFLAGS} -DMAIN_PROGRAM ${NXLDLIBS} -o ${.TARGET} ${NCURSESTINFODIR}/comp_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         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 SRCS+=  \
251         charable.c \
252         lib_add_wch.c \
253         lib_box_set.c \
254         lib_cchar.c \
255         lib_erasewchar.c \
256         lib_get_wch.c \
257         lib_get_wstr.c \
258         lib_hline_set.c \
259         lib_in_wch.c \
260         lib_in_wchnstr.c \
261         lib_ins_wch.c \
262         lib_inwstr.c \
263         lib_key_name.c \
264         lib_pecho_wchar.c \
265         lib_slk_wset.c \
266         lib_unget_wch.c \
267         lib_vid_attr.c \
268         lib_vline_set.c \
269         lib_wacs.c \
270         lib_wunctrl.c
271
272 # Generated
273 SRCS+=  \
274         codes.c \
275         comp_captab.c \
276         expanded.c \
277         fallback.c \
278         lib_gen.c \
279         lib_keyname.c \
280         names.c \
281         unctrl.c
282
283 # Use instead of read_termcap.c.
284 # From our old libtermcap.
285 SRCS+=  termcap.c
286
287 SYMLINKS+=libncurses.a ${LIBDIR}/libcurses.a
288 SYMLINKS+=libncurses.a ${LIBDIR}/libtinfo.a
289 SYMLINKS+=libncurses.a ${LIBDIR}/libmytinfo.a
290 SYMLINKS+=libncurses.a ${LIBDIR}/libtermlib.a
291 SYMLINKS+=libncurses.a ${LIBDIR}/libtermcap.a
292 .if !defined(NOPIC)
293 # no need for major at all, it's an ld-time redirection only
294 SYMLINKS+=libncurses.so ${SHLIBDIR}/libcurses.so
295 SYMLINKS+=libncurses.so ${SHLIBDIR}/libtermcap.so
296 SYMLINKS+=libncurses.so ${SHLIBDIR}/libtermlib.so
297 SYMLINKS+=libncurses.so ${SHLIBDIR}/libmytinfo.so
298 SYMLINKS+=libncurses.so ${SHLIBDIR}/libtinfo.so
299 .endif
300 .if !defined(NOPROFILE)
301 SYMLINKS+=libncurses.a ${PROFLIBDIR}/libcurses.a
302 SYMLINKS+=libncurses.a ${PROFLIBDIR}/libtermcap.a
303 SYMLINKS+=libncurses.a ${PROFLIBDIR}/libtermlib.a
304 SYMLINKS+=libncurses.a ${PROFLIBDIR}/libmytinfo.a
305 SYMLINKS+=libncurses.a ${PROFLIBDIR}/libtinfo.aa
306 .endif
307
308 INCS=   term.h ${.CURDIR}/../include/termcap.h \
309         ${.CURDIR}/../include/unctrl.h curses.h \
310         ${NCURSESDIR}/include/ncurses_dll.h
311 INCSLINKS=curses.h ${INCLUDEDIR}/ncurses.h
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: ${INCS}
318 comp_captab.c: ${INCS}
319 expanded.c: ${INCS}
320 fallback.c: ${INCS}
321 lib_gen.c: ${INCS}
322 lib_keyname.c: ${INCS}
323 names.c: ${INCS}
324 unctrl.c: ${INCS}
325
326 .include <bsd.lib.mk>