xref: /freebsd/contrib/ncurses/progs/Makefile.in (revision f0a75d274af375d15b97b830966b99a02b7db911)
1# $Id: Makefile.in,v 1.70 2006/12/17 15:55:48 tom Exp $
2##############################################################################
3# Copyright (c) 1998-2005,2006 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-on
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 	= @cf_cv_makeflags@
49@SET_MAKE@
50
51x		= @EXEEXT@
52o		= .@OBJEXT@
53
54MODEL		= ../@DFT_OBJ_SUBDIR@
55DESTDIR		= @DESTDIR@
56top_srcdir	= @top_srcdir@
57srcdir		= @srcdir@
58prefix		= @prefix@
59exec_prefix	= @exec_prefix@
60bindir		= @bindir@
61libdir		= @libdir@
62includedir	= @includedir@
63datadir		= @datadir@
64
65LIBTOOL		= @LIBTOOL@
66LIBTOOL_CLEAN	= @LIB_CLEAN@
67LIBTOOL_COMPILE	= @LIB_COMPILE@
68LIBTOOL_LINK	= @LIB_LINK@
69LIBTOOL_INSTALL	= @LIB_INSTALL@
70LIBTOOL_UNINSTALL = @LIB_UNINSTALL@
71
72INSTALL		= @INSTALL@
73INSTALL_PROG	= @INSTALL_PROGRAM@
74transform	= @program_transform_name@
75
76AWK		= @AWK@
77LN_S		= @LN_S@
78
79CC		= @CC@
80CPP		= @CPP@
81CFLAGS		= @CFLAGS@
82
83INCDIR		= $(top_srcdir)/include
84CPPFLAGS	= -I../progs -I$(srcdir) -DHAVE_CONFIG_H @CPPFLAGS@
85
86CCFLAGS		= $(CPPFLAGS) $(CFLAGS)
87
88CFLAGS_LIBTOOL	= $(CCFLAGS)
89CFLAGS_NORMAL	= $(CCFLAGS)
90CFLAGS_DEBUG	= $(CCFLAGS) @CC_G_OPT@ -DTRACE
91CFLAGS_PROFILE	= $(CCFLAGS) -pg
92CFLAGS_SHARED	= $(CCFLAGS) @CC_SHARED_OPTS@
93
94CFLAGS_DEFAULT	= $(CFLAGS_@DFT_UPR_MODEL@)
95
96REL_VERSION	= @cf_cv_rel_version@
97ABI_VERSION	= @cf_cv_abi_version@
98LOCAL_LIBDIR	= @top_builddir@/lib
99
100LD		= @LD@
101LINK		= @LINK_PROGS@ $(LIBTOOL_LINK) $(CC)
102LDFLAGS		= @EXTRA_LDFLAGS@ \
103		@TINFO_ARGS@ @LDFLAGS@ @LD_MODEL@ @LIBS@
104
105LDFLAGS_LIBTOOL	= $(LDFLAGS) $(CFLAGS_LIBTOOL)
106LDFLAGS_NORMAL	= $(LDFLAGS) $(CFLAGS_NORMAL)
107LDFLAGS_DEBUG	= $(LDFLAGS) $(CFLAGS_DEBUG)
108LDFLAGS_PROFILE	= $(LDFLAGS) $(CFLAGS_PROFILE)
109LDFLAGS_SHARED	= $(LDFLAGS) $(CFLAGS_SHARED) @LD_SHARED_OPTS@
110
111LDFLAGS_DEFAULT	= $(LDFLAGS_@DFT_UPR_MODEL@)
112
113LINT		= @LINT@
114LINT_OPTS	= @LINT_OPTS@
115LINT_LIBS	= -lncurses @LIBS@
116
117AUTO_SRC = \
118	termsort.c \
119	transform.h
120
121# tic relies on direct access to the terminfo database
122GET_PROGS = infocmp$x clear$x tput$x tset$x toe$x
123PUT_PROGS = @MAKE_TERMINFO@ tic$x
124PROGS = $(PUT_PROGS) $(GET_PROGS)
125
126# Default library, for linking applications
127DEPS_CURSES = ../lib/@LIB_PREFIX@ncurses@DFT_DEP_SUFFIX@
128
129HEADER_DEPS	= \
130	../include/curses.h \
131	$(INCDIR)/term_entry.h \
132	$(INCDIR)/tic.h \
133	$(INCDIR)/nc_alloc.h
134
135################################################################################
136all:		$(AUTO_SRC) $(PROGS)
137
138sources:	$(AUTO_SRC)
139
140install: 	$(AUTO_SRC) install.progs
141uninstall: uninstall.progs
142
143# this line simplifies the configure-script
144libs \
145install.libs \
146uninstall.libs:
147
148TRANSFORM = sed 's/$x$$//'|sed '$(transform)'|sed 's/$$/$x/'
149
150# transformed names for installing files
151actual_captoinfo = `echo captoinfo$x| $(TRANSFORM)`
152actual_clear     = `echo clear$x|     $(TRANSFORM)`
153actual_infocmp   = `echo infocmp$x|   $(TRANSFORM)`
154actual_infotocap = `echo infotocap$x| $(TRANSFORM)`
155actual_init      = `echo init$x|      $(TRANSFORM)`
156actual_reset     = `echo reset$x|     $(TRANSFORM)`
157actual_tic       = `echo tic$x|       $(TRANSFORM)`
158actual_toe       = `echo toe$x|       $(TRANSFORM)`
159actual_tput      = `echo tput$x|      $(TRANSFORM)`
160actual_tset      = `echo tset$x|      $(TRANSFORM)`
161
162# transformed names for comparing at runtime
163define_captoinfo = `echo captoinfo|   $(TRANSFORM)`
164define_infotocap = `echo infotocap|   $(TRANSFORM)`
165define_init      = `echo init|        $(TRANSFORM)`
166define_reset     = `echo reset|       $(TRANSFORM)`
167
168transform.h :
169	echo "#define PROG_CAPTOINFO \"$(define_captoinfo)\"" >$@
170	echo "#define PROG_INFOTOCAP \"$(define_infotocap)\"" >>$@
171	echo "#define PROG_RESET     \"$(define_reset)\""     >>$@
172	echo "#define PROG_INIT      \"$(define_init)\""      >>$@
173
174install.progs: $(AUTO_SRC) $(PROGS) $(DESTDIR)$(bindir)
175@MAKE_TERMINFO@	$(LIBTOOL_INSTALL) $(INSTALL_PROG) tic$x     $(DESTDIR)$(bindir)/$(actual_tic)
176@MAKE_TERMINFO@	$(LIBTOOL_INSTALL) $(INSTALL_PROG) toe$x     $(DESTDIR)$(bindir)/$(actual_toe)
177@MAKE_TERMINFO@	@echo "linking $(actual_infotocap) to $(actual_tic)"
178@MAKE_TERMINFO@	-@rm -f $(DESTDIR)$(bindir)/$(actual_infotocap)
179@MAKE_TERMINFO@	(cd $(DESTDIR)$(bindir) && $(LN_S) $(actual_tic) $(actual_infotocap))
180@MAKE_TERMINFO@	@echo "linking $(actual_captoinfo) to $(actual_tic)"
181@MAKE_TERMINFO@	-@rm -f $(DESTDIR)$(bindir)/$(actual_captoinfo)
182@MAKE_TERMINFO@	(cd $(DESTDIR)$(bindir) && $(LN_S) $(actual_tic) $(actual_captoinfo))
183	$(LIBTOOL_INSTALL) $(INSTALL_PROG) infocmp$x $(DESTDIR)$(bindir)/$(actual_infocmp)
184	$(LIBTOOL_INSTALL) $(INSTALL_PROG) clear$x   $(DESTDIR)$(bindir)/$(actual_clear)
185	$(LIBTOOL_INSTALL) $(INSTALL_PROG) tput$x    $(DESTDIR)$(bindir)/$(actual_tput)
186	$(LIBTOOL_INSTALL) $(INSTALL_PROG) tset$x    $(DESTDIR)$(bindir)/$(actual_tset)
187	@echo "linking $(actual_reset) to $(actual_tset)"
188	-@rm -f $(DESTDIR)$(bindir)/$(actual_reset)
189	(cd $(DESTDIR)$(bindir) && $(LN_S) $(actual_tset) $(actual_reset))
190
191uninstall.progs:
192@MAKE_TERMINFO@	-@$(LIBTOOL_CLEAN) rm -f $(DESTDIR)$(bindir)/$(actual_tic)
193@MAKE_TERMINFO@	-@$(LIBTOOL_CLEAN) rm -f $(DESTDIR)$(bindir)/$(actual_toe)
194@MAKE_TERMINFO@	-@rm -f $(DESTDIR)$(bindir)/$(actual_captoinfo)
195@MAKE_TERMINFO@	-@rm -f $(DESTDIR)$(bindir)/$(actual_infotocap)
196	-@$(LIBTOOL_CLEAN) rm -f $(DESTDIR)$(bindir)/$(actual_infocmp)
197	-@$(LIBTOOL_CLEAN) rm -f $(DESTDIR)$(bindir)/$(actual_clear)
198	-@$(LIBTOOL_CLEAN) rm -f $(DESTDIR)$(bindir)/$(actual_tput)
199	-@$(LIBTOOL_CLEAN) rm -f $(DESTDIR)$(bindir)/$(actual_tset)
200	-@rm -f $(DESTDIR)$(bindir)/$(actual_reset)
201
202$(DESTDIR)$(bindir) :
203	sh $(srcdir)/../mkinstalldirs $@
204
205#
206# Utilities normally built by make all start here
207#
208
209DEPS_TIC = \
210	$(MODEL)/tic$o \
211	$(MODEL)/dump_entry$o
212
213tic$x: $(DEPS_TIC) $(DEPS_CURSES) transform.h
214	@ECHO_LINK@ $(LINK) $(DEPS_TIC) $(LDFLAGS_DEFAULT) -o $@
215
216DEPS_TOE = \
217	$(MODEL)/toe$o \
218	$(MODEL)/dump_entry$o
219
220toe$x: $(DEPS_TOE) $(DEPS_CURSES)
221	@ECHO_LINK@ $(LINK) $(DEPS_TOE) $(LDFLAGS_DEFAULT) -o $@
222
223DEPS_CLEAR = \
224	$(MODEL)/clear$o
225
226clear$x: $(DEPS_CLEAR) $(DEPS_CURSES)
227	@ECHO_LINK@ $(LINK) $(DEPS_CLEAR) $(LDFLAGS_DEFAULT) -o $@
228
229DEPS_TPUT = \
230	$(MODEL)/tput$o
231
232tput$x: $(DEPS_TPUT) $(DEPS_CURSES) transform.h
233	@ECHO_LINK@ $(LINK) $(DEPS_TPUT) $(LDFLAGS_DEFAULT) -o $@
234
235DEPS_INFOCMP = \
236	$(MODEL)/infocmp$o \
237	$(MODEL)/dump_entry$o
238
239infocmp$x: $(DEPS_INFOCMP) $(DEPS_CURSES)
240	@ECHO_LINK@ $(LINK) $(DEPS_INFOCMP) $(LDFLAGS_DEFAULT) -o $@
241
242DEPS_TSET = \
243	$(MODEL)/tset$o \
244	$(MODEL)/dump_entry$o
245
246tset$x: $(DEPS_TSET) $(DEPS_CURSES) transform.h
247	@ECHO_LINK@ $(LINK) $(DEPS_TSET) $(LDFLAGS_DEFAULT) -o $@
248
249termsort.c: $(srcdir)/MKtermsort.sh
250	sh $(srcdir)/MKtermsort.sh $(AWK) $(srcdir)/../include/@TERMINFO_CAPS@ >$@
251
252#
253# Utility productions start here
254#
255
256tags:
257	ctags *.[ch]
258
259@MAKE_UPPER_TAGS@TAGS:
260@MAKE_UPPER_TAGS@	etags *.[ch]
261
262mostlyclean ::
263	-rm -f core tags TAGS *~ *.bak *.i *.ln *.atac trace
264
265clean :: mostlyclean
266	-sh -c "if test -n '$x' ; then $(MAKE) clean x=''; fi"
267	-rm -f $(AUTO_SRC)
268	-rm -f $(PROGS)
269	-rm -rf .libs
270
271distclean :: clean
272	-rm -f Makefile
273
274realclean :: distclean
275
276# These rules are used to allow "make -n" to work on a clean directory-tree
277../include/hashsize.h \
278../include/parametrized.h \
279../include/term.h :
280	cd ../include; $(MAKE) $(CF_MFLAGS)
281$(DEPS_CURSES) :
282	cd ../ncurses; $(MAKE) $(CF_MFLAGS)
283
284lint:
285@MAKE_TERMINFO@	$(LINT) $(LINT_OPTS) $(CPPFLAGS) $(srcdir)/tic.c     $(srcdir)/dump_entry.c $(LINT_LIBS)
286@MAKE_TERMINFO@	$(LINT) $(LINT_OPTS) $(CPPFLAGS) $(srcdir)/toe.c     $(srcdir)/dump_entry.c $(LINT_LIBS)
287	$(LINT) $(LINT_OPTS) $(CPPFLAGS) $(srcdir)/clear.c                          $(LINT_LIBS)
288	$(LINT) $(LINT_OPTS) $(CPPFLAGS) $(srcdir)/infocmp.c $(srcdir)/dump_entry.c $(LINT_LIBS)
289	$(LINT) $(LINT_OPTS) $(CPPFLAGS) $(srcdir)/tput.c                           $(LINT_LIBS)
290	$(LINT) $(LINT_OPTS) $(CPPFLAGS) $(srcdir)/tset.c    $(srcdir)/dump_entry.c $(LINT_LIBS)
291
292###############################################################################
293# The remainder of this file is automatically generated during configuration
294###############################################################################
295