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