| 227 |
dpurdie |
1 |
# -*- mode: perl; indent-width: 4; show-tabs: yes; -*-
|
|
|
2 |
#
|
|
|
3 |
# Module name : wcdos
|
|
|
4 |
# Module type : Makefile system
|
|
|
5 |
# Compiler(s) : ANSI C
|
|
|
6 |
# Environment(s): DOS
|
|
|
7 |
#
|
|
|
8 |
# Description:
|
|
|
9 |
# Watcom C/C++ toolset for DOS
|
|
|
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/WCDOS,v $
|
|
|
18 |
# $Revision: 1.2 $ $Date: 2004/05/06 09:11:25 $ $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
|
|
|
33 |
$s = asm;
|
|
|
34 |
$o = obj;
|
|
|
35 |
$a = lib;
|
|
|
36 |
$exe = ".exe";
|
|
|
37 |
|
|
|
38 |
#.. define WATCOM environment
|
|
|
39 |
Init( "watcom" );
|
|
|
40 |
ToolsetDefines( "wcdos.def" );
|
|
|
41 |
ToolsetRules( "wcdos.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 |
{
|
|
|
93 |
#ToolsetCCDepend() handles both CC and CXX source
|
|
|
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 |
# none
|
|
|
121 |
#
|
|
|
122 |
# Output:
|
|
|
123 |
# $(BINDIR)/name$.${a}: .... ]
|
|
|
124 |
# $(AR)
|
|
|
125 |
#
|
|
|
126 |
###############################################################################
|
|
|
127 |
|
|
|
128 |
sub ToolsetAR
|
|
|
129 |
{
|
|
|
130 |
my( $name, $pArgs, $pObjs ) = @_;
|
|
|
131 |
|
|
|
132 |
#.. Parse arguments
|
|
|
133 |
#
|
|
|
134 |
foreach $_ ( @$pArgs ) {
|
|
|
135 |
Message( "AR: unknown option $_ -- ignored\n" );
|
|
|
136 |
}
|
|
|
137 |
|
|
|
138 |
#.. Standard library builds, plus AMX configuration
|
|
|
139 |
#
|
|
|
140 |
MakeEntry( "\$(LIBDIR)/$name\$(GBE_TYPE).${a}:\t",
|
|
|
141 |
"", "\\\n\t\t", ".${o} ", @$pObjs );
|
|
|
142 |
|
|
|
143 |
#.. Build library rule
|
|
|
144 |
#
|
|
|
145 |
MakePrint( "\n\t\$(AR)\n\n" );
|
|
|
146 |
}
|
|
|
147 |
|
|
|
148 |
|
|
|
149 |
###############################################################################
|
|
|
150 |
# ToolsetLD( $name, \@args, \@objs, \@libraries )
|
|
|
151 |
# This subroutine takes the user options and builds the rules
|
|
|
152 |
# required to link the program 'name'.
|
|
|
153 |
#
|
|
|
154 |
# Arguments:
|
|
|
155 |
# --Stack=#[k] Stack size
|
|
|
156 |
#
|
|
|
157 |
# Output:
|
|
|
158 |
# $(BINDIR)/name${exe}:
|
|
|
159 |
# $(LD)
|
|
|
160 |
#
|
|
|
161 |
# $(BINDIR)/name.dep: $(SCM_PLATFORM).mk
|
|
|
162 |
# $(LDDEPEND)
|
|
|
163 |
#
|
|
|
164 |
# ifeq "$(IFLAG)" "2"
|
|
|
165 |
# -include "$(BINDIR)/name.dep"
|
|
|
166 |
# endif
|
|
|
167 |
#
|
|
|
168 |
# name_ld += ...
|
|
|
169 |
# :
|
|
|
170 |
#
|
|
|
171 |
# name_dp += ...
|
|
|
172 |
# :
|
|
|
173 |
#
|
|
|
174 |
###############################################################################
|
|
|
175 |
|
|
|
176 |
sub ToolsetLD
|
|
|
177 |
{
|
|
|
178 |
my( $name, $pArgs, $pObjs, $pLibs ) = @_;
|
|
|
179 |
my( $stack );
|
|
|
180 |
local( $ldname );
|
|
|
181 |
|
|
|
182 |
#.. Parse arguments
|
|
|
183 |
#
|
|
|
184 |
$stack = 0;
|
|
|
185 |
|
|
|
186 |
foreach $_ ( @$pArgs )
|
|
|
187 |
{
|
|
|
188 |
if (/^--Stack=(.*)/) { # stack size
|
|
|
189 |
$stack = "$1";
|
|
|
190 |
} else {
|
|
|
191 |
Message( "LD: unknown option $_ -- ignored\n" );
|
|
|
192 |
}
|
|
|
193 |
}
|
|
|
194 |
|
|
|
195 |
#.. Command file and library dependencies
|
|
|
196 |
#
|
|
|
197 |
MakePrint( "\n" ); # not appended to list
|
|
|
198 |
push( @$pLibs, "\$(watcom)/lib286/dos/clibl" );
|
|
|
199 |
push( @$pLibs, "\$(watcom)/lib286/dos/emu87" );
|
|
|
200 |
push( @$pLibs, "\$(watcom)/lib286/math87l" );
|
|
|
201 |
|
|
|
202 |
#.. Cleanup rules
|
|
|
203 |
#
|
|
|
204 |
ToolsetGenerate( "\$(BINDIR)/${name}.ld" );
|
|
|
205 |
ToolsetGenerate( "\$(BINDIR)/${name}.dep" );
|
|
|
206 |
ToolsetGenerate( "\$(BINDIR)/${name}.map" );
|
|
|
207 |
|
|
|
208 |
#.. Linker command file
|
|
|
209 |
#
|
|
|
210 |
# Now the fun part... piecing together a variable $(name_ld)
|
|
|
211 |
# which ends up in the command file.
|
|
|
212 |
#
|
|
|
213 |
MakePrint( "\$(BINDIR)/${name}${exe}:\n" .
|
|
|
214 |
"\t\$(LD)\n\n" );
|
|
|
215 |
|
|
|
216 |
MakePrint( "\$(BINDIR)/${name}.dep:\t\$(SCM_PLATFORM).mk\n".
|
|
|
217 |
"\t\$(LDDEPEND)\n\n" );
|
|
|
218 |
|
|
|
219 |
MakePrint( "ifeq \"\$(IFLAG)\" \"2\"\n" .
|
|
|
220 |
"-include\t\$(BINDIR)/${name}.dep\n" .
|
|
|
221 |
"endif\n\n" );
|
|
|
222 |
|
|
|
223 |
$ldname = "${name}_ld";
|
|
|
224 |
sub LdCmd {
|
|
|
225 |
MakeQuote "$ldname += @_\\n\n";
|
|
|
226 |
}
|
|
|
227 |
sub LdPrt {
|
|
|
228 |
MakePrint "@_\n";
|
|
|
229 |
}
|
|
|
230 |
|
|
|
231 |
LdCmd( "FORMAT DOS" );
|
|
|
232 |
LdPrt( "ifdef DEBUG" );
|
|
|
233 |
LdCmd( "DEBUG Watcom All" );
|
|
|
234 |
LdPrt( "endif" );
|
|
|
235 |
|
|
|
236 |
foreach $i ( @$pObjs ) {
|
|
|
237 |
LdCmd( "FILE \$(subst /,\\\\,\$(strip $i)).${o}" );
|
|
|
238 |
}
|
|
|
239 |
|
|
|
240 |
LdCmd( "\$(patsubst %,LIBPATH %\\n,\$(subst /,\\\\,\$(LIBDIRS)))" );
|
|
|
241 |
|
|
|
242 |
foreach $i ( @$pLibs ) {
|
|
|
243 |
LdCmd( "LIBRARY \$(subst /,\\\\,\$(strip $i)).${a}" );
|
|
|
244 |
}
|
|
|
245 |
|
|
|
246 |
LdCmd( "OPTION DosSeg" );
|
|
|
247 |
LdCmd( "OPTION CaseExact" );
|
|
|
248 |
LdCmd( "OPTION NoDefaultLibs" );
|
|
|
249 |
LdCmd( "OPTION Map=\$(subst /,\\\\,\$(BINDIR)/${name}.map)" );
|
|
|
250 |
LdCmd( "OPTION Stack=$stack" )
|
|
|
251 |
if ($stack);
|
|
|
252 |
LdCmd( "OPTION Verbose" );
|
|
|
253 |
LdCmd( "NAME \$(subst /,\\\\,\$(BINDIR)/${name}${exe})" );
|
|
|
254 |
LdPrt( "" );
|
|
|
255 |
|
|
|
256 |
#.. Dependency link,
|
|
|
257 |
#
|
|
|
258 |
# Now piece together a variable $(name_dp) which ends up in
|
|
|
259 |
# the command file building the application dependency list.
|
|
|
260 |
#
|
|
|
261 |
$ldname = "${name}_dp";
|
|
|
262 |
|
|
|
263 |
foreach $i ( @$pLibs ) {
|
|
|
264 |
LdCmd("\$(BINDIR)/${name}${exe}: @(vpath2,$i.${a},WCX86_LIB)" );
|
|
|
265 |
}
|
|
|
266 |
}
|
|
|
267 |
|
|
|
268 |
#.. Successful termination
|
|
|
269 |
1;
|