1 # $Id: mk-test.awk,v 1.23 2020/02/02 23:34:34 tom Exp $
2 ##############################################################################
3 # Copyright 2019,2020 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"
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 "install.test: $(BINDIR) $(DATADIR) $(TESTS)"
99 print " @$(SHELL) -c 'for src in $(TESTS); do \\"
100 print " dst=`echo $$src | $(TRANSFORM)`; \\"
101 print " echo \"installing $$src -> $(BINDIR)/$$dst\"; \\"
102 print " $(INSTALL_PROG) $$src $(BINDIR)/$$dst; \\"
105 print " @$(SHELL) -c 'for src in $(SCRIPTS); do \\"
106 print " dst=`echo $$src | sed -e 's,^.*/,,' | $(TRANSFORM)`; \\"
107 print " echo \"installing $$src -> $(BINDIR)/$$dst\"; \\"
108 print " $(INSTALL_SCRIPT) $$src $(BINDIR)/$$dst; \\"
111 print " @$(SHELL) -c 'for src in $(DATAFILES); do \\"
112 print " dst=`echo $$src | sed -e 's,^.*/,,'`; \\"
113 print " echo \"installing $$src -> $(DATADIR)/$$dst\"; \\"
114 print " $(INSTALL_DATA) $$src $(DATADIR)/$$dst; \\"
118 print "uninstall.test:"
120 print " @$(SHELL) -c 'for src in $(TESTS); do \\"
121 print " dst=`echo $$src | $(TRANSFORM)`; \\"
122 print " rm -f $(BINDIR)/$$dst; \\"
125 print " @$(SHELL) -c 'for src in $(SCRIPTS); do \\"
126 print " dst=`echo $$src | sed -e 's,^.*/,,' | $(TRANSFORM)`; \\"
127 print " rm -f $(BINDIR)/$$dst; \\"
130 print " @$(SHELL) -c 'for src in $(DATAFILES); do \\"
131 print " dst=`echo $$src | sed -e 's,^.*/,,'`; \\"
132 print " rm -f $(DATADIR)/$$dst; \\"
136 print "install.test \\"
138 print "uninstall.test:"
141 print "mostlyclean ::"
142 print " -rm -f core tags TAGS *~ *.bak *.i *.ln *.atac trace"
144 print "clean :: mostlyclean"
145 print " -$(SHELL) -c \"if test -n '$x' ; then $(MAKE) clean x=''; fi\""
146 print " -rm -rf *$o screendump *.lis $(TESTS) .libs *.dSYM"
148 print "distclean :: clean"
149 print " -rm -f Makefile ncurses_cfg.h config.status config.log"
151 print "realclean :: distclean"
154 print " $(SHELL) -c 'for N in $(TESTS); do echo LINT:$$N; $(LINT) $(LINT_OPTS) $(CPPFLAGS) $(srcdir)/$$N.c $(LINT_LIBS); done'"
155 print "$(BINDIR) $(DATADIR) :"
159 if (ECHO_LINK != "") {
160 ECHO_LINK="@ echo linking $@ ... ;"
162 for (n = 0; n < count; ++n) {
164 printf "$(destdir)%s$x:%s %s\n", progs[n], files[n], using[n];
165 printf "\t%s$(LINK) -o $@%s %s\n", ECHO_LINK, files[n], flags[n];