xref: /freebsd/contrib/ncurses/progs/Makefile.in (revision b64c5a0ace59af62eff52bfe110a521dc73c937b)
1# $Id: Makefile.in,v 1.115 2024/04/08 18:33:54 tom Exp $
2##############################################################################
3# Copyright 2020-2021,2024 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
96NCUDIR		= $(top_srcdir)/ncurses
97CPPFLAGS	= -DHAVE_CONFIG_H -I../progs -I../ncurses -I$(top_srcdir)/ncurses @CPPFLAGS@
98
99CCFLAGS		= $(CPPFLAGS) $(CFLAGS)
100
101CFLAGS_LIBTOOL	= $(CCFLAGS)
102CFLAGS_NORMAL	= $(CCFLAGS) -DNCURSES_STATIC
103CFLAGS_DEBUG	= $(CCFLAGS) -DNCURSES_STATIC @CC_G_OPT@ -DTRACE
104CFLAGS_PROFILE	= $(CCFLAGS) -DNCURSES_STATIC -pg
105CFLAGS_SHARED	= $(CCFLAGS) @CC_SHARED_OPTS@
106
107CFLAGS_DEFAULT	= $(CFLAGS_@DFT_UPR_MODEL@)
108
109REL_VERSION	= @cf_cv_rel_version@
110ABI_VERSION	= @cf_cv_abi_version@
111LOCAL_LIBDIR	= @top_builddir@/lib
112
113LD		= @LD@
114LINK		= @LINK_PROGS@ $(LIBTOOL_LINK)
115LDFLAGS		= @EXTRA_LDFLAGS@ @LDFLAGS@
116RPATH_LIST	= @RPATH_LIST@
117
118LDFLAGS_LIBTOOL	= $(LDFLAGS) $(CFLAGS_LIBTOOL)
119LDFLAGS_NORMAL	= $(LDFLAGS) $(CFLAGS_NORMAL)
120LDFLAGS_DEBUG	= $(LDFLAGS) $(CFLAGS_DEBUG)
121LDFLAGS_PROFILE	= $(LDFLAGS) $(CFLAGS_PROFILE)
122LDFLAGS_SHARED	= $(LDFLAGS) $(CFLAGS_SHARED) @LD_SHARED_OPTS@
123
124LDFLAGS_DEFAULT	= $(LDFLAGS_@DFT_UPR_MODEL@)
125
126LIBS_TIC	= @TINFO_LDFLAGS@ @LDFLAGS_STATIC@ @TICS_LIBS@ @TINFO_LIBS@ @LDFLAGS_SHARED@ @LD_MODEL@ @LIBS@
127LDFLAGS_TIC	= @TICS_LDFLAGS@ $(LDFLAGS_@DFT_UPR_MODEL@) $(LIBS_TIC)
128
129LIBS_TINFO	= @LDFLAGS_STATIC@ @TINFO_LIBS@ @LDFLAGS_SHARED@ @LD_MODEL@ @LIBS@
130LDFLAGS_TINFO	= @TINFO_LDFLAGS@ $(LDFLAGS_@DFT_UPR_MODEL@) $(LIBS_TINFO)
131
132LINT		= @LINT@
133LINT_OPTS	= @LINT_OPTS@
134LINT_LIBS	= -lncurses @LIBS@
135
136AUTO_SRC = \
137	termsort.h \
138	transform.h
139
140# tic relies on direct access to the terminfo database
141GET_PROGS = infocmp$x clear$x tabs$x tput$x tset$x toe$x
142PUT_PROGS = @MAKE_TERMINFO@ tic$x
143PROGS = $(PUT_PROGS) $(GET_PROGS)
144
145# Default library, for linking applications
146DEPS_CURSES = ../lib/@LIB_PREFIX@ncurses@DFT_DEP_SUFFIX@
147
148HEADER_DEPS	= \
149	$(INCDIR)/nc_access.h \
150	$(INCDIR)/nc_alloc.h \
151	$(INCDIR)/nc_panel.h \
152	$(INCDIR)/nc_string.h \
153	$(INCDIR)/nc_termios.h \
154	$(INCDIR)/nc_tparm.h \
155	$(INCDIR)/term_entry.h \
156	$(INCDIR)/tic.h \
157	$(NCUDIR)/curses.priv.h \
158	$(NCUDIR)/new_pair.h \
159	$(NCUDIR)/term.priv.h \
160	$(srcdir)/progs.priv.h \
161	../include/curses.h \
162	../include/ncurses_cfg.h \
163	../include/ncurses_def.h \
164	../include/ncurses_dll.h \
165	../include/term.h \
166	../include/unctrl.h
167
168################################################################################
169
170@MAKE_PHONY@.PHONY :	all
171@MAKE_PHONY@.PHONY :	check
172@MAKE_PHONY@.PHONY :	clean
173@MAKE_PHONY@.PHONY :	distclean
174@MAKE_PHONY@.PHONY :	install
175@MAKE_PHONY@.PHONY :	install.libs
176@MAKE_PHONY@.PHONY :	install.progs
177@MAKE_PHONY@.PHONY :	libs
178@MAKE_PHONY@.PHONY :	lint
179@MAKE_PHONY@.PHONY :	mostlyclean
180@MAKE_PHONY@.PHONY :	realclean
181@MAKE_PHONY@.PHONY :	sources
182@MAKE_PHONY@.PHONY :	uninstall
183@MAKE_PHONY@.PHONY :	uninstall.libs
184@MAKE_PHONY@.PHONY :	uninstall.progs
185
186all:		$(AUTO_SRC) $(PROGS)
187
188sources:	$(AUTO_SRC)
189
190install: 	$(AUTO_SRC) install.progs
191uninstall: uninstall.progs
192
193# this line simplifies the configure-script
194libs \
195install.libs \
196uninstall.libs:
197
198TRANSFORM = sed 's/$x$$//'|sed '$(transform)'|sed 's/$$/$x/'
199
200# transformed names for installing files
201actual_captoinfo = `echo captoinfo$x| $(TRANSFORM)`
202actual_clear     = `echo clear$x|     $(TRANSFORM)`
203actual_infocmp   = `echo infocmp$x|   $(TRANSFORM)`
204actual_infotocap = `echo infotocap$x| $(TRANSFORM)`
205actual_init      = `echo init$x|      $(TRANSFORM)`
206actual_reset     = `echo reset$x|     $(TRANSFORM)`
207actual_tabs      = `echo tabs$x|      $(TRANSFORM)`
208actual_tic       = `echo tic$x|       $(TRANSFORM)`
209actual_toe       = `echo toe$x|       $(TRANSFORM)`
210actual_tput      = `echo tput$x|      $(TRANSFORM)`
211actual_tset      = `echo tset$x|      $(TRANSFORM)`
212
213# transformed names for comparing at runtime
214define_captoinfo = `echo captoinfo|   $(TRANSFORM)`
215define_clear     = `echo clear|       $(TRANSFORM)`
216define_infotocap = `echo infotocap|   $(TRANSFORM)`
217define_init      = `echo init|        $(TRANSFORM)`
218define_reset     = `echo reset|       $(TRANSFORM)`
219
220transform.h :
221	echo "#ifndef __TRANSFORM_H"					>$@
222	echo "#define __TRANSFORM_H 1"					>>$@
223	echo "#include <progs.priv.h>"					>>$@
224	echo "extern bool same_program(const char *, const char *);"	>>$@
225	-$(SHELL) -c 'if test -n "$x" ; then echo "#define SUFFIX_IGNORED \"$x\"">>$@; fi'
226	echo "#define PROG_CAPTOINFO \"$(define_captoinfo)\""		>>$@
227	echo "#define PROG_INFOTOCAP \"$(define_infotocap)\""		>>$@
228	echo "#define PROG_CLEAR     \"$(define_clear)\""		>>$@
229	echo "#define PROG_RESET     \"$(define_reset)\""		>>$@
230	echo "#define PROG_INIT      \"$(define_init)\""		>>$@
231	echo "#endif /* __TRANSFORM_H */"				>>$@
232
233install.progs: $(AUTO_SRC) $(PROGS) $(DESTDIR)$(bindir)
234@MAKE_TERMINFO@	$(LIBTOOL_INSTALL) $(INSTALL_PROG) tic$x     $(DESTDIR)$(bindir)/$(actual_tic)
235@MAKE_TERMINFO@	$(LIBTOOL_INSTALL) $(INSTALL_PROG) toe$x     $(DESTDIR)$(bindir)/$(actual_toe)
236@MAKE_TERMINFO@	@echo "linking $(actual_infotocap) to $(actual_tic)"
237@MAKE_TERMINFO@	-@rm -f $(DESTDIR)$(bindir)/$(actual_infotocap)
238@MAKE_TERMINFO@	( cd $(DESTDIR)$(bindir) && $(LN_S) $(actual_tic) $(actual_infotocap) )
239@MAKE_TERMINFO@	@echo "linking $(actual_captoinfo) to $(actual_tic)"
240@MAKE_TERMINFO@	-@rm -f $(DESTDIR)$(bindir)/$(actual_captoinfo)
241@MAKE_TERMINFO@	( cd $(DESTDIR)$(bindir) && $(LN_S) $(actual_tic) $(actual_captoinfo) )
242	$(LIBTOOL_INSTALL) $(INSTALL_PROG) infocmp$x $(DESTDIR)$(bindir)/$(actual_infocmp)
243	$(LIBTOOL_INSTALL) $(INSTALL_PROG) clear$x   $(DESTDIR)$(bindir)/$(actual_clear)
244	$(LIBTOOL_INSTALL) $(INSTALL_PROG) tabs$x    $(DESTDIR)$(bindir)/$(actual_tabs)
245	$(LIBTOOL_INSTALL) $(INSTALL_PROG) tput$x    $(DESTDIR)$(bindir)/$(actual_tput)
246	$(LIBTOOL_INSTALL) $(INSTALL_PROG) tset$x    $(DESTDIR)$(bindir)/$(actual_tset)
247	@echo "linking $(actual_reset) to $(actual_tset)"
248	-@rm -f $(DESTDIR)$(bindir)/$(actual_reset)
249	( cd $(DESTDIR)$(bindir) && $(LN_S) $(actual_tset) $(actual_reset) )
250
251uninstall.progs:
252@MAKE_TERMINFO@	-@$(LIBTOOL_CLEAN) rm -f $(DESTDIR)$(bindir)/$(actual_tic)
253@MAKE_TERMINFO@	-@$(LIBTOOL_CLEAN) rm -f $(DESTDIR)$(bindir)/$(actual_toe)
254@MAKE_TERMINFO@	-@rm -f $(DESTDIR)$(bindir)/$(actual_captoinfo)
255@MAKE_TERMINFO@	-@rm -f $(DESTDIR)$(bindir)/$(actual_infotocap)
256	-@$(LIBTOOL_CLEAN) rm -f $(DESTDIR)$(bindir)/$(actual_infocmp)
257	-@$(LIBTOOL_CLEAN) rm -f $(DESTDIR)$(bindir)/$(actual_clear)
258	-@$(LIBTOOL_CLEAN) rm -f $(DESTDIR)$(bindir)/$(actual_tabs)
259	-@$(LIBTOOL_CLEAN) rm -f $(DESTDIR)$(bindir)/$(actual_tput)
260	-@$(LIBTOOL_CLEAN) rm -f $(DESTDIR)$(bindir)/$(actual_tset)
261	-@rm -f $(DESTDIR)$(bindir)/$(actual_reset)
262
263$(DESTDIR)$(bindir) :
264	mkdir -p $@
265
266#
267# Utilities normally built by make all start here
268#
269
270DEPS_TIC = \
271	$(MODEL)/tic$o \
272	$(MODEL)/dump_entry$o \
273	$(MODEL)/tparm_type$o \
274	$(MODEL)/transform$o
275
276tic$x: $(DEPS_TIC) $(DEPS_CURSES) transform.h
277	@ECHO_LD@ $(LINK) $(DEPS_TIC) $(LDFLAGS_TIC) -o $@
278
279DEPS_TOE = \
280	$(MODEL)/toe$o
281
282toe$x: $(DEPS_TOE) $(DEPS_CURSES)
283	@ECHO_LD@ $(LINK) $(DEPS_TOE) $(LDFLAGS_TIC) -o $@
284
285DEPS_CLEAR = \
286	$(MODEL)/clear$o \
287	$(MODEL)/clear_cmd$o \
288	$(MODEL)/tty_settings$o
289
290clear$x: $(DEPS_CLEAR) $(DEPS_CURSES)
291	@ECHO_LD@ $(LINK) $(DEPS_CLEAR) $(LDFLAGS_TINFO) -o $@
292
293DEPS_TABS = \
294	$(MODEL)/tabs$o \
295	$(MODEL)/tty_settings$o
296
297tabs$x: $(DEPS_TABS) $(DEPS_TABS)
298	@ECHO_LD@ $(LINK) $(DEPS_TABS) $(LDFLAGS_TINFO) -o $@
299
300DEPS_TPUT = \
301	$(MODEL)/tput$o \
302	$(MODEL)/clear_cmd$o \
303	$(MODEL)/reset_cmd$o \
304	$(MODEL)/tparm_type$o \
305	$(MODEL)/transform$o \
306	$(MODEL)/tty_settings$o
307
308tput$x: $(DEPS_TPUT) $(DEPS_CURSES) transform.h
309	@ECHO_LD@ $(LINK) $(DEPS_TPUT) $(LDFLAGS_TINFO) -o $@
310
311DEPS_INFOCMP = \
312	$(MODEL)/infocmp$o \
313	$(MODEL)/dump_entry$o
314
315infocmp$x: $(DEPS_INFOCMP) $(DEPS_CURSES)
316	@ECHO_LD@ $(LINK) $(DEPS_INFOCMP) $(LDFLAGS_TIC) -o $@
317
318DEPS_TSET = \
319	$(MODEL)/tset$o \
320	$(MODEL)/reset_cmd$o \
321	$(MODEL)/transform$o \
322	$(MODEL)/tty_settings$o
323
324tset$x: $(DEPS_TSET) $(DEPS_CURSES) transform.h
325	@ECHO_LD@ $(LINK) $(DEPS_TSET) $(LDFLAGS_TINFO) -o $@
326
327termsort.h: $(srcdir)/MKtermsort.sh
328	$(SHELL) $(srcdir)/MKtermsort.sh $(AWK) $(srcdir)/../include/@TERMINFO_CAPS@ >$@
329
330#
331# Utility productions start here
332#
333
334tags:
335	$(CTAGS) *.[ch]
336
337@MAKE_UPPER_TAGS@TAGS:
338@MAKE_UPPER_TAGS@	$(ETAGS) *.[ch]
339
340mostlyclean ::
341	-rm -f core tags TAGS *~ *.bak *.i *.ln *.atac trace
342
343clean :: mostlyclean
344	-$(SHELL) -c "if test -n '$x' ; then $(MAKE) clean x=''; fi"
345	-rm -f $(AUTO_SRC)
346	-rm -f $(PROGS)
347	-rm -rf .libs *.dSYM
348
349distclean :: clean
350	-rm -f Makefile
351
352realclean :: distclean
353
354# These rules are used to allow "make -n" to work on a clean directory-tree
355../include/hashsize.h \
356../include/parametrized.h \
357../include/term.h :
358	( cd ../include && $(MAKE) $(TOP_MFLAGS) )
359$(DEPS_CURSES) :
360	( cd ../ncurses && $(MAKE) $(TOP_MFLAGS) )
361
362lint:
363@MAKE_TERMINFO@	$(LINT) $(LINT_OPTS) $(CPPFLAGS) $(srcdir)/tic.c     $(srcdir)/dump_entry.c $(LINT_LIBS)
364@MAKE_TERMINFO@	$(LINT) $(LINT_OPTS) $(CPPFLAGS) $(srcdir)/toe.c                    $(LINT_LIBS)
365	$(LINT) $(LINT_OPTS) $(CPPFLAGS) $(srcdir)/clear.c                          $(LINT_LIBS)
366	$(LINT) $(LINT_OPTS) $(CPPFLAGS) $(srcdir)/infocmp.c $(srcdir)/dump_entry.c $(LINT_LIBS)
367	$(LINT) $(LINT_OPTS) $(CPPFLAGS) $(srcdir)/tabs.c                           $(LINT_LIBS)
368	$(LINT) $(LINT_OPTS) $(CPPFLAGS) $(srcdir)/tput.c                           $(LINT_LIBS)
369	$(LINT) $(LINT_OPTS) $(CPPFLAGS) $(srcdir)/tset.c                           $(LINT_LIBS)
370
371# Verify that each header-file can be compiled without including another.
372check:
373	@$(SHELL) -c "for header in *.h;\
374		do \
375			echo \"** testing \$${header}\" ; \
376			echo \"#include <\$${header}>\" >headers.c; \
377			echo \"int main(void) { return 0; }\" >>headers.c; \
378			$(CC) -c $(CFLAGS) $(CPPFLAGS) headers.c; \
379		done"
380	-@rm -f headers.*
381
382###############################################################################
383# The remainder of this file is automatically generated during configuration
384###############################################################################
385