File: mk-2nd.awk

package info (click to toggle)
ncurses 1.9.9g-8.10
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 5,820 kB
  • ctags: 3,214
  • sloc: ansic: 29,854; ada: 7,858; makefile: 1,265; sh: 944; cpp: 938; awk: 317; perl: 90; sed: 4
file content (75 lines) | stat: -rw-r--r-- 3,006 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# $Id: mk-2nd.awk,v 1.7 1996/12/01 00:26:51 tom Exp $
################################################################################
# Copyright 1996 by Thomas E. Dickey <dickey@clark.net>                        #
# All Rights Reserved.                                                         #
#                                                                              #
# Permission to use, copy, modify, and distribute this software and its        #
# documentation for any purpose and without fee is hereby granted, provided    #
# that the above copyright notice appear in all copies and that both that      #
# copyright notice and this permission notice appear in supporting             #
# documentation, and that the name of the above listed copyright holder(s) not #
# be used in advertising or publicity pertaining to distribution of the        #
# software without specific, written prior permission. THE ABOVE LISTED        #
# COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,    #
# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT #
# SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL,        #
# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM   #
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE   #
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR    #
# PERFORMANCE OF THIS SOFTWARE.                                                #
################################################################################
# Generate compile-rules for the modules that we are using in libraries or
# programs.  We are listing them explicitly because we have turned off the
# suffix rules (to force compilation with the appropriate flags).  We could use
# make-recursion but that would result in makefiles that are useless for
# development.
#
# Variables:
#	model
#	MODEL (uppercase version of "model"; toupper is not portable)
#	echo (yes iff we will show the $(CC) lines)
#
# Fields in src/modules:
#	$1 = module name
#	$2 = progs|lib|c++
#	$3 = source-directory
#
# Fields in src/modules past $3 are dependencies
#
BEGIN	{
	print  ""
	print  "# generated by mk-2nd.awk"
	print  ""
	}
	!/^#/ {
	if ( $1 != "" ) {
		print  ""
		if ( $2 == "c++" ) {
			compile="CXX"
			suffix=".cc"
		} else {
			compile="CC"
			suffix=".c"
		}
		printf "../%s/%s.o :\t%s/%s%s", model, $1, $3, $1, suffix
		for (n = 4; n <= NF; n++) printf " \\\n\t\t\t%s", $n
		print  ""
		if ( echo == "yes" )
			atsign=""
		else {
			atsign="@"
			printf "\t@echo 'compiling %s (%s)'\n", $1, model
		}
		if ( $3 == "." || srcdir == "." )
			printf "\t%scd ../%s; $(%s) $(CFLAGS_%s) -c ../%s/%s%s", atsign, model, compile, MODEL, name, $1, suffix
		else
			printf "\t%scd ../%s; $(%s) $(CFLAGS_%s) -c %s/%s%s", atsign, model, compile, MODEL, $3, $1, suffix
	} else {
		printf "%s", $1
		for (n = 2; n <= NF; n++) printf " %s", $n
	}
	print  ""
	}
END	{
	print  ""
	}