1# $Id: Makefile.in,v 1.65 2005/09/25 00:42:08 tom Exp $
2##############################################################################
3# Copyright (c) 1998-2003,2005 Free Software Foundation, Inc.                #
4#                                                                            #
5# Permission is hereby granted, free of charge, to any person obtaining a    #
6# copy of this software and associated documentation files (the "Software"), #
7# to deal in the Software without restriction, including without limitation  #
8# the rights to use, copy, modify, merge, publish, distribute, distribute    #
9# with modifications, sublicense, and/or sell copies of the Software, and to #
10# permit persons to whom the Software is furnished to do so, subject to the  #
11# following conditions:                                                      #
12#                                                                            #
13# The above copyright notice and this permission notice shall be included in #
14# all copies or substantial portions of the Software.                        #
15#                                                                            #
16# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
17# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,   #
18# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL    #
19# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER      #
20# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING    #
21# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER        #
22# DEALINGS IN THE SOFTWARE.                                                  #
23#                                                                            #
24# Except as contained in this notice, the name(s) of the above copyright     #
25# holders shall not be used in advertising or otherwise to promote the sale, #
26# use or other dealings in this Software without prior written               #
27# authorization.                                                             #
28##############################################################################
29#
30# Author: Thomas E. Dickey 1996-2003
31#
32# Makefile for ncurses source code.
33#
34# This makes the ncurses utility programs.
35#
36# The variable 'srcdir' refers to the source-distribution, and can be set with
37# the configure script by "--srcdir=DIR".
38#
39# The rules are organized to produce the libraries for the configured models,
40# and the programs with the configured default model.
41
42# turn off _all_ suffix rules; we'll generate our own
43.SUFFIXES:
44
45SHELL		= /bin/sh
46THIS		= Makefile
47
48CF_MFLAGS 	= 
49
50
51x		= 
52o		= .o
53
54MODEL		= ../objects
55DESTDIR		= 
56top_srcdir	= ..
57srcdir		= .
58prefix		= /usr/local
59exec_prefix	= ${prefix}
60bindir		= ${exec_prefix}/bin
61libdir		= ${exec_prefix}/lib
62includedir	= $(prefix)/include/ncurses
63datadir		= ${prefix}/share
64
65LIBTOOL		= 
66LIBTOOL_CLEAN	= 
67LIBTOOL_COMPILE	= 
68LIBTOOL_LINK	= 
69LIBTOOL_INSTALL	= 
70LIBTOOL_UNINSTALL = 
71
72INSTALL		= /bin/install -c
73INSTALL_PROGRAM	= ${INSTALL}
74transform	= s,x,x,
75
76AWK		= gawk
77LN_S		= ln -s
78
79CC		= gcc
80CPP		= gcc -E
81CFLAGS		= -O2
82
83INCDIR		= $(top_srcdir)/include
84CPPFLAGS	= -I../progs -I$(srcdir) -DHAVE_CONFIG_H -I. -I../include  -D_XOPEN_SOURCE=500 -D_POSIX_C_SOURCE=199506L -DNDEBUG -I$(includedir)
85
86CCFLAGS		= $(CPPFLAGS) $(CFLAGS)
87
88CFLAGS_LIBTOOL	= $(CCFLAGS)
89CFLAGS_NORMAL	= $(CCFLAGS)
90CFLAGS_DEBUG	= $(CCFLAGS) -g -DTRACE
91CFLAGS_PROFILE	= $(CCFLAGS) -pg
92CFLAGS_SHARED	= $(CCFLAGS) -fPIC
93
94CFLAGS_DEFAULT	= $(CFLAGS_NORMAL)
95
96LD		= ld
97LINK		=  $(LIBTOOL_LINK) $(CC)
98LDFLAGS		=  \
99		-L../lib -lncurses   
100
101LDFLAGS_LIBTOOL	= $(LDFLAGS) $(CFLAGS_LIBTOOL)
102LDFLAGS_NORMAL	= $(LDFLAGS) $(CFLAGS_NORMAL)
103LDFLAGS_DEBUG	= $(LDFLAGS) $(CFLAGS_DEBUG)
104LDFLAGS_PROFILE	= $(LDFLAGS) $(CFLAGS_PROFILE) 
105LDFLAGS_SHARED	= $(LDFLAGS) $(CFLAGS_SHARED) 
106
107LDFLAGS_DEFAULT	= $(LDFLAGS_NORMAL)
108
109LINT		= 
110LINT_OPTS	= 
111LINT_LIBS	= -lncurses 
112
113AUTO_SRC = \
114	termsort.c \
115	transform.h
116
117# tic and toe rely on direct access to the terminfo database
118GET_PROGS = infocmp$x clear$x tput$x tset$x
119PUT_PROGS =  tic$x toe$x
120PROGS = $(PUT_PROGS) $(GET_PROGS)
121
122TESTPROGS = mvcur$x tctest$x hardscroll$x hashmap$x
123
124# Default library, for linking applications
125DEPS_CURSES = ../lib/libncurses.a
126
127HEADER_DEPS	= \
128	../include/curses.h \
129	$(INCDIR)/term_entry.h \
130	$(INCDIR)/tic.h \
131	$(INCDIR)/nc_alloc.h
132
133################################################################################
134all:		$(AUTO_SRC) $(PROGS)
135
136sources:	$(AUTO_SRC)
137
138install: 	$(AUTO_SRC) install.progs
139uninstall: uninstall.progs
140
141# this line simplifies the configure-script
142libs \
143install.libs \
144uninstall.libs:
145
146TRANSFORM = sed 's/$x$$//'|sed '$(transform)'|sed 's/$$/$x/'
147
148actual_captoinfo = `echo captoinfo$x| $(TRANSFORM)`
149actual_clear     = `echo clear$x|     $(TRANSFORM)`
150actual_infocmp   = `echo infocmp$x|   $(TRANSFORM)`
151actual_infotocap = `echo infotocap$x| $(TRANSFORM)`
152actual_init      = `echo init$x|      $(TRANSFORM)`
153actual_reset     = `echo reset$x|     $(TRANSFORM)`
154actual_tic       = `echo tic$x|       $(TRANSFORM)`
155actual_toe       = `echo toe$x|       $(TRANSFORM)`
156actual_tput      = `echo tput$x|      $(TRANSFORM)`
157actual_tset      = `echo tset$x|      $(TRANSFORM)`
158
159transform.h :
160	echo "#define PROG_CAPTOINFO \"$(actual_captoinfo)\"" >$@
161	echo "#define PROG_INFOTOCAP \"$(actual_infotocap)\"" >>$@
162	echo "#define PROG_RESET     \"$(actual_reset)\""     >>$@
163	echo "#define PROG_INIT      \"$(actual_init)\""      >>$@
164
165install.progs: $(AUTO_SRC) $(PROGS) $(DESTDIR)$(bindir)
166	$(LIBTOOL_INSTALL) $(INSTALL_PROGRAM) tic$x     $(DESTDIR)$(bindir)/$(actual_tic)
167	$(LIBTOOL_INSTALL) $(INSTALL_PROGRAM) toe$x     $(DESTDIR)$(bindir)/$(actual_toe)
168	@echo "linking $(actual_infotocap) to $(actual_tic)"
169	-@rm -f $(DESTDIR)$(bindir)/$(actual_infotocap)
170	(cd $(DESTDIR)$(bindir) && $(LN_S) $(actual_tic) $(actual_infotocap))
171	@echo "linking $(actual_captoinfo) to $(actual_tic)"
172	-@rm -f $(DESTDIR)$(bindir)/$(actual_captoinfo)
173	(cd $(DESTDIR)$(bindir) && $(LN_S) $(actual_tic) $(actual_captoinfo))
174	$(LIBTOOL_INSTALL) $(INSTALL_PROGRAM) infocmp$x $(DESTDIR)$(bindir)/$(actual_infocmp)
175	$(LIBTOOL_INSTALL) $(INSTALL_PROGRAM) clear$x   $(DESTDIR)$(bindir)/$(actual_clear)
176	$(LIBTOOL_INSTALL) $(INSTALL_PROGRAM) tput$x    $(DESTDIR)$(bindir)/$(actual_tput)
177	$(LIBTOOL_INSTALL) $(INSTALL_PROGRAM) tset$x    $(DESTDIR)$(bindir)/$(actual_tset)
178	@echo "linking $(actual_reset) to $(actual_tset)"
179	-@rm -f $(DESTDIR)$(bindir)/$(actual_reset)
180	(cd $(DESTDIR)$(bindir) && $(LN_S) $(actual_tset) $(actual_reset))
181
182uninstall.progs:
183	-@$(LIBTOOL_CLEAN) rm -f $(DESTDIR)$(bindir)/$(actual_tic)
184	-@$(LIBTOOL_CLEAN) rm -f $(DESTDIR)$(bindir)/$(actual_toe)
185	-@rm -f $(DESTDIR)$(bindir)/$(actual_captoinfo)
186	-@rm -f $(DESTDIR)$(bindir)/$(actual_infotocap)
187	-@$(LIBTOOL_CLEAN) rm -f $(DESTDIR)$(bindir)/$(actual_infocmp)
188	-@$(LIBTOOL_CLEAN) rm -f $(DESTDIR)$(bindir)/$(actual_clear)
189	-@$(LIBTOOL_CLEAN) rm -f $(DESTDIR)$(bindir)/$(actual_tput)
190	-@$(LIBTOOL_CLEAN) rm -f $(DESTDIR)$(bindir)/$(actual_tset)
191	-@rm -f $(DESTDIR)$(bindir)/$(actual_reset)
192
193$(DESTDIR)$(bindir) :
194	sh $(srcdir)/../mkinstalldirs $@
195
196#
197# Utilities normally built by make all start here
198#
199
200DEPS_TIC = \
201	$(MODEL)/tic$o \
202	$(MODEL)/dump_entry$o
203
204tic$x: $(DEPS_TIC) $(DEPS_CURSES) transform.h
205	 $(LINK) $(DEPS_TIC) $(LDFLAGS_DEFAULT) -o $@
206
207DEPS_TOE = \
208	$(MODEL)/toe$o \
209	$(MODEL)/dump_entry$o
210
211toe$x: $(DEPS_TOE) $(DEPS_CURSES)
212	 $(LINK) $(DEPS_TOE) $(LDFLAGS_DEFAULT) -o $@
213
214DEPS_CLEAR = \
215	$(MODEL)/clear$o
216
217clear$x: $(DEPS_CLEAR) $(DEPS_CURSES)
218	 $(LINK) $(DEPS_CLEAR) $(LDFLAGS_DEFAULT) -o $@
219
220DEPS_TPUT = \
221	$(MODEL)/tput$o
222
223tput$x: $(DEPS_TPUT) $(DEPS_CURSES) transform.h
224	 $(LINK) $(DEPS_TPUT) $(LDFLAGS_DEFAULT) -o $@
225
226DEPS_INFOCMP = \
227	$(MODEL)/infocmp$o \
228	$(MODEL)/dump_entry$o
229
230infocmp$x: $(DEPS_INFOCMP) $(DEPS_CURSES)
231	 $(LINK) $(DEPS_INFOCMP) $(LDFLAGS_DEFAULT) -o $@
232
233DEPS_TSET = \
234	$(MODEL)/tset$o \
235	$(MODEL)/dump_entry$o
236
237tset$x: $(DEPS_TSET) $(DEPS_CURSES) transform.h
238	 $(LINK) $(DEPS_TSET) $(LDFLAGS_DEFAULT) -o $@
239
240termsort.c: $(srcdir)/MKtermsort.sh
241	sh $(srcdir)/MKtermsort.sh $(AWK) $(srcdir)/../include/Caps >$@
242
243#
244# Utility productions start here
245#
246
247tags:
248	ctags *.[ch]
249
250TAGS:
251	etags *.[ch]
252
253mostlyclean ::
254	-rm -f core tags TAGS *~ *.bak *.i *.ln *.atac trace
255	-rm -f $(TESTPROGS)
256
257clean :: mostlyclean
258	-sh -c "if test -n '$x' ; then $(MAKE) clean x=''; fi"
259	-rm -f $(AUTO_SRC)
260	-rm -f $(PROGS)
261	-rm -rf .libs
262
263distclean :: clean
264	-rm -f Makefile
265
266realclean :: distclean
267
268# These rules are used to allow "make -n" to work on a clean directory-tree
269../include/hashsize.h \
270../include/parametrized.h \
271../include/term.h :
272	cd ../include; $(MAKE) $(CF_MFLAGS)
273$(DEPS_CURSES) :
274	cd ../ncurses; $(MAKE) $(CF_MFLAGS)
275
276lint:
277	$(LINT) $(LINT_OPTS) $(CPPFLAGS) $(srcdir)/tic.c     $(srcdir)/dump_entry.c $(LINT_LIBS)
278	$(LINT) $(LINT_OPTS) $(CPPFLAGS) $(srcdir)/toe.c     $(srcdir)/dump_entry.c $(LINT_LIBS)
279	$(LINT) $(LINT_OPTS) $(CPPFLAGS) $(srcdir)/clear.c                          $(LINT_LIBS)
280	$(LINT) $(LINT_OPTS) $(CPPFLAGS) $(srcdir)/infocmp.c $(srcdir)/dump_entry.c $(LINT_LIBS)
281	$(LINT) $(LINT_OPTS) $(CPPFLAGS) $(srcdir)/tput.c                           $(LINT_LIBS)
282	$(LINT) $(LINT_OPTS) $(CPPFLAGS) $(srcdir)/tset.c    $(srcdir)/dump_entry.c $(LINT_LIBS)
283
284###############################################################################
285# The remainder of this file is automatically generated during configuration
286###############################################################################
287
288# generated by mk-0th.awk
289#   libname:    progs
290#   subsets:    termlib+ext_tinfo+base+ext_funcs
291
292.SUFFIXES: .c .cc .h .i .ii
293.c.i :
294	$(CPP) $(CPPFLAGS) $< >$@
295.cc.ii :
296	$(CPP) $(CPPFLAGS) $< >$@
297.h.i :
298	$(CPP) $(CPPFLAGS) $< >$@
299
300C_SRC = \
301	$(srcdir)/clear.c \
302	$(srcdir)/tic.c \
303	$(srcdir)/toe.c \
304	$(srcdir)/dump_entry.c \
305	$(srcdir)/infocmp.c \
306	$(srcdir)/tput.c \
307	$(srcdir)/tset.c
308
309lintlib :
310	@echo no action needed
311
312# generated by mk-1st.awk (subset=termlib+ext_tinfo+base+ext_funcs)
313#  name:          progs
314#  traces:        DEBUG
315#  MODEL:         NORMAL
316#  model:         objects
317#  prefix:        lib
318#  suffix:        .a
319#  subset:        termlib+ext_tinfo+base+ext_funcs
320#  ShlibVer:      auto
321#  ShlibVerInfix: no
322#  DoLinks:       no
323#  rmSoLocs:      no
324#  ldconfig:      
325#  overwrite:     no
326#  depend:        ../include/ncurses_cfg.h ./progs.priv.h
327#  host:          i586-pc-beos
328
329NORMAL_OBJS = \
330	../objects/clear$o \
331	../objects/tic$o \
332	../objects/toe$o \
333	../objects/dump_entry$o \
334	../objects/infocmp$o \
335	../objects/tput$o \
336	../objects/tset$o
337
338$(NORMAL_OBJS) : ../include/ncurses_cfg.h ./progs.priv.h
339
340mostlyclean::
341	-rm -f $(NORMAL_OBJS)
342
343clean ::
344	-rm -f $(NORMAL_OBJS)
345
346# generated by mk-2nd.awk
347#   model:      objects
348#   MODEL:      NORMAL
349#   echo:       yes
350#   subset:     termlib+ext_tinfo+base+ext_funcs
351#   crenames:   yes
352#   cxxrenames: yes
353#   traces:     DEBUG
354#   srcdir:     .
355
356../objects/clear$o :	$(srcdir)/clear.c \
357			$(HEADER_DEPS)
358	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../progs/clear.c -o ../objects/clear$o
359
360../objects/tic$o :	$(srcdir)/tic.c \
361			$(HEADER_DEPS) \
362			transform.h \
363			$(srcdir)/dump_entry.h
364	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../progs/tic.c -o ../objects/tic$o
365
366../objects/toe$o :	$(srcdir)/toe.c \
367			$(HEADER_DEPS) \
368			$(srcdir)/dump_entry.h
369	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../progs/toe.c -o ../objects/toe$o
370
371../objects/dump_entry$o :	$(srcdir)/dump_entry.c \
372			$(HEADER_DEPS) \
373			$(srcdir)/dump_entry.h \
374			../include/parametrized.h \
375			$(INCDIR)/capdefaults.c \
376			termsort.c
377	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../progs/dump_entry.c -o ../objects/dump_entry$o
378
379../objects/infocmp$o :	$(srcdir)/infocmp.c \
380			$(HEADER_DEPS) \
381			$(srcdir)/dump_entry.h
382	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../progs/infocmp.c -o ../objects/infocmp$o
383
384../objects/tput$o :	$(srcdir)/tput.c \
385			$(HEADER_DEPS) \
386			transform.h \
387			termsort.c
388	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../progs/tput.c -o ../objects/tput$o
389
390../objects/tset$o :	$(srcdir)/tset.c \
391			$(HEADER_DEPS) \
392			transform.h \
393			$(srcdir)/dump_entry.h \
394			../include/termcap.h
395	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../progs/tset.c -o ../objects/tset$o
396
397
398# generated by mk-1st.awk (subset=termlib+ext_tinfo+base+ext_funcs)
399#  name:          progs
400#  traces:        DEBUG
401#  MODEL:         DEBUG
402#  model:         obj_g
403#  prefix:        lib
404#  suffix:        _g.a
405#  subset:        termlib+ext_tinfo+base+ext_funcs
406#  ShlibVer:      auto
407#  ShlibVerInfix: no
408#  DoLinks:       no
409#  rmSoLocs:      no
410#  ldconfig:      
411#  overwrite:     no
412#  depend:        ../include/ncurses_cfg.h ./progs.priv.h
413#  host:          i586-pc-beos
414
415DEBUG_OBJS = \
416	../obj_g/clear$o \
417	../obj_g/tic$o \
418	../obj_g/toe$o \
419	../obj_g/dump_entry$o \
420	../obj_g/infocmp$o \
421	../obj_g/tput$o \
422	../obj_g/tset$o
423
424$(DEBUG_OBJS) : ../include/ncurses_cfg.h ./progs.priv.h
425
426mostlyclean::
427	-rm -f $(DEBUG_OBJS)
428
429clean ::
430	-rm -f $(DEBUG_OBJS)
431
432# generated by mk-2nd.awk
433#   model:      obj_g
434#   MODEL:      DEBUG
435#   echo:       yes
436#   subset:     termlib+ext_tinfo+base+ext_funcs
437#   crenames:   yes
438#   cxxrenames: yes
439#   traces:     DEBUG
440#   srcdir:     .
441
442../obj_g/clear$o :	$(srcdir)/clear.c \
443			$(HEADER_DEPS)
444	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../progs/clear.c -o ../obj_g/clear$o
445
446../obj_g/tic$o :	$(srcdir)/tic.c \
447			$(HEADER_DEPS) \
448			transform.h \
449			$(srcdir)/dump_entry.h
450	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../progs/tic.c -o ../obj_g/tic$o
451
452../obj_g/toe$o :	$(srcdir)/toe.c \
453			$(HEADER_DEPS) \
454			$(srcdir)/dump_entry.h
455	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../progs/toe.c -o ../obj_g/toe$o
456
457../obj_g/dump_entry$o :	$(srcdir)/dump_entry.c \
458			$(HEADER_DEPS) \
459			$(srcdir)/dump_entry.h \
460			../include/parametrized.h \
461			$(INCDIR)/capdefaults.c \
462			termsort.c
463	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../progs/dump_entry.c -o ../obj_g/dump_entry$o
464
465../obj_g/infocmp$o :	$(srcdir)/infocmp.c \
466			$(HEADER_DEPS) \
467			$(srcdir)/dump_entry.h
468	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../progs/infocmp.c -o ../obj_g/infocmp$o
469
470../obj_g/tput$o :	$(srcdir)/tput.c \
471			$(HEADER_DEPS) \
472			transform.h \
473			termsort.c
474	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../progs/tput.c -o ../obj_g/tput$o
475
476../obj_g/tset$o :	$(srcdir)/tset.c \
477			$(HEADER_DEPS) \
478			transform.h \
479			$(srcdir)/dump_entry.h \
480			../include/termcap.h
481	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../progs/tset.c -o ../obj_g/tset$o
482
483depend : $(AUTO_SRC)
484	makedepend -- $(CPPFLAGS) -- $(C_SRC)
485
486# DO NOT DELETE THIS LINE -- make depend depends on it.
487