| 227 |
dpurdie |
1 |
# -*- mode: perl; indent-width: 4; show-tabs: yes; -*-
|
|
|
2 |
#
|
|
|
3 |
# Module name : wc4gw
|
|
|
4 |
# Module type : Makefile system
|
|
|
5 |
# Compiler(s) : ANSI C
|
|
|
6 |
# Environment(s): DOS
|
|
|
7 |
#
|
|
|
8 |
# Description:
|
|
|
9 |
# Watcom C/C++ toolset for DOS4GW
|
|
|
10 |
#
|
|
|
11 |
# Version Who Date Description
|
|
|
12 |
# 1.0 APY 07/05/99 Created
|
|
|
13 |
# 13/06/00 --Stack
|
|
|
14 |
# 14/06/00 Build application dependency list
|
|
|
15 |
# APY 13/11/00 ${exe} now embeddes '.' if required.
|
|
|
16 |
#
|
|
|
17 |
# $Source: /cvsroot/etm/devl/CFG/TOOLSET/WC4GW,v $
|
|
|
18 |
# $Revision: 1.2 $ $Date: 2004/05/06 09:11:13 $ $State: Exp $
|
|
|
19 |
# $Author: ayoung $ $Locker: $
|
|
|
20 |
#............................................................................#
|
|
|
21 |
|
|
|
22 |
##############################################################################
|
|
|
23 |
# ToolsetInit()
|
|
|
24 |
# Runtime initialisation
|
|
|
25 |
#
|
|
|
26 |
##############################################################################
|
|
|
27 |
|
|
|
28 |
ToolsetInit();
|
|
|
29 |
|
|
|
30 |
sub ToolsetInit
|
|
|
31 |
{
|
|
|
32 |
#.. standard.rul requirements
|
| 261 |
dpurdie |
33 |
$s = 'asm';
|
|
|
34 |
$o = 'obj';
|
|
|
35 |
$a = 'lib';
|
| 227 |
dpurdie |
36 |
$exe = ".exe";
|
|
|
37 |
|
|
|
38 |
#.. define WATCOM environment
|
|
|
39 |
Init( "watcom" );
|
|
|
40 |
ToolsetDefines( "wc4gw.def" );
|
|
|
41 |
ToolsetRules( "wc386.rul" );
|
|
|
42 |
ToolsetRules( "standard.rul" );
|
|
|
43 |
}
|
|
|
44 |
|
|
|
45 |
###############################################################################
|
|
|
46 |
# ToolsetCC( $source, $obj, \@args )
|
|
|
47 |
# This subroutine takes the user options and builds the rule(s)
|
|
|
48 |
# required to compile the source file 'source' to 'obj'
|
|
|
49 |
#
|
|
|
50 |
###############################################################################
|
|
|
51 |
|
|
|
52 |
sub ToolsetCC
|
|
|
53 |
{
|
|
|
54 |
MakePrint( "\n\t\$(CC)\n" );
|
|
|
55 |
}
|
|
|
56 |
|
|
|
57 |
###############################################################################
|
|
|
58 |
# ToolsetCCDepend( $depend, \@sources )
|
|
|
59 |
# This subroutine takes the user options and builds the
|
|
|
60 |
# rule(s) required to build the dependencies for the source
|
|
|
61 |
# files 'sources' to 'depend'.
|
|
|
62 |
#
|
|
|
63 |
###############################################################################
|
|
|
64 |
|
|
|
65 |
sub ToolsetCCDepend
|
|
|
66 |
{
|
|
|
67 |
MakePrint( "\t\$(CCDEPEND)\n" );
|
|
|
68 |
}
|
|
|
69 |
|
|
|
70 |
|
|
|
71 |
###############################################################################
|
|
|
72 |
# ToolsetCXX( $source, $obj, \@args )
|
|
|
73 |
# This subroutine takes the user options and builds the rule(s)
|
|
|
74 |
# required to compile the source file 'source' to 'obj'
|
|
|
75 |
#
|
|
|
76 |
###############################################################################
|
|
|
77 |
|
|
|
78 |
sub ToolsetCXX
|
|
|
79 |
{
|
|
|
80 |
MakePrint( "\n\t\$(CXX)\n" );
|
|
|
81 |
}
|
|
|
82 |
|
|
|
83 |
###############################################################################
|
|
|
84 |
# ToolsetCXXDepend( $depend, \@sources )
|
|
|
85 |
# This subroutine takes the user options and builds the
|
|
|
86 |
# rule(s) required to build the dependencies for the source
|
|
|
87 |
# files 'sources' to 'depend'.
|
|
|
88 |
#
|
|
|
89 |
###############################################################################
|
|
|
90 |
|
|
|
91 |
sub ToolsetCXXDepend
|
|
|
92 |
{
|
| 287 |
dpurdie |
93 |
ToolsetCCDepend();
|
| 227 |
dpurdie |
94 |
}
|
|
|
95 |
|
|
|
96 |
|
|
|
97 |
###############################################################################
|
|
|
98 |
# ToolsetAS( $source, $obj, \@args )
|
|
|
99 |
# This subroutine takes the user options and builds the rule(s)
|
|
|
100 |
# required to compile the source file 'source' to 'obj'
|
|
|
101 |
#
|
|
|
102 |
###############################################################################
|
|
|
103 |
|
|
|
104 |
sub ToolsetAS
|
|
|
105 |
{
|
|
|
106 |
MakePrint( "\n\t\$(AS)\n" );
|
|
|
107 |
}
|
|
|
108 |
|
|
|
109 |
sub ToolsetASDepend
|
|
|
110 |
{
|
|
|
111 |
}
|
|
|
112 |
|
|
|
113 |
|
|
|
114 |
###############################################################################
|
|
|
115 |
# ToolsetAR( $name, \@args, \@objs )
|
|
|
116 |
# This subroutine takes the user options and builds the rules
|
|
|
117 |
# required to build the library 'name'.
|
|
|
118 |
#
|
|
|
119 |
# Arguments:
|
|
|
120 |
# --X
|
|
|
121 |
#
|
|
|
122 |
# Output:
|
|
|
123 |
# [ $(BINDIR)/name$.${a}: .... ]
|
|
|
124 |
# $(AR)
|
|
|
125 |
#
|
|
|
126 |
###############################################################################
|
|
|
127 |
|
|
|
128 |
sub ToolsetAR
|
|
|
129 |
{
|
|
|
130 |
my( $name, $pArgs, $pObjs ) = @_;
|
|
|
131 |
local( $name_ld );
|
|
|
132 |
|
|
|
133 |
#.. Parse arguments
|
|
|
134 |
#
|
|
|
135 |
foreach $_ ( @$pArgs ) {
|
|
|
136 |
Message( "AR: unknown option $_ -- ignored\n" );
|
|
|
137 |
}
|
|
|
138 |
|
|
|
139 |
#.. Build library rule (just append to standard rule)
|
|
|
140 |
#
|
|
|
141 |
MakeEntry( "\$(LIBDIR)/$name\$(GBE_TYPE).${a}:\t", "", "\\\n\t\t", "", @$pObjs );
|
|
|
142 |
#.. Build library rule
|
|
|
143 |
#
|
|
|
144 |
MakePrint( "\n\t\$(AR)\n\n" );
|
|
|
145 |
}
|
|
|
146 |
|
|
|
147 |
|
|
|
148 |
###############################################################################
|
|
|
149 |
# ToolsetLD( $name, \@args, \@objs, \@libraries )
|
|
|
150 |
# This subroutine takes the user options and builds the rules
|
|
|
151 |
# required to link the program 'name'.
|
|
|
152 |
#
|
|
|
153 |
# Arguments:
|
|
|
154 |
# --Stack=#[k] Stack size (default 4K)
|
|
|
155 |
#
|
|
|
156 |
# Output:
|
|
|
157 |
# $(BINDIR)/name${exe}:
|
|
|
158 |
# $(LD)
|
|
|
159 |
#
|
|
|
160 |
# name_ld += ...
|
|
|
161 |
# :
|
|
|
162 |
#
|
|
|
163 |
###############################################################################
|
|
|
164 |
|
|
|
165 |
sub ToolsetLD
|
|
|
166 |
{
|
|
|
167 |
my( $name, $pArgs, $pObjs, $pLibs ) = @_;
|
|
|
168 |
my( $stack );
|
|
|
169 |
local( $ldname );
|
|
|
170 |
|
|
|
171 |
#.. Parse arguments
|
|
|
172 |
#
|
|
|
173 |
$stack = "4k"; # stack
|
|
|
174 |
foreach $_ ( @$pArgs )
|
|
|
175 |
{
|
|
|
176 |
if (/^--Stack=(.*)/) { # ISP module
|
|
|
177 |
$stack = "$1";
|
|
|
178 |
|
|
|
179 |
} else {
|
|
|
180 |
Message( "LD: unknown option $_ -- ignored\n" );
|
|
|
181 |
}
|
|
|
182 |
}
|
|
|
183 |
|
|
|
184 |
#.. Command file and library dependencies
|
|
|
185 |
#
|
|
|
186 |
push( @$pLibs, "\$(watcom)/lib386/dos/clib3r" );
|
|
|
187 |
push( @$pLibs, "\$(watcom)/lib386/dos/emu387" );
|
|
|
188 |
push( @$pLibs, "\$(watcom)/lib386/math387r" );
|
|
|
189 |
MakePrint( "\n" ); # not appended to list
|
|
|
190 |
|
|
|
191 |
#.. Cleanup rules
|
|
|
192 |
#
|
|
|
193 |
ToolsetGenerate( "\$(BINDIR)/${name}.ld" );
|
|
|
194 |
ToolsetGenerate( "\$(BINDIR)/${name}.dep" );
|
|
|
195 |
ToolsetGenerate( "\$(BINDIR)/${name}.map" );
|
|
|
196 |
|
|
|
197 |
#.. Linker command file
|
|
|
198 |
#
|
|
|
199 |
# Now the fun part... piecing together a variable $(name_ld)
|
|
|
200 |
# which ends up in the command file.
|
|
|
201 |
#
|
|
|
202 |
MakePrint( "\$(BINDIR)/${name}${exe}:\n" .
|
|
|
203 |
"\t\$(LD)\n\n" );
|
|
|
204 |
|
|
|
205 |
MakePrint( "\$(BINDIR)/${name}.dep:\t\$(SCM_PLATFORM).mk\n".
|
|
|
206 |
"\t\$(LDDEPEND)\n\n" );
|
|
|
207 |
|
| 261 |
dpurdie |
208 |
MakePrint( "ifeq \"\$(IFLAG)\" \"3\"\n" .
|
| 227 |
dpurdie |
209 |
"-include\t\$(BINDIR)/${name}.dep\n" .
|
|
|
210 |
"endif\n\n" );
|
|
|
211 |
|
|
|
212 |
$ldname = "${name}_ld";
|
|
|
213 |
sub LdCmd {
|
| 261 |
dpurdie |
214 |
MakeQuote ("$ldname += @_\\n\n");
|
| 227 |
dpurdie |
215 |
}
|
|
|
216 |
sub LdPrt {
|
| 261 |
dpurdie |
217 |
MakePrint ("@_\n");
|
| 227 |
dpurdie |
218 |
}
|
|
|
219 |
|
|
|
220 |
LdCmd( "SYSTEM DOS4G" );
|
|
|
221 |
LdPrt( "ifeq \"\$(DEBUG)\" \"1\"");
|
|
|
222 |
LdCmd( "DEBUG Watcom All" );
|
|
|
223 |
LdPrt( "endif" );
|
|
|
224 |
|
|
|
225 |
foreach $i ( @$pObjs ) {
|
|
|
226 |
LdCmd( "FILE \$(subst /,\\\\,\$(strip $i)).${o}" );
|
|
|
227 |
}
|
|
|
228 |
|
|
|
229 |
LdCmd( "\$(patsubst %,LIBPATH %\\n,\$(subst /,\\\\,\$(LIBDIRS)))" );
|
|
|
230 |
foreach $i ( @$pLibs ) {
|
|
|
231 |
LdCmd( "LIBRARY \$(subst /,\\\\,\$(strip $i)).${a}" );
|
|
|
232 |
}
|
|
|
233 |
|
|
|
234 |
LdCmd( "OPTION CaseExact" );
|
|
|
235 |
LdCmd( "OPTION NoDefaultLibs" );
|
|
|
236 |
LdCmd( "OPTION Map=\$(subst /,\\\\,\$(BINDIR)/${name}.map)" );
|
|
|
237 |
LdCmd( "OPTION Stack=$stack" );
|
|
|
238 |
LdCmd( "OPTION Verbose" );
|
|
|
239 |
LdCmd( "NAME \$(subst /,\\\\,\$(BINDIR)/${name}${exe})" );
|
|
|
240 |
LdPrt( "" );
|
|
|
241 |
|
|
|
242 |
#.. Dependency link,
|
|
|
243 |
#
|
|
|
244 |
# Now piece together a variable $(name_dp) which ends up in
|
|
|
245 |
# the command file building the application dependency list.
|
|
|
246 |
#
|
|
|
247 |
$ldname = "${name}_dp";
|
|
|
248 |
|
|
|
249 |
foreach $i ( @$pLibs ) {
|
|
|
250 |
LdCmd("\$(BINDIR)/${name}${exe}: @(vpath2,$i.${a},WC386_LIB)" );
|
|
|
251 |
}
|
|
|
252 |
}
|
|
|
253 |
|
|
|
254 |
#.. Successful termination
|
|
|
255 |
1;
|
|
|
256 |
|