ncurses 4.2
[ncurses.git] / Makefile.glibc
1 # Copyright (C) 1997 Free Software Foundation, Inc.
2 # This file is part of the GNU C Library.
3
4 # The GNU C Library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Library General Public License as
6 # published by the Free Software Foundation; either version 2 of the
7 # License, or (at your option) any later version.
8
9 # The GNU C Library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 # Library General Public License for more details.
13
14 # You should have received a copy of the GNU Library General Public
15 # License along with the GNU C Library; see the file COPYING.LIB.  If not,
16 # write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 # Boston, MA 02111-1307, USA.
18
19 #
20 #       Makefile for ncurses part.
21 #
22 subdir  := ncurses
23
24 ncurses-version = 4.2
25 form-version    = $(ncurses-version)
26 menu-version    = $(ncurses-version)
27 panel-version   = $(ncurses-version)
28
29 extras                  := form menu ncurses panel
30
31 extra-libs              = $(extras:%=lib%)
32 # These libraries will be built in the `others' pass rather than
33 # the `lib' pass, because they depend on libc.so being built already.
34 extra-libs-others       = $(extra-libs)
35
36 # The sources are found in the appropriate subdir.
37 subdir-dirs = $(extras) progs test
38 vpath %.c $(subdir-dirs)
39 vpath %.h $(subdir-dirs)
40
41 libform-routines        = \
42                         fld_arg \
43                         fld_attr \
44                         fld_current \
45                         fld_def \
46                         fld_dup \
47                         fld_ftchoice \
48                         fld_ftlink \
49                         fld_info \
50                         fld_just \
51                         fld_link \
52                         fld_max \
53                         fld_move \
54                         fld_newftyp \
55                         fld_opts \
56                         fld_pad \
57                         fld_page \
58                         fld_stat \
59                         fld_type \
60                         fld_user \
61                         frm_adabind \
62                         frm_cursor \
63                         frm_data \
64                         frm_def \
65                         frm_driver \
66                         frm_hook \
67                         frm_opts \
68                         frm_page \
69                         frm_post \
70                         frm_req_name \
71                         frm_scale \
72                         frm_sub \
73                         frm_user \
74                         frm_win \
75                         fty_alnum \
76                         fty_alpha \
77                         fty_enum \
78                         fty_int \
79                         fty_ipv4 \
80                         fty_num \
81                         fty_regex
82
83 libncurses-routines     = \
84                         alloc_entry \
85                         captoinfo \
86                         codes \
87                         comp_captab \
88                         comp_error \
89                         comp_expand \
90                         comp_hash \
91                         comp_parse \
92                         comp_scan \
93                         define_key \
94                         expanded \
95                         fallback \
96                         hardscroll \
97                         hashmap \
98                         keyok \
99                         lib_acs \
100                         lib_adabind \
101                         lib_addch \
102                         lib_addstr \
103                         lib_baudrate \
104                         lib_beep \
105                         lib_bkgd \
106                         lib_box \
107                         lib_chgat \
108                         lib_clear \
109                         lib_clearok \
110                         lib_clrbot \
111                         lib_clreol \
112                         lib_color \
113                         lib_cur_term \
114                         lib_data \
115                         lib_delch \
116                         lib_delwin \
117                         lib_dft_fgbg \
118                         lib_doupdate \
119                         lib_echo \
120                         lib_endwin \
121                         lib_erase \
122                         lib_flash \
123                         lib_freeall \
124                         lib_gen \
125                         lib_getch \
126                         lib_getstr \
127                         lib_hline \
128                         lib_immedok \
129                         lib_inchstr \
130                         lib_initscr \
131                         lib_insch \
132                         lib_insdel \
133                         lib_insstr \
134                         lib_instr \
135                         lib_isendwin \
136                         lib_kernel \
137                         lib_keyname \
138                         lib_leaveok \
139                         lib_longname \
140                         lib_mouse \
141                         lib_move \
142                         lib_mvcur \
143                         lib_mvwin \
144                         lib_napms \
145                         lib_newterm \
146                         lib_newwin \
147                         lib_nl \
148                         lib_options \
149                         lib_overlay \
150                         lib_pad \
151                         lib_print \
152                         lib_printw \
153                         lib_raw \
154                         lib_redrawln \
155                         lib_refresh \
156                         lib_restart \
157                         lib_scanw \
158                         lib_screen \
159                         lib_scroll \
160                         lib_scrollok \
161                         lib_scrreg \
162                         lib_set_term \
163                         lib_setup \
164                         lib_slk \
165                         lib_slkatrof \
166                         lib_slkatron \
167                         lib_slkatrset \
168                         lib_slkattr \
169                         lib_slkclear \
170                         lib_slkinit \
171                         lib_slklab \
172                         lib_slkrefr \
173                         lib_slkset \
174                         lib_slktouch \
175                         lib_termcap \
176                         lib_ti \
177                         lib_touch \
178                         lib_tparm \
179                         lib_tputs \
180                         lib_trace \
181                         lib_traceatr \
182                         lib_tracechr \
183                         lib_tracedmp \
184                         lib_tracemse \
185                         lib_tstp \
186                         lib_twait \
187                         lib_ungetch \
188                         lib_vidattr \
189                         lib_vline \
190                         lib_wattroff \
191                         lib_wattron \
192                         lib_window \
193                         name_match \
194                         names \
195                         nc_panel \
196                         parse_entry \
197                         read_entry \
198                         read_termcap \
199                         resizeterm \
200                         safe_sprintf \
201                         softscroll \
202                         trace_buf \
203                         tries \
204                         unctrl \
205                         wresize \
206                         write_entry
207
208 libmenu-routines        = \
209                         m_adabind \
210                         m_attribs \
211                         m_cursor \
212                         m_driver \
213                         m_format \
214                         m_global \
215                         m_hook \
216                         m_item_cur \
217                         m_item_nam \
218                         m_item_new \
219                         m_item_opt \
220                         m_item_top \
221                         m_item_use \
222                         m_item_val \
223                         m_item_vis \
224                         m_items \
225                         m_new \
226                         m_opts \
227                         m_pad \
228                         m_pattern \
229                         m_post \
230                         m_req_name \
231                         m_scale \
232                         m_spacing \
233                         m_sub \
234                         m_userptr \
235                         m_win
236
237 libpanel-routines       = \
238                         panel \
239                         p_above \
240                         p_below \
241                         p_bottom \
242                         p_delete \
243                         p_hide \
244                         p_hidden \
245                         p_move \
246                         p_new \
247                         p_replace \
248                         p_show \
249                         p_top \
250                         p_update \
251                         p_user \
252                         p_win
253
254 headers = curses.h eti.h form.h menu.h panel.h term.h termcap.h \
255           unctrl.h
256 others = clear infocmp tic toe tput tset
257 install-bin = $(others)
258
259 clear-objs = clear.o
260 infocmp-objs = infocmp.o dump_entry.o
261 tic-objs = tic.o dump_entry.o
262 toe-objs = toe.o dump_entry.o
263 tput-objs = tput.o
264 tset-objs = tset.o dump_entry.o
265 extra-objs = $(tic-objs) $(toe-objs) $(infocmp-objs) $(clear-objs) \
266                 $(tput-objs) $(tset-objs)
267
268 # mvcur won't compile
269 test-srcs = tctest thardscroll thashmap \
270                 blue bs firework firstlast gdc hanoi hashtest knight \
271                 lrtest ncurses newdemo rain tclock testaddch testcurs \
272                 testscanw view worm xmas
273 mvcur-objs = mvcur.o dump_entry.o
274 tctest-objs = tctest.o
275 thardscroll-objs = thardscroll.o
276 thashmap-objs = thashmap.o hhardscroll.o
277
278 include ../Rules
279
280 ifndef tabsetdir
281 tabsetdir               = $(datadir)/tabset
282 endif
283 ifndef inst_tabsetdir
284 inst_tabsetdir  = $(install_root)/$(tabsetdir)
285 endif
286
287 ifndef terminfodir
288 terminfodir             = $(datadir)/terminfo
289 endif
290 ifndef inst_terminfodir
291 inst_terminfodir        = $(install_root)/$(terminfodir)
292 endif
293
294 ifndef mandir
295 mandir                  = $(prefix)/man
296 endif
297
298 ifndef inst_mandir
299 inst_mandir             = $(install_root)/$(mandir)
300 endif
301
302 CPPFLAGS += -DTERMINFO='"$(terminfodir)"' -Iinclude -Iform -Incurses \
303         -Imenu -Ipanel -Iprogs -Itest
304
305 ifneq ($(strip $(objpfx)),)
306 CPPFLAGS += -I$(objpfx)
307 endif
308
309 LDLIBS-tclock = math/libm
310
311 tests: $(test-srcs:%=$(objpfx)%) 
312
313 $(objpfx)mvcur.d: ncurses/lib_mvcur.c
314         $(CC) -M $(CFLAGS) $(CPPFLAGS) -DTRACE -DMAIN $? | \
315                 sed -e 's/^lib_mvcur.o/mvcur.o/' > $@
316
317 $(objpfx)mvcur.o: ncurses/lib_mvcur.c
318         $(CC) -c -o $@ $(CFLAGS) $(CPPFLAGS) -DTRACE -DMAIN $?
319
320 $(objpfx)tctest.d: ncurses/captoinfo.c
321         $(CC) -M $(CFLAGS) $(CPPFLAGS) -DTRACE -DMAIN $? | \
322                 sed -e 's/^captoinfo.o/tctest.o/' > $@
323
324 $(objpfx)tctest.o: ncurses/captoinfo.c
325         $(CC) -c -o $@ $(CFLAGS) $(CPPFLAGS) -DTRACE -DMAIN $?
326
327 $(objpfx)thardscroll.d: ncurses/hardscroll.c
328         $(CC) -M $(CFLAGS) $(CPPFLAGS) -DTRACE -DSCROLLDEBUG $? | \
329                 sed -e 's/^hardscroll.o/thardscroll.o/' > $@
330
331 $(objpfx)thardscroll.o: ncurses/hardscroll.c
332         $(CC) -c -o $@ $(CFLAGS) $(CPPFLAGS) -DTRACE -DSCROLLDEBUG $?
333
334 $(objpfx)thashmap.d: ncurses/hashmap.c
335         $(CC) -M $(CFLAGS) $(CPPFLAGS) -DTRACE -DHASHDEBUG $? | \
336                 sed -e 's/^hashmap.o/thashmap.o/' > $@
337
338 $(objpfx)thashmap.o: ncurses/hashmap.c
339         $(CC) -c -o $@ $(CFLAGS) $(CPPFLAGS) -DTRACE -DHASHDEBUG $?
340
341 $(objpfx)hhardscroll.o: ncurses/hardscroll.c
342         $(CC) -c -o $@ $(CFLAGS) $(CPPFLAGS) -DTRACE -DHASHDEBUG $?
343
344 $(objpfx)mvcur: $(addprefix $(objpfx),$(mvcur-objs))
345 $(objpfx)tctest: $(addprefix $(objpfx),$(tctest-objs))
346 $(objpfx)thardscroll: $(addprefix $(objpfx),$(thardscroll-objs))
347 $(objpfx)thashmap: $(addprefix $(objpfx),$(thashmap-objs))
348
349 $(objpfx)clear: $(addprefix $(objpfx),$(clear-objs))
350 $(objpfx)infocmp: $(addprefix $(objpfx),$(infocmp-objs))
351 $(objpfx)tic: $(addprefix $(objpfx),$(tic-objs))
352 $(objpfx)toe: $(addprefix $(objpfx),$(toe-objs))
353 $(objpfx)tput: $(addprefix $(objpfx),$(tput-objs))
354 $(objpfx)tset: $(addprefix $(objpfx),$(tset-objs))
355
356 ifeq ($(build-shared),yes)
357 $(others:%=$(objpfx)%): $(objpfx)libncurses.so
358 else
359 $(others:%=$(objpfx)%): $(objpfx)libncurses.a
360 endif
361
362 $(test-srcs:%=$(objpfx)%): $(objpfx)libform.a $(objpfx)libmenu.a \
363         $(objpfx)libpanel.a $(objpfx)libncurses.a
364
365 # Depend on libc.so so a DT_NEEDED is generated in the shared objects.
366 # This ensures they will load libc.so for needed symbols if loaded by
367 # a statically-linked program that hasn't already loaded it.
368 $(extras:%=$(objpfx)lib%.so): $(common-objpfx)libc.so
369
370 subdir_install: $(inst_libdir)/libtermcap.a $(inst_libdir)/libcurses.a \
371         $(inst_bindir)/reset $(inst_bindir)/captoinfo
372
373 $(inst_libdir)/libtermcap.a $(inst_libdir)/libcurses.a: \
374                 $(inst_libdir)/libncurses.a
375         $(make-link)
376
377 $(inst_bindir)/reset: $(inst_bindir)/tset
378         $(make-link)
379
380 $(inst_bindir)/captoinfo: $(inst_bindir)/tic
381         $(make-link)
382
383 ifeq (yes,$(build-shared))
384 subdir_install: $(inst_libdir)/libtermcap.so  $(inst_libdir)/libcurses.so
385
386 $(inst_libdir)/libtermcap.so $(inst_libdir)/libcurses.so: \
387                 $(inst_libdir)/libncurses.so
388         $(make-link)
389 endif
390
391 subdir_install: $(inst_mandir)/man5/terminfo.5
392
393 $(inst_mandir)/man5/terminfo.5: $(objpfx)terminfo.5 $(wildcard man/*.[0-9]*)
394         $(make-target-directory)
395         sh $(edit_man-sh) $(prefix) $(inst_mandir) $(edit_man-sed) $^
396
397 subdir_install: $(inst_tabsetdir)/std
398
399 $(inst_tabsetdir)/std: \
400         $(filter-out misc/tabset/CVS, $(wildcard misc/tabset/*))
401         $(make-target-directory)
402         for f in $^; do \
403           echo installing $$f; \
404           $(INSTALL_DATA) $$f $(inst_tabsetdir); \
405         done
406         
407
408 ifeq (no,$(cross-compiling))
409 subdir_install: $(inst_terminfodir)/v/vt100
410
411 $(inst_terminfodir)/v/vt100: misc/terminfo.src $(objpfx)tic
412         $(make-target-directory)
413         sh $(run_tic-sh) $(common-objpfx) misc $(terminfodir) \
414                 $(install_root)
415 endif
416
417 subdir_distclean subdir_realclean:
418         -rm -f $(addprefix $(objpfx), MKterm.h.awk codes.c \
419                 comp_captab.c confdefs.h config.log curses.h \
420                 expanded.c fallback.c hashsize.h keys.tries \
421                 lib_gen.c lib_keyname.c names.c ncurses_cfg.h \
422                 nomacros.h parametrized.h term.h termcap.h \
423                 terminfo.5 termsort.c unctrl.c unctrl.h)