1 # $Id: mk-test.awk,v 1.30 2021/12/19 16:54:36 tom Exp $
2 ##############################################################################
3 # Copyright 2019-2020,2021 Thomas E. Dickey #
4 # Copyright 2006-2017,2018 Free Software Foundation, Inc. #
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: #
14 # The above copyright notice and this permission notice shall be included in #
15 # all copies or substantial portions of the Software. #
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. #
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 #
29 ##############################################################################
31 # Author: Thomas E. Dickey
33 # generate Makefile for ncurses tests.
46 print "# generated by mk-test.awk\n";
53 for (n = 4; n <= NF; ++n) {
54 files[count] = sprintf("%s $(MODEL)/%s$o", files[count], $n);
59 for (n = 0; n < count; ++n) {
65 printf "$(destdir)%s$x", progs[n];
72 print " $(srcdir)/savescreen.sh \\"
73 print " $(srcdir)/tput-colorcube \\"
74 print " $(srcdir)/tput-initc \\"
75 print " $(srcdir)/tracemunch"
76 print "DATAFILES = \\"
77 print " $(srcdir)/*.x* \\"
78 print " $(srcdir)/*.dat"
80 print "all:: $(TESTS)"
85 print " @ echo The test-programs are interactive"
87 print " $(CTAGS) *.[ch]"
89 print "# no libraries here"
91 print "install.libs \\"
92 print "uninstall.libs:"
94 if (INSTALL == "yes") {
95 print "# we might install the test-programs"
97 print " @echo \"creating $(PACKAGE) script\""
98 print " @$(SHELL) -c '\\"
99 print " L=$(real_bindir); \\"
100 print " rm -f $@; \\"
101 print " echo \"#!$(SHELL)\" > $@;\\"
102 print " echo \"PATH=\\\"$$L\\\":\\$$PATH\" >>$@;\\"
103 print " echo \"export PATH\" >>$@;\\"
104 print " echo \"if test \\$$# != 0; then\" >>$@;\\"
105 print " echo \" exec \\\"\\$$@\\\"\" >>$@;\\"
106 print " echo \"elif test -t 1; then\" >>$@;\\"
107 print " echo \" cd \\\"$$L\\\" || exit\" >>$@;\\"
108 print " echo \" ls -l | \\$${PAGER:-less}\" >>$@;\\"
109 print " echo \"fi\" >>$@;\\"
110 print " echo \"echo \\\"usage: $@ [program]\\\"\" >>$@'"
113 print "install.test: $(PACKAGE) $(BINDIR) $(REAL_BINDIR) $(DATADIR) $(TESTS)"
115 print " @echo \"installing $(PACKAGE) -> $(BINDIR)/\""
116 print " @$(INSTALL_SCRIPT) $(PACKAGE) $(BINDIR)"
118 print " @$(SHELL) -c 'for src in $(TESTS); do \\"
119 print " dst=`echo $$src | $(TRANSFORM)`; \\"
120 print " echo \"installing $$src -> $(REAL_BINDIR)/$$dst\"; \\"
121 print " $(INSTALL_PROG) $$src $(REAL_BINDIR)/$$dst; \\"
124 print " @$(SHELL) -c 'for src in $(SCRIPTS); do \\"
125 print " dst=`echo $$src | sed -e 's,^.*/,,' | $(TRANSFORM)`; \\"
126 print " echo \"installing $$src -> $(REAL_BINDIR)/$$dst\"; \\"
127 print " $(INSTALL_SCRIPT) $$src $(REAL_BINDIR)/$$dst; \\"
130 print " @$(SHELL) -c 'for src in $(DATAFILES); do \\"
131 print " dst=`echo $$src | sed -e 's,^.*/,,'`; \\"
132 print " echo \"installing $$src -> $(DATADIR)/$$dst\"; \\"
133 print " $(INSTALL_DATA) $$src $(DATADIR)/$$dst; \\"
137 print "uninstall.test:"
139 print " -rm -f $(BINDIR)/$(PACKAGE)"
141 print " @$(SHELL) -c 'for src in $(TESTS); do \\"
142 print " dst=`echo $$src | $(TRANSFORM)`; \\"
143 print " rm -f $(REAL_BINDIR)/$$dst; \\"
146 print " @$(SHELL) -c 'for src in $(SCRIPTS); do \\"
147 print " dst=`echo $$src | sed -e 's,^.*/,,' | $(TRANSFORM)`; \\"
148 print " rm -f $(REAL_BINDIR)/$$dst; \\"
151 print " @$(SHELL) -c 'for src in $(DATAFILES); do \\"
152 print " dst=`echo $$src | sed -e 's,^.*/,,'`; \\"
153 print " rm -f $(DATADIR)/$$dst; \\"
157 print "install.test \\"
159 print "uninstall.test:"
162 print "mostlyclean ::"
163 print " -rm -f core tags TAGS *~ *.bak *.i *.ln *.atac trace"
165 print "clean :: mostlyclean"
166 print " -$(SHELL) -c \"if test -n '$x' ; then $(MAKE) clean x=''; fi\""
167 print " -rm -rf *$o screendump *.lis $(TESTS) .libs *.dSYM"
168 print " -rm -f $(PACKAGE)"
170 print "distclean :: clean"
171 print " -rm -f Makefile ncurses_cfg.h config.status config.log"
173 print "realclean :: distclean"
176 print " $(SHELL) -c 'for N in $(TESTS); do echo LINT:$$N; $(LINT) $(LINT_OPTS) $(CPPFLAGS) $(srcdir)/$$N.c $(LINT_LIBS); done'"
177 print "$(BINDIR) $(REAL_BINDIR) $(DATADIR) :"
181 if (ECHO_LINK != "") {
182 ECHO_LINK="@ echo linking $@ ... ;"
184 for (n = 0; n < count; ++n) {
186 printf "$(destdir)%s$x:%s %s\n", progs[n], files[n], using[n];
187 printf "\t%s$(LINK) -o $@%s %s\n", ECHO_LINK, files[n], flags[n];