xref: /freebsd/contrib/ncurses/progs/Makefile.in (revision 643ac419fafba89f5adda0e0ea75b538727453fb)
1# $Id: Makefile.in,v 1.108 2021/01/23 20:42:08 tom Exp $
2##############################################################################
3# Copyright 2020,2021 Thomas E. Dickey                                       #
4# Copyright 1998-2016,2018 Free Software Foundation, Inc.                    #
5#                                                                            #
6# Permission is hereby granted, free of charge, to any person obtaining a    #
7# copy of this software and associated documentation files (the "Software"), #
8# to deal in the Software without restriction, including without limitation  #
9# the rights to use, copy, modify, merge, publish, distribute, distribute    #
10# with modifications, sublicense, and/or sell copies of the Software, and to #
11# permit persons to whom the Software is furnished to do so, subject to the  #
12# following conditions:                                                      #
13#                                                                            #
14# The above copyright notice and this permission notice shall be included in #
15# all copies or substantial portions of the Software.                        #
16#                                                                            #
17# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
18# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,   #
19# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL    #
20# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER      #
21# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING    #
22# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER        #
23# DEALINGS IN THE SOFTWARE.                                                  #
24#                                                                            #
25# Except as contained in this notice, the name(s) of the above copyright     #
26# holders shall not be used in advertising or otherwise to promote the sale, #
27# use or other dealings in this Software without prior written               #
28# authorization.                                                             #
29##############################################################################
30#
31# Author: Thomas E. Dickey 1996-on
32#
33# Makefile for ncurses source code.
34#
35# This makes the ncurses utility programs.
36#
37# The variable 'srcdir' refers to the source-distribution, and can be set with
38# the configure script by "--srcdir=DIR".
39#
40# The rules are organized to produce the libraries for the configured models,
41# and the programs with the configured default model.
42
43# turn off _all_ suffix rules; we'll generate our own
44.SUFFIXES:
45
46SHELL		= @SHELL@
47VPATH		= @srcdir@
48THIS		= Makefile
49
50TOP_MFLAGS	= @cf_cv_makeflags@ DESTDIR="$(DESTDIR)" RPATH_LIST="$(RPATH_LIST)"
51@SET_MAKE@
52
53x		= @EXEEXT@
54o		= .@OBJEXT@
55
56MODEL		= ../@DFT_OBJ_SUBDIR@
57DESTDIR		= @DESTDIR@
58top_srcdir	= @top_srcdir@
59srcdir		= @srcdir@
60prefix		= @prefix@
61exec_prefix	= @exec_prefix@
62bindir		= @bindir@
63libdir		= @libdir@
64includedir	= @includedir@
65datarootdir	= @datarootdir@
66datadir		= @datadir@
67includesubdir	= @includesubdir@
68
69INCLUDEDIR	= $(DESTDIR)$(includedir)$(includesubdir)
70
71PACKAGE		= @PACKAGE@
72
73LIBTOOL		= @LIBTOOL@
74LIBTOOL_OPTS	= @LIBTOOL_OPTS@
75LIBTOOL_CLEAN	= @LIB_CLEAN@
76LIBTOOL_COMPILE	= @LIB_COMPILE@
77LIBTOOL_LINK	= @LIB_LINK@
78LIBTOOL_INSTALL	= @LIB_INSTALL@
79LIBTOOL_UNINSTALL = @LIB_UNINSTALL@
80
81INSTALL		= @INSTALL@
82INSTALL_PROG	= @INSTALL_PROGRAM@ @INSTALL_OPT_S@
83transform	= @program_transform_name@
84
85AWK		= @AWK@
86LN_S		= @LN_S@
87
88CTAGS		= @CTAGS@
89ETAGS		= @ETAGS@
90
91CC		= @CC@
92CPP		= @CPP@
93CFLAGS		= @CFLAGS@ @EXTRA_CFLAGS@
94
95INCDIR		= $(top_srcdir)/include
96CPPFLAGS	= -DHAVE_CONFIG_H -I../progs @CPPFLAGS@
97
98CCFLAGS		= $(CPPFLAGS) $(CFLAGS)
99
100CFLAGS_LIBTOOL	= $(CCFLAGS)
101CFLAGS_NORMAL	= $(CCFLAGS) -DNCURSES_STATIC
102CFLAGS_DEBUG	= $(CCFLAGS) -DNCURSES_STATIC @CC_G_OPT@ -DTRACE
103CFLAGS_PROFILE	= $(CCFLAGS) -DNCURSES_STATIC -pg
104CFLAGS_SHARED	= $(CCFLAGS) @CC_SHARED_OPTS@
105
106CFLAGS_DEFAULT	= $(CFLAGS_@DFT_UPR_MODEL@)
107
108REL_VERSION	= @cf_cv_rel_version@
109ABI_VERSION	= @cf_cv_abi_version@
110LOCAL_LIBDIR	= @top_builddir@/lib
111
112LD		= @LD@
113LINK		= @LINK_PROGS@ $(LIBTOOL_LINK)
114LDFLAGS		= @EXTRA_LDFLAGS@ @LDFLAGS@
115RPATH_LIST	= @RPATH_LIST@
116
117LDFLAGS_LIBTOOL	= $(LDFLAGS) $(CFLAGS_LIBTOOL)
118LDFLAGS_NORMAL	= $(LDFLAGS) $(CFLAGS_NORMAL)
119LDFLAGS_DEBUG	= $(LDFLAGS) $(CFLAGS_DEBUG)
120LDFLAGS_PROFILE	= $(LDFLAGS) $(CFLAGS_PROFILE)
121LDFLAGS_SHARED	= $(LDFLAGS) $(CFLAGS_SHARED) @LD_SHARED_OPTS@
122
123LDFLAGS_DEFAULT	= $(LDFLAGS_@DFT_UPR_MODEL@)
124
125LIBS_TIC	= @TINFO_LDFLAGS@ @LDFLAGS_STATIC@ @TICS_LIBS@ @TINFO_LIBS@ @LDFLAGS_SHARED@ @LD_MODEL@ @LIBS@
126LDFLAGS_TIC	= @TICS_LDFLAGS@ $(LDFLAGS_@DFT_UPR_MODEL@) $(LIBS_TIC)
127
128LIBS_TINFO	= @LDFLAGS_STATIC@ @TINFO_LIBS@ @LDFLAGS_SHARED@ @LD_MODEL@ @LIBS@
129LDFLAGS_TINFO	= @TINFO_LDFLAGS@ $(LDFLAGS_@DFT_UPR_MODEL@) $(LIBS_TINFO)
130
131LINT		= @LINT@
132LINT_OPTS	= @LINT_OPTS@
133LINT_LIBS	= -lncurses @LIBS@
134
135AUTO_SRC = \
136	termsort.c \
137	transform.h
138
139# tic relies on direct access to the terminfo database
140GET_PROGS = infocmp$x clear$x tabs$x tput$x tset$x toe$x
141PUT_PROGS = @MAKE_TERMINFO@ tic$x
142PROGS = $(PUT_PROGS) $(GET_PROGS)
143
144# Default library, for linking applications
145DEPS_CURSES = ../lib/@LIB_PREFIX@ncurses@DFT_DEP_SUFFIX@
146
147HEADER_DEPS	= \
148	../include/curses.h \
149	$(INCDIR)/term_entry.h \
150	$(INCDIR)/tic.h \
151	$(INCDIR)/nc_alloc.h
152
153################################################################################
154all:		$(AUTO_SRC) $(PROGS)
155
156sources:	$(AUTO_SRC)
157
158install: 	$(AUTO_SRC) install.progs
159uninstall: uninstall.progs
160
161# this line simplifies the configure-script
162libs \
163install.libs \
164uninstall.libs:
165
166TRANSFORM = sed 's/$x$$//'|sed '$(transform)'|sed 's/$$/$x/'
167
168# transformed names for installing files
169actual_captoinfo = `echo captoinfo$x| $(TRANSFORM)`
170actual_clear     = `echo clear$x|     $(TRANSFORM)`
171actual_infocmp   = `echo infocmp$x|   $(TRANSFORM)`
172actual_infotocap = `echo infotocap$x| $(TRANSFORM)`
173actual_init      = `echo init$x|      $(TRANSFORM)`
174actual_reset     = `echo reset$x|     $(TRANSFORM)`
175actual_tabs      = `echo tabs$x|      $(TRANSFORM)`
176actual_tic       = `echo tic$x|       $(TRANSFORM)`
177actual_toe       = `echo toe$x|       $(TRANSFORM)`
178actual_tput      = `echo tput$x|      $(TRANSFORM)`
179actual_tset      = `echo tset$x|      $(TRANSFORM)`
180
181# transformed names for comparing at runtime
182define_captoinfo = `echo captoinfo|   $(TRANSFORM)`
183define_clear     = `echo clear|       $(TRANSFORM)`
184define_infotocap = `echo infotocap|   $(TRANSFORM)`
185define_init      = `echo init|        $(TRANSFORM)`
186define_reset     = `echo reset|       $(TRANSFORM)`
187
188transform.h :
189	echo "#ifndef __TRANSFORM_H"					>$@
190	echo "#define __TRANSFORM_H 1"					>>$@
191	echo "#include <progs.priv.h>"					>>$@
192	echo "extern bool same_program(const char *, const char *);"	>>$@
193	-$(SHELL) -c 'if test -n "$x" ; then echo "#define SUFFIX_IGNORED \"$x\"">>$@; fi'
194	echo "#define PROG_CAPTOINFO \"$(define_captoinfo)\""		>>$@
195	echo "#define PROG_INFOTOCAP \"$(define_infotocap)\""		>>$@
196	echo "#define PROG_CLEAR     \"$(define_clear)\""		>>$@
197	echo "#define PROG_RESET     \"$(define_reset)\""		>>$@
198	echo "#define PROG_INIT      \"$(define_init)\""		>>$@
199	echo "#endif /* __TRANSFORM_H */"				>>$@
200
201install.progs: $(AUTO_SRC) $(PROGS) $(DESTDIR)$(bindir)
202@MAKE_TERMINFO@	$(LIBTOOL_INSTALL) $(INSTALL_PROG) tic$x     $(DESTDIR)$(bindir)/$(actual_tic)
203@MAKE_TERMINFO@	$(LIBTOOL_INSTALL) $(INSTALL_PROG) toe$x     $(DESTDIR)$(bindir)/$(actual_toe)
204@MAKE_TERMINFO@	@echo "linking $(actual_infotocap) to $(actual_tic)"
205@MAKE_TERMINFO@	-@rm -f $(DESTDIR)$(bindir)/$(actual_infotocap)
206@MAKE_TERMINFO@	( cd $(DESTDIR)$(bindir) && $(LN_S) $(actual_tic) $(actual_infotocap) )
207@MAKE_TERMINFO@	@echo "linking $(actual_captoinfo) to $(actual_tic)"
208@MAKE_TERMINFO@	-@rm -f $(DESTDIR)$(bindir)/$(actual_captoinfo)
209@MAKE_TERMINFO@	( cd $(DESTDIR)$(bindir) && $(LN_S) $(actual_tic) $(actual_captoinfo) )
210	$(LIBTOOL_INSTALL) $(INSTALL_PROG) infocmp$x $(DESTDIR)$(bindir)/$(actual_infocmp)
211	$(LIBTOOL_INSTALL) $(INSTALL_PROG) clear$x   $(DESTDIR)$(bindir)/$(actual_clear)
212	$(LIBTOOL_INSTALL) $(INSTALL_PROG) tabs$x    $(DESTDIR)$(bindir)/$(actual_tabs)
213	$(LIBTOOL_INSTALL) $(INSTALL_PROG) tput$x    $(DESTDIR)$(bindir)/$(actual_tput)
214	$(LIBTOOL_INSTALL) $(INSTALL_PROG) tset$x    $(DESTDIR)$(bindir)/$(actual_tset)
215	@echo "linking $(actual_reset) to $(actual_tset)"
216	-@rm -f $(DESTDIR)$(bindir)/$(actual_reset)
217	( cd $(DESTDIR)$(bindir) && $(LN_S) $(actual_tset) $(actual_reset) )
218
219uninstall.progs:
220@MAKE_TERMINFO@	-@$(LIBTOOL_CLEAN) rm -f $(DESTDIR)$(bindir)/$(actual_tic)
221@MAKE_TERMINFO@	-@$(LIBTOOL_CLEAN) rm -f $(DESTDIR)$(bindir)/$(actual_toe)
222@MAKE_TERMINFO@	-@rm -f $(DESTDIR)$(bindir)/$(actual_captoinfo)
223@MAKE_TERMINFO@	-@rm -f $(DESTDIR)$(bindir)/$(actual_infotocap)
224	-@$(LIBTOOL_CLEAN) rm -f $(DESTDIR)$(bindir)/$(actual_infocmp)
225	-@$(LIBTOOL_CLEAN) rm -f $(DESTDIR)$(bindir)/$(actual_clear)
226	-@$(LIBTOOL_CLEAN) rm -f $(DESTDIR)$(bindir)/$(actual_tabs)
227	-@$(LIBTOOL_CLEAN) rm -f $(DESTDIR)$(bindir)/$(actual_tput)
228	-@$(LIBTOOL_CLEAN) rm -f $(DESTDIR)$(bindir)/$(actual_tset)
229	-@rm -f $(DESTDIR)$(bindir)/$(actual_reset)
230
231$(DESTDIR)$(bindir) :
232	mkdir -p $@
233
234#
235# Utilities normally built by make all start here
236#
237
238DEPS_TIC = \
239	$(MODEL)/tic$o \
240	$(MODEL)/dump_entry$o \
241	$(MODEL)/tparm_type$o \
242	$(MODEL)/transform$o
243
244tic$x: $(DEPS_TIC) $(DEPS_CURSES) transform.h
245	@ECHO_LD@ $(LINK) $(DEPS_TIC) $(LDFLAGS_TIC) -o $@
246
247DEPS_TOE = \
248	$(MODEL)/toe$o
249
250toe$x: $(DEPS_TOE) $(DEPS_CURSES)
251	@ECHO_LD@ $(LINK) $(DEPS_TOE) $(LDFLAGS_TIC) -o $@
252
253DEPS_CLEAR = \
254	$(MODEL)/clear$o \
255	$(MODEL)/clear_cmd$o \
256	$(MODEL)/tty_settings$o
257
258clear$x: $(DEPS_CLEAR) $(DEPS_CURSES)
259	@ECHO_LD@ $(LINK) $(DEPS_CLEAR) $(LDFLAGS_TINFO) -o $@
260
261DEPS_TABS = \
262	$(MODEL)/tabs$o \
263	$(MODEL)/tty_settings$o
264
265tabs$x: $(DEPS_TABS) $(DEPS_TABS)
266	@ECHO_LD@ $(LINK) $(DEPS_TABS) $(LDFLAGS_TINFO) -o $@
267
268DEPS_TPUT = \
269	$(MODEL)/tput$o \
270	$(MODEL)/clear_cmd$o \
271	$(MODEL)/reset_cmd$o \
272	$(MODEL)/tparm_type$o \
273	$(MODEL)/transform$o \
274	$(MODEL)/tty_settings$o
275
276tput$x: $(DEPS_TPUT) $(DEPS_CURSES) transform.h
277	@ECHO_LD@ $(LINK) $(DEPS_TPUT) $(LDFLAGS_TINFO) -o $@
278
279DEPS_INFOCMP = \
280	$(MODEL)/infocmp$o \
281	$(MODEL)/dump_entry$o
282
283infocmp$x: $(DEPS_INFOCMP) $(DEPS_CURSES)
284	@ECHO_LD@ $(LINK) $(DEPS_INFOCMP) $(LDFLAGS_TIC) -o $@
285
286DEPS_TSET = \
287	$(MODEL)/tset$o \
288	$(MODEL)/reset_cmd$o \
289	$(MODEL)/transform$o \
290	$(MODEL)/tty_settings$o
291
292tset$x: $(DEPS_TSET) $(DEPS_CURSES) transform.h
293	@ECHO_LD@ $(LINK) $(DEPS_TSET) $(LDFLAGS_TINFO) -o $@
294
295termsort.c: $(srcdir)/MKtermsort.sh
296	$(SHELL) $(srcdir)/MKtermsort.sh $(AWK) $(srcdir)/../include/@TERMINFO_CAPS@ >$@
297
298#
299# Utility productions start here
300#
301
302tags:
303	$(CTAGS) *.[ch]
304
305@MAKE_UPPER_TAGS@TAGS:
306@MAKE_UPPER_TAGS@	$(ETAGS) *.[ch]
307
308mostlyclean ::
309	-rm -f core tags TAGS *~ *.bak *.i *.ln *.atac trace
310
311clean :: mostlyclean
312	-$(SHELL) -c "if test -n '$x' ; then $(MAKE) clean x=''; fi"
313	-rm -f $(AUTO_SRC)
314	-rm -f $(PROGS)
315	-rm -rf .libs *.dSYM
316
317distclean :: clean
318	-rm -f Makefile
319
320realclean :: distclean
321
322# These rules are used to allow "make -n" to work on a clean directory-tree
323../include/hashsize.h \
324../include/parametrized.h \
325../include/term.h :
326	( cd ../include && $(MAKE) $(TOP_MFLAGS) )
327$(DEPS_CURSES) :
328	( cd ../ncurses && $(MAKE) $(TOP_MFLAGS) )
329
330lint:
331@MAKE_TERMINFO@	$(LINT) $(LINT_OPTS) $(CPPFLAGS) $(srcdir)/tic.c     $(srcdir)/dump_entry.c $(LINT_LIBS)
332@MAKE_TERMINFO@	$(LINT) $(LINT_OPTS) $(CPPFLAGS) $(srcdir)/toe.c     $(srcdir)/dump_entry.c $(LINT_LIBS)
333	$(LINT) $(LINT_OPTS) $(CPPFLAGS) $(srcdir)/clear.c                          $(LINT_LIBS)
334	$(LINT) $(LINT_OPTS) $(CPPFLAGS) $(srcdir)/infocmp.c $(srcdir)/dump_entry.c $(LINT_LIBS)
335	$(LINT) $(LINT_OPTS) $(CPPFLAGS) $(srcdir)/tabs.c                           $(LINT_LIBS)
336	$(LINT) $(LINT_OPTS) $(CPPFLAGS) $(srcdir)/tput.c                           $(LINT_LIBS)
337	$(LINT) $(LINT_OPTS) $(CPPFLAGS) $(srcdir)/tset.c    $(srcdir)/dump_entry.c $(LINT_LIBS)
338
339###############################################################################
340# The remainder of this file is automatically generated during configuration
341###############################################################################
342