53b35abb72993760282868257a53991caec970f9
[ncurses.git] / Makefile.glibc
1 # Copyright (C) 1997,1998 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_cursor \
62                         frm_data \
63                         frm_def \
64                         frm_driver \
65                         frm_hook \
66                         frm_opts \
67                         frm_page \
68                         frm_post \
69                         frm_req_name \
70                         frm_scale \
71                         frm_sub \
72                         frm_user \
73                         frm_win \
74                         fty_alnum \
75                         fty_alpha \
76                         fty_enum \
77                         fty_int \
78                         fty_ipv4 \
79                         fty_num \
80                         fty_regex
81
82 libncurses-routines     = \
83                         base/define_key \
84                         base/keybound \
85                         base/keyok \
86                         base/lib_addch \
87                         base/lib_addstr \
88                         base/lib_beep \
89                         base/lib_bkgd \
90                         base/lib_box \
91                         base/lib_chgat \
92                         base/lib_clear \
93                         base/lib_clearok \
94                         base/lib_clrbot \
95                         base/lib_clreol \
96                         base/lib_color \
97                         base/lib_colorset \
98                         base/lib_delch \
99                         base/lib_delwin \
100                         base/lib_dft_fgbg \
101                         base/lib_echo \
102                         base/lib_endwin \
103                         base/lib_erase \
104                         base/lib_flash \
105                         base/lib_freeall \
106                         base/lib_getch \
107                         base/lib_getstr \
108                         base/lib_hline \
109                         base/lib_immedok \
110                         base/lib_inchstr \
111                         base/lib_initscr \
112                         base/lib_insch \
113                         base/lib_insdel \
114                         base/lib_insstr \
115                         base/lib_instr \
116                         base/lib_isendwin \
117                         base/lib_leaveok \
118                         base/lib_mouse \
119                         base/lib_move \
120                         base/lib_mvwin \
121                         base/lib_newterm \
122                         base/lib_newwin \
123                         base/lib_nl \
124                         base/lib_overlay \
125                         base/lib_pad \
126                         base/lib_printw \
127                         base/lib_redrawln \
128                         base/lib_refresh \
129                         base/lib_restart \
130                         base/lib_scanw \
131                         base/lib_screen \
132                         base/lib_scroll \
133                         base/lib_scrollok \
134                         base/lib_scrreg \
135                         base/lib_set_term \
136                         base/lib_slk \
137                         base/lib_slkatr_set \
138                         base/lib_slkatrof \
139                         base/lib_slkatron \
140                         base/lib_slkatrset \
141                         base/lib_slkattr \
142                         base/lib_slkclear \
143                         base/lib_slkcolor \
144                         base/lib_slkinit \
145                         base/lib_slklab \
146                         base/lib_slkrefr \
147                         base/lib_slkset \
148                         base/lib_slktouch \
149                         base/lib_touch \
150                         base/lib_ungetch \
151                         base/lib_vline \
152                         base/lib_wattroff \
153                         base/lib_wattron \
154                         base/lib_winch \
155                         base/lib_window \
156                         base/memmove \
157                         base/nc_panel \
158                         base/resizeterm \
159                         base/safe_sprintf \
160                         base/sigaction \
161                         base/tries \
162                         base/version \
163                         base/vsscanf \
164                         base/wresize \
165                         codes \
166                         comp_captab \
167                         expanded \
168                         fallback \
169                         lib_gen \
170                         lib_keyname \
171                         names \
172                         tinfo/access \
173                         tinfo/add_tries \
174                         tinfo/alloc_entry \
175                         tinfo/alloc_ttype \
176                         tinfo/captoinfo \
177                         tinfo/comp_error \
178                         tinfo/comp_expand \
179                         tinfo/comp_hash \
180                         tinfo/comp_parse \
181                         tinfo/comp_scan \
182                         tinfo/doalloc \
183                         tinfo/free_ttype \
184                         tinfo/getenv_num \
185                         tinfo/home_terminfo \
186                         tinfo/init_keytry \
187                         tinfo/lib_acs \
188                         tinfo/lib_baudrate \
189                         tinfo/lib_cur_term \
190                         tinfo/lib_data \
191                         tinfo/lib_has_cap \
192                         tinfo/lib_kernel \
193                         tinfo/lib_longname \
194                         tinfo/lib_napms \
195                         tinfo/lib_options \
196                         tinfo/lib_print \
197                         tinfo/lib_raw \
198                         tinfo/lib_setup \
199                         tinfo/lib_termcap \
200                         tinfo/lib_termname \
201                         tinfo/lib_ti \
202                         tinfo/lib_tparm \
203                         tinfo/lib_tputs \
204                         tinfo/lib_ttyflags \
205                         tinfo/name_match \
206                         tinfo/parse_entry \
207                         tinfo/read_entry \
208                         tinfo/read_termcap \
209                         tinfo/setbuf \
210                         tinfo/write_entry \
211                         trace/lib_trace \
212                         trace/lib_traceatr \
213                         trace/lib_tracebits \
214                         trace/lib_tracechr \
215                         trace/lib_tracedmp \
216                         trace/lib_tracemse \
217                         trace/trace_buf \
218                         trace/trace_tries \
219                         trace/trace_xnames \
220                         tty/hardscroll \
221                         tty/hashmap \
222                         tty/lib_mvcur \
223                         tty/lib_tstp \
224                         tty/lib_vidattr \
225                         tty/lib_twait \
226                         tty/tty_update \
227                         unctrl
228
229 libmenu-routines        = \
230                         m_attribs \
231                         m_cursor \
232                         m_driver \
233                         m_format \
234                         m_global \
235                         m_hook \
236                         m_item_cur \
237                         m_item_nam \
238                         m_item_new \
239                         m_item_opt \
240                         m_item_top \
241                         m_item_use \
242                         m_item_val \
243                         m_item_vis \
244                         m_items \
245                         m_new \
246                         m_opts \
247                         m_pad \
248                         m_pattern \
249                         m_post \
250                         m_req_name \
251                         m_scale \
252                         m_spacing \
253                         m_sub \
254                         m_userptr \
255                         m_win
256
257 libpanel-routines       = \
258                         panel \
259                         p_above \
260                         p_below \
261                         p_bottom \
262                         p_delete \
263                         p_hide \
264                         p_hidden \
265                         p_move \
266                         p_new \
267                         p_replace \
268                         p_show \
269                         p_top \
270                         p_update \
271                         p_user \
272                         p_win
273
274 headers = curses.h eti.h form.h menu.h panel.h term.h termcap.h \
275           unctrl.h
276 others = clear infocmp tic toe tput tset
277 install-bin = $(others)
278
279 clear-objs = clear.o
280 infocmp-objs = infocmp.o dump_entry.o
281 tic-objs = tic.o dump_entry.o
282 toe-objs = toe.o dump_entry.o
283 tput-objs = tput.o
284 tset-objs = tset.o dump_entry.o
285 extra-objs = $(tic-objs) $(toe-objs) $(infocmp-objs) $(clear-objs) \
286                 $(tput-objs) $(tset-objs)
287
288 test-srcs = blue bs cardfile ditto firework firstlast gdc hanoi hashtest knight \
289                 lrtest ncurses newdemo rain tclock testaddch testcurs \
290                 testscanw view worm xmas
291
292 include ../Rules
293
294 ifndef tabsetdir
295 tabsetdir               = $(datadir)/tabset
296 endif
297 ifndef inst_tabsetdir
298 inst_tabsetdir  = $(install_root)/$(tabsetdir)
299 endif
300
301 ifndef terminfodir
302 terminfodir             = $(datadir)/terminfo
303 endif
304 ifndef inst_terminfodir
305 inst_terminfodir        = $(install_root)/$(terminfodir)
306 endif
307
308 ifndef mandir
309 mandir                  = $(prefix)/man
310 endif
311
312 ifndef inst_mandir
313 inst_mandir             = $(install_root)/$(mandir)
314 endif
315
316 CPPFLAGS += -DTERMINFO='"$(terminfodir)"' -Iinclude -Iform -Incurses \
317         -Imenu -Ipanel -Iprogs -Itest
318
319 ifneq ($(strip $(objpfx)),)
320 CPPFLAGS += -I$(objpfx)
321 endif
322
323 LDLIBS-tclock = math/libm
324
325 tests: $(test-srcs:%=$(objpfx)%)
326
327 $(objpfx)clear: $(addprefix $(objpfx),$(clear-objs))
328 $(objpfx)infocmp: $(addprefix $(objpfx),$(infocmp-objs))
329 $(objpfx)tic: $(addprefix $(objpfx),$(tic-objs))
330 $(objpfx)toe: $(addprefix $(objpfx),$(toe-objs))
331 $(objpfx)tput: $(addprefix $(objpfx),$(tput-objs))
332 $(objpfx)tset: $(addprefix $(objpfx),$(tset-objs))
333
334 ifeq ($(build-shared),yes)
335 $(others:%=$(objpfx)%): $(objpfx)libncurses.so
336 else
337 $(others:%=$(objpfx)%): $(objpfx)libncurses.a
338 endif
339
340 $(test-srcs:%=$(objpfx)%): $(objpfx)libform.a $(objpfx)libmenu.a \
341         $(objpfx)libpanel.a $(objpfx)libncurses.a
342
343 # Depend on libc.so so a DT_NEEDED is generated in the shared objects.
344 # This ensures they will load libc.so for needed symbols if loaded by
345 # a statically-linked program that hasn't already loaded it.
346 $(extras:%=$(objpfx)lib%.so): $(common-objpfx)libc.so
347
348 subdir_install: $(inst_libdir)/libtermcap.a $(inst_libdir)/libcurses.a \
349         $(inst_bindir)/reset $(inst_bindir)/captoinfo
350
351 $(inst_libdir)/libtermcap.a $(inst_libdir)/libcurses.a: \
352                 $(inst_libdir)/libncurses.a
353         $(make-link)
354
355 $(inst_bindir)/reset: $(inst_bindir)/tset
356         $(make-link)
357
358 $(inst_bindir)/captoinfo: $(inst_bindir)/tic
359         $(make-link)
360
361 ifeq (yes,$(build-shared))
362 subdir_install: $(inst_libdir)/libtermcap.so  $(inst_libdir)/libcurses.so
363
364 $(inst_libdir)/libtermcap.so $(inst_libdir)/libcurses.so: \
365                 $(inst_libdir)/libncurses.so
366         $(make-link)
367 endif
368
369 subdir_install: $(inst_mandir)/man5/terminfo.5
370
371 $(inst_mandir)/man5/terminfo.5: $(objpfx)terminfo.5 $(wildcard man/*.[0-9]*)
372         $(make-target-directory)
373         sh $(edit_man-sh) $(prefix) $(inst_mandir) $(edit_man-sed) $^
374
375 subdir_install: $(inst_tabsetdir)/std
376
377 $(inst_tabsetdir)/std: \
378         $(filter-out misc/tabset/CVS, $(wildcard misc/tabset/*))
379         $(make-target-directory)
380         for f in $^; do \
381           echo installing $$f; \
382           $(INSTALL_DATA) $$f $(inst_tabsetdir); \
383         done
384
385
386 ifeq (no,$(cross-compiling))
387 subdir_install: $(inst_terminfodir)/v/vt100
388
389 $(inst_terminfodir)/v/vt100: misc/terminfo.src $(objpfx)tic
390         $(make-target-directory)
391         sh $(run_tic-sh) $(common-objpfx) misc $(terminfodir) \
392                 $(install_root)
393 endif
394
395 subdir_distclean subdir_realclean:
396         -rm -f $(addprefix $(objpfx), MKterm.h.awk codes.c \
397                 comp_captab.c confdefs.h config.log curses.h \
398                 expanded.c fallback.c hashsize.h keys.tries \
399                 lib_gen.c lib_keyname.c names.c ncurses_cfg.h \
400                 nomacros.h parametrized.h term.h termcap.h \
401                 terminfo.5 termsort.c unctrl.c unctrl.h)