ncurses 5.2
[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_tgoto \
202                         tinfo/lib_ti \
203                         tinfo/lib_tparm \
204                         tinfo/lib_tputs \
205                         tinfo/lib_ttyflags \
206                         tinfo/name_match \
207                         tinfo/parse_entry \
208                         tinfo/read_entry \
209                         tinfo/read_termcap \
210                         tinfo/setbuf \
211                         tinfo/strings \
212                         tinfo/write_entry \
213                         trace/lib_trace \
214                         trace/lib_traceatr \
215                         trace/lib_tracebits \
216                         trace/lib_tracechr \
217                         trace/lib_tracedmp \
218                         trace/lib_tracemse \
219                         trace/trace_buf \
220                         trace/trace_tries \
221                         trace/trace_xnames \
222                         tty/hardscroll \
223                         tty/hashmap \
224                         tty/lib_mvcur \
225                         tty/lib_tstp \
226                         tty/lib_vidattr \
227                         tty/lib_twait \
228                         tty/tty_update \
229                         unctrl
230
231 libmenu-routines        = \
232                         m_attribs \
233                         m_cursor \
234                         m_driver \
235                         m_format \
236                         m_global \
237                         m_hook \
238                         m_item_cur \
239                         m_item_nam \
240                         m_item_new \
241                         m_item_opt \
242                         m_item_top \
243                         m_item_use \
244                         m_item_val \
245                         m_item_vis \
246                         m_items \
247                         m_new \
248                         m_opts \
249                         m_pad \
250                         m_pattern \
251                         m_post \
252                         m_req_name \
253                         m_scale \
254                         m_spacing \
255                         m_sub \
256                         m_userptr \
257                         m_win
258
259 libpanel-routines       = \
260                         panel \
261                         p_above \
262                         p_below \
263                         p_bottom \
264                         p_delete \
265                         p_hide \
266                         p_hidden \
267                         p_move \
268                         p_new \
269                         p_replace \
270                         p_show \
271                         p_top \
272                         p_update \
273                         p_user \
274                         p_win
275
276 headers = curses.h eti.h form.h menu.h panel.h term.h termcap.h \
277           unctrl.h
278 others = clear infocmp tic toe tput tset
279 install-bin = $(others)
280
281 clear-objs = clear.o
282 infocmp-objs = infocmp.o dump_entry.o
283 tic-objs = tic.o dump_entry.o
284 toe-objs = toe.o dump_entry.o
285 tput-objs = tput.o
286 tset-objs = tset.o dump_entry.o
287 extra-objs = $(tic-objs) $(toe-objs) $(infocmp-objs) $(clear-objs) \
288                 $(tput-objs) $(tset-objs)
289
290 test-srcs = blue bs cardfile ditto firework firstlast gdc hanoi hashtest knight \
291                 lrtest ncurses newdemo rain tclock testaddch testcurs \
292                 testscanw view worm xmas
293
294 include ../Rules
295
296 ifndef tabsetdir
297 tabsetdir               = $(datadir)/tabset
298 endif
299 ifndef inst_tabsetdir
300 inst_tabsetdir  = $(install_root)/$(tabsetdir)
301 endif
302
303 ifndef terminfodir
304 terminfodir             = $(datadir)/terminfo
305 endif
306 ifndef inst_terminfodir
307 inst_terminfodir        = $(install_root)/$(terminfodir)
308 endif
309
310 ifndef mandir
311 mandir                  = $(prefix)/man
312 endif
313
314 ifndef inst_mandir
315 inst_mandir             = $(install_root)/$(mandir)
316 endif
317
318 CPPFLAGS += -DTERMINFO='"$(terminfodir)"' -Iinclude -Iform -Incurses \
319         -Imenu -Ipanel -Iprogs -Itest
320
321 ifneq ($(strip $(objpfx)),)
322 CPPFLAGS += -I$(objpfx)
323 endif
324
325 LDLIBS-tclock = math/libm
326
327 tests: $(test-srcs:%=$(objpfx)%)
328
329 $(objpfx)clear: $(addprefix $(objpfx),$(clear-objs))
330 $(objpfx)infocmp: $(addprefix $(objpfx),$(infocmp-objs))
331 $(objpfx)tic: $(addprefix $(objpfx),$(tic-objs))
332 $(objpfx)toe: $(addprefix $(objpfx),$(toe-objs))
333 $(objpfx)tput: $(addprefix $(objpfx),$(tput-objs))
334 $(objpfx)tset: $(addprefix $(objpfx),$(tset-objs))
335
336 ifeq ($(build-shared),yes)
337 $(others:%=$(objpfx)%): $(objpfx)libncurses.so
338 else
339 $(others:%=$(objpfx)%): $(objpfx)libncurses.a
340 endif
341
342 $(test-srcs:%=$(objpfx)%): $(objpfx)libform.a $(objpfx)libmenu.a \
343         $(objpfx)libpanel.a $(objpfx)libncurses.a
344
345 # Depend on libc.so so a DT_NEEDED is generated in the shared objects.
346 # This ensures they will load libc.so for needed symbols if loaded by
347 # a statically-linked program that hasn't already loaded it.
348 $(extras:%=$(objpfx)lib%.so): $(common-objpfx)libc.so
349
350 subdir_install: $(inst_libdir)/libtermcap.a $(inst_libdir)/libcurses.a \
351         $(inst_bindir)/reset $(inst_bindir)/captoinfo
352
353 $(inst_libdir)/libtermcap.a $(inst_libdir)/libcurses.a: \
354                 $(inst_libdir)/libncurses.a
355         $(make-link)
356
357 $(inst_bindir)/reset: $(inst_bindir)/tset
358         $(make-link)
359
360 $(inst_bindir)/captoinfo: $(inst_bindir)/tic
361         $(make-link)
362
363 ifeq (yes,$(build-shared))
364 subdir_install: $(inst_libdir)/libtermcap.so  $(inst_libdir)/libcurses.so
365
366 $(inst_libdir)/libtermcap.so $(inst_libdir)/libcurses.so: \
367                 $(inst_libdir)/libncurses.so
368         $(make-link)
369 endif
370
371 subdir_install: $(inst_mandir)/man5/terminfo.5
372
373 $(inst_mandir)/man5/terminfo.5: $(objpfx)terminfo.5 $(wildcard man/*.[0-9]*)
374         $(make-target-directory)
375         sh $(edit_man-sh) $(prefix) $(inst_mandir) $(edit_man-sed) $^
376
377 subdir_install: $(inst_tabsetdir)/std
378
379 $(inst_tabsetdir)/std: \
380         $(filter-out misc/tabset/CVS, $(wildcard misc/tabset/*))
381         $(make-target-directory)
382         for f in $^; do \
383           echo installing $$f; \
384           $(INSTALL_DATA) $$f $(inst_tabsetdir); \
385         done
386
387
388 ifeq (no,$(cross-compiling))
389 subdir_install: $(inst_terminfodir)/v/vt100
390
391 $(inst_terminfodir)/v/vt100: misc/terminfo.src $(objpfx)tic
392         $(make-target-directory)
393         sh $(run_tic-sh) $(common-objpfx) misc $(terminfodir) \
394                 $(install_root)
395 endif
396
397 subdir_distclean subdir_realclean:
398         -rm -f $(addprefix $(objpfx), MKterm.h.awk codes.c \
399                 comp_captab.c confdefs.h config.log curses.h \
400                 expanded.c fallback.c hashsize.h keys.tries \
401                 lib_gen.c lib_keyname.c names.c ncurses_cfg.h \
402                 nomacros.h parametrized.h term.h termcap.h \
403                 terminfo.5 termsort.c unctrl.c unctrl.h)