blob: bb07abe06276e4e2cb5ba9bf54678940fb9454a1 [file] [log] [blame]
micky3879b9f5e72025-07-08 18:04:53 -04001# $Id: mk-pkg.awk,v 1.1 2022/12/17 23:41:18 tom Exp $
2##############################################################################
3# Copyright 2022 Thomas E. Dickey #
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
31#
32# add rules to Makefile for AdaCurses binding package.
33BEGIN {
34 print "# generated by mk-pkg.awk\n";
35 }
36END {
37 printf "PACKAGE = %s\n", PACKAGE
38 print "real_bindir = $(libexecdir)/$(PACKAGE)"
39 print "REAL_BINDIR = $(LIBEXECDIR)/$(PACKAGE)"
40 print "SUB_MFLAGS = $(TOP_MFLAGS) BINDIR=$(REAL_BINDIR)"
41 print "samples = samples"
42 print ""
43 print "TESTS = \\"
44 print " $(samples)/ncurses \\"
45 print " $(samples)/rain \\"
46 print " $(samples)/tour"
47 print ""
48 print "DATAFILES = \\"
49 print " $(samples)/explain.txt"
50 print ""
51 print "all:: $(TESTS)"
52 print ""
53 print "# we might install the example-programs"
54 print "$(PACKAGE) :"
55 print " @echo \"creating $(PACKAGE) script\""
56 print " @$(SHELL) -c '\\"
57 print " L=$(real_bindir); \\"
58 print " rm -f $@; \\"
59 print " echo \"#!$(SHELL)\" > $@;\\"
60 print " echo \"PATH=\\\"$$L\\\":\\$$PATH\" >>$@;\\"
61 print " echo \"export PATH\" >>$@;\\"
62 print " echo \"if test \\$$# != 0; then\" >>$@;\\"
63 print " echo \" exec \\\"\\$$@\\\"\" >>$@;\\"
64 print " echo \"elif test -t 1; then\" >>$@;\\"
65 print " echo \" cd \\\"$$L\\\" || exit\" >>$@;\\"
66 print " echo \" ls -l | \\$${PAGER:-less}\" >>$@;\\"
67 print " echo \"fi\" >>$@;\\"
68 print " echo \"echo \\\"usage: $@ [program]\\\"\" >>$@'"
69 print ""
70 print "install \\"
71 print "install.examples:: $(PACKAGE) $(BINDIR) $(REAL_BINDIR) $(DATADIR) $(TESTS)"
72 print " @echo \"installing $(PACKAGE) -> $(BINDIR)/\""
73 print " $(INSTALL_SCRIPT) $(PACKAGE) $(BINDIR)"
74 print " ( cd samples && $(MAKE) $(SUB_MFLAGS) install.examples )"
75 print ""
76 print "uninstall \\"
77 print "uninstall.examples ::"
78 print " -rm -f $(BINDIR)/$(PACKAGE)"
79 print " ( cd samples && $(MAKE) $(SUB_MFLAGS) uninstall.examples )"
80 print ""
81 print "clean \\"
82 print "mostlyclean \\"
83 print "realclean \\"
84 print "distclean ::"
85 print " -rm -f $(PACKAGE)"
86 print ""
87 print "$(BINDIR) $(REAL_BINDIR) $(DATADIR) :"
88 print " mkdir -p $@"
89
90 }