| 227 |
dpurdie |
1 |
# -*- mode: mak; -*-
|
|
|
2 |
##############################################################################
|
| 6177 |
dpurdie |
3 |
# COPYRIGHT - VIX IP PTY LTD ("VIX"). ALL RIGHTS RESERVED.
|
| 227 |
dpurdie |
4 |
#
|
|
|
5 |
# File: TOOLSET/pd386.rul[e]
|
|
|
6 |
# Contents: Paradigm/386 rules
|
|
|
7 |
#
|
|
|
8 |
# Revision History:
|
|
|
9 |
# 20/02/02 APY Created
|
|
|
10 |
# 26/02/02 APY Added depend post processing to append OBJDIR
|
|
|
11 |
# 27/02/02 APY ; appended to several directives, forcing use of
|
|
|
12 |
# exe' during execution. Required by WIN32
|
|
|
13 |
# toolsets (see xx_term variables),
|
|
|
14 |
# 09/04/02 - __PARADIGM__ defined within asm sessions
|
|
|
15 |
# - trimmed white space
|
|
|
16 |
# 20/04/02 - realpath() usage required by debugger.
|
|
|
17 |
##############################################################################
|
|
|
18 |
|
|
|
19 |
##############################################################################
|
|
|
20 |
#.. Remove "undef" warnings
|
|
|
21 |
#
|
|
|
22 |
cc_includes +=
|
|
|
23 |
cc_defines +=
|
|
|
24 |
cxx_includes +=
|
|
|
25 |
cxx_defines +=
|
|
|
26 |
as_includes +=
|
|
|
27 |
as_defines +=
|
|
|
28 |
|
|
|
29 |
###############################################################################
|
|
|
30 |
#.. C Compiler definition
|
|
|
31 |
# Paradigm C++ 6.00.003 Copyright (c) 1998, 2001 Paradigm Systems.
|
|
|
32 |
# Syntax is: PCC32 [ options ] file[s] * = default; -x- = turn switch x off
|
|
|
33 |
# -3 * 80386 Instructions -4 80486 Instructions
|
|
|
34 |
# -Ax Disable extensions -B Compile via assembly
|
|
|
35 |
# -C Allow nested comments -Dxxx Define macro
|
|
|
36 |
# -Exxx Alternate Assembler name -Hxxx Use pre-compiled headers
|
|
|
37 |
# -Ixxx Include files directory -K Default char is unsigned
|
|
|
38 |
# -Lxxx Libraries directory -M Generate link map
|
|
|
39 |
# -N Check stack overflow -Ox Optimizations
|
|
|
40 |
# -P Force C++ compile -R Produce browser info
|
|
|
41 |
# -RT * Generate RTTI -S Produce assembly output
|
|
|
42 |
# -Txxx Set assembler option -Uxxx Undefine macro
|
|
|
43 |
# -Vx Virtual table control -X Suppress autodep. output
|
|
|
44 |
# -aN Align on N bytes -b * Treat enums as integers
|
|
|
45 |
# -c * Compile only -d Merge duplicate strings
|
|
|
46 |
# -exxx Executable file name -fxx Floating point options
|
|
|
47 |
# -gN Stop after N warnings -iN Max. identifier length
|
|
|
48 |
# -jN Stop after N errors -k * Standard stack frame
|
|
|
49 |
# -lx Set linker option -nxxx Output file directory
|
|
|
50 |
# -oxxx Object file name -p Pascal calls
|
|
|
51 |
# -tWxxx Create Windows app -u * Underscores on externs
|
|
|
52 |
# -v Source level debugging -wxxx Warning control
|
|
|
53 |
# -xxxx Exception handling -y Produce line number info
|
|
|
54 |
# -zxxx Set segment names
|
|
|
55 |
#
|
|
|
56 |
|
|
|
57 |
cc = @pcc32
|
|
|
58 |
cc_init =
|
|
|
59 |
cc_o_switch =
|
|
|
60 |
cc_source =
|
|
|
61 |
cc_cmdfile = $(subst /,\\,$(basename $@).cmd)
|
|
|
62 |
cc_flags = @$(cc_cmdfile)
|
|
|
63 |
cc_term = ; # ; force use of 'sh.exe'
|
|
|
64 |
|
|
|
65 |
pd_includes += $(paradigm)/include
|
|
|
66 |
|
|
|
67 |
# Options:
|
|
|
68 |
#
|
|
|
69 |
# -f- no floating point
|
|
|
70 |
# -j# stop after # errors
|
|
|
71 |
# -v generate debug information
|
|
|
72 |
# -0x optimisation
|
|
|
73 |
# -w Enable warnings
|
|
|
74 |
# -w-aus suppress warning for unused variables
|
|
|
75 |
# -w-par suppress warning for unused function parameters
|
|
|
76 |
# -w-pro suppress warning for function pointer without protoype
|
|
|
77 |
#
|
|
|
78 |
|
|
|
79 |
pd_flags = -c -w -j50 -D__STDC__=1
|
|
|
80 |
pd_flags += -f- -Hu
|
|
|
81 |
ifeq "$(DEBUG)" "1"
|
|
|
82 |
pd_flags += -Od -r- -v -R -DDEBUG
|
|
|
83 |
else
|
|
|
84 |
ifdef PD_NOOPTIM
|
|
|
85 |
pd_flags += -Od -r- -v
|
|
|
86 |
else
|
|
|
87 |
pd_flags += -O2 -X -w-aus -w-par -w-pro
|
|
|
88 |
endif
|
|
|
89 |
endif
|
|
|
90 |
ifdef ALVL
|
|
|
91 |
pd_flags += -DALVL=$(ALVL)
|
|
|
92 |
endif
|
|
|
93 |
ifdef DLVL
|
|
|
94 |
pd_flags += -DDLVL=$(DLVL)
|
|
|
95 |
endif
|
|
|
96 |
pd_flags += -D__SOURCE__=\"$(notdir $<)\"
|
|
|
97 |
pd_flags += -D__LOCATE32__
|
|
|
98 |
|
|
|
99 |
define cc_pre
|
| 6177 |
dpurdie |
100 |
@echo '[$<] compiling..'
|
| 227 |
dpurdie |
101 |
@$(cmdfile) -ko$(cc_cmdfile) "\
|
|
|
102 |
$(patsubst %,%\\n,$(pd_flags)) \
|
|
|
103 |
$(patsubst %,%\\n,$(CFLAGS)) \
|
|
|
104 |
$(patsubst %,-D%\\n,$(cc_defines)) \
|
|
|
105 |
$(patsubst %,-I%\\n,$(subst /,\\\\,$(INCDIRS))) \
|
|
|
106 |
$(patsubst %,-I%\\n,$(subst /,\\\\,$(cc_includes))) \
|
|
|
107 |
$(patsubst %,-I%\\n,$(subst /,\\\\,$(pd_includes))) \
|
|
|
108 |
$(subst /,\\\\,-o$@)\\n\
|
|
|
109 |
@(realpath,$(subst /,\\,$<))"
|
|
|
110 |
endef
|
|
|
111 |
|
|
|
112 |
ifndef LEAVETMP
|
|
|
113 |
define cc_post
|
|
|
114 |
@$(rm) -f $(cc_cmdfile)
|
|
|
115 |
endef
|
|
|
116 |
else
|
|
|
117 |
define cc_post
|
|
|
118 |
endef
|
|
|
119 |
endif
|
|
|
120 |
|
|
|
121 |
###############################################################################
|
|
|
122 |
#.. C/C++ dependencies
|
|
|
123 |
# depend and depend.err
|
|
|
124 |
#
|
|
|
125 |
pd_depend = -D__PARADIGM__=600 -D__STDC__
|
|
|
126 |
pd_depend += -D__BORLANDC__=0x530 -D__TURBOC__=0x530
|
|
|
127 |
pd_depend += -D__386__ -D_M_IX86
|
|
|
128 |
pd_depend += -DMSDOS -D__MSDOS__ -D__DOS__
|
|
|
129 |
ifeq "$(DEBUG)" "1"
|
|
|
130 |
pd_depend += -DDEBUG
|
|
|
131 |
else
|
|
|
132 |
pd_depend += -D__PCOPT__
|
|
|
133 |
endif
|
|
|
134 |
ifdef ALVL
|
|
|
135 |
pd_depend += -DALVL=$(ALVL)
|
|
|
136 |
endif
|
|
|
137 |
ifdef DLVL
|
|
|
138 |
pd_depend += -DDLVL=$(DLVL)
|
|
|
139 |
endif
|
|
|
140 |
pd_depend += -D__SOURCE__=\"$(notdir $<)\"
|
|
|
141 |
|
|
|
142 |
ccdep = @$(SCM_BIN)/mkdepend
|
|
|
143 |
ccdep_init =
|
|
|
144 |
ccdep_o_switch = -f -
|
|
|
145 |
ccdep_source = $(filter %.c %.cc %.cpp, $+) > $(subst /,/,$@).tmp 2> $@.err
|
|
|
146 |
ccdep_flags = -MM \
|
|
|
147 |
$(patsubst %,%,$(CFLAGS)) \
|
|
|
148 |
$(patsubst %,-D%,$(cc_defines)) \
|
|
|
149 |
$(patsubst %,%,$(pd_depend)) \
|
|
|
150 |
$(patsubst %,-I %,$(INCDIRS)) \
|
|
|
151 |
$(patsubst %,-Y %,$(cc_includes)) \
|
|
|
152 |
$(patsubst %,-Y %,$(pd_includes)) \
|
|
|
153 |
$(patsubst %,-Y %,$(NODEPDIRS))
|
|
|
154 |
|
|
|
155 |
ccdep_pre =
|
|
|
156 |
|
|
|
157 |
define ccdep_post
|
|
|
158 |
-sed s/\^/\$$\(OBJDIR\)\\// $(subst /,/,$@).tmp | grep \\.${o} > $(subst /,/,$@)
|
|
|
159 |
@rm $(subst /,/,$@).tmp
|
|
|
160 |
endef
|
|
|
161 |
|
|
|
162 |
#.. C++ Compiler definition
|
|
|
163 |
#
|
|
|
164 |
cxx = @pcc32
|
|
|
165 |
cxx_init =
|
|
|
166 |
cxx_o_switch = -P
|
|
|
167 |
cxx_object = -o$@
|
|
|
168 |
cxx_source =
|
|
|
169 |
cxx_cmdfile = $(subst /,\\,$(basename $@).cmd)
|
|
|
170 |
cxx_flags = @$(cxx_cmdfile)
|
|
|
171 |
cxx_term = ; # ; force use of 'sh.exe'
|
|
|
172 |
|
|
|
173 |
define cxx_pre
|
| 6177 |
dpurdie |
174 |
@echo '[$<] compiling..'
|
| 227 |
dpurdie |
175 |
@$(cmdfile) -ko$(cxx_cmdfile) "\
|
|
|
176 |
$(patsubst %,%\\n,$(CXXFLAGS)) \
|
|
|
177 |
$(patsubst %,-D%\\n,$(cxx_defines)) \
|
|
|
178 |
$(patsubst %,%\\n,$(pd_flags)) \
|
|
|
179 |
$(patsubst %,-I%\\n,$(subst /,\\\\,$(INCDIRS))) \
|
|
|
180 |
$(patsubst %,-I%\\n,$(subst /,\\\\,$(cxx_includes))) \
|
|
|
181 |
$(patsubst %,-I%\\n,$(subst /,\\\\,$(pd_includes))) \
|
|
|
182 |
$(subst /,\\\\,$(cxx_object))\\n\
|
|
|
183 |
@(realpath,$(subst /,\\,$<))"
|
|
|
184 |
endef
|
|
|
185 |
|
|
|
186 |
ifndef LEAVETMP
|
|
|
187 |
define cxx_post
|
|
|
188 |
@$(rm) -f $(cxx_cmdfile)
|
|
|
189 |
endef
|
|
|
190 |
else
|
|
|
191 |
define cxx_post
|
|
|
192 |
endef
|
|
|
193 |
endif
|
|
|
194 |
|
|
|
195 |
|
|
|
196 |
###############################################################################
|
|
|
197 |
#.. Assembler definition
|
|
|
198 |
#
|
|
|
199 |
# PASM32 [options] source [,object] [,listing] [,xref]
|
|
|
200 |
# /a,/s Alphabetic or Source-code segment ordering
|
|
|
201 |
# /c Generate cross-reference in listing
|
|
|
202 |
# /dSYM[=VAL] Define symbol SYM = 0, or = value VAL
|
|
|
203 |
# /e,/r Emulated or Real floating-point instructions
|
|
|
204 |
# /h,/? Display this help screen
|
|
|
205 |
# /iPATH Search PATH for include files
|
|
|
206 |
# /jCMD Jam in an assembler directive CMD (eg. /jIDEAL)
|
|
|
207 |
# /kh# Hash table capacity # symbols
|
|
|
208 |
# /l,/la Generate listing: l=normal listing, la=expanded listing
|
|
|
209 |
# /ml,/mx,/mu Case sensitivity on symbols: ml=all, mx=globals, mu=none
|
|
|
210 |
# /mv# Set maximum valid length for symbols
|
|
|
211 |
# /m# Allow # multiple passes to resolve forward references
|
|
|
212 |
# /n Suppress symbol tables in listing
|
|
|
213 |
# /p Check for code segment overrides in protected mode
|
|
|
214 |
# /q Suppress OBJ records not needed for linking
|
|
|
215 |
# /t Suppress messages if successful assembly
|
|
|
216 |
# /uxxxx Set version emulation, version xxxx
|
|
|
217 |
# /w0,/w1,/w2 Set warning level: w0=none, w1=w2=warnings on
|
|
|
218 |
# /w-xxx,/w+xxx Disable (-) or enable (+) warning xxx
|
|
|
219 |
# /x Include false conditionals in listing
|
|
|
220 |
# /z Display source line with error message
|
|
|
221 |
# /zi,/zd,/zn Debug info: zi=full, zd=line numbers only, zn=none
|
|
|
222 |
#
|
|
|
223 |
|
|
|
224 |
as = @pasm32
|
|
|
225 |
as_init =
|
|
|
226 |
as_flags = @$(as_cmdfile)
|
|
|
227 |
as_o_switch =
|
|
|
228 |
as_object = $(subst /,\\,$@)
|
|
|
229 |
as_list = $(subst /,\\,$(basename $@).lst)
|
|
|
230 |
as_source = $(subst /,\\,$<) ,$(as_object) ,$(as_list)
|
|
|
231 |
as_cmdfile = $(subst /,\\,$(basename $@).cmd)
|
|
|
232 |
as_term = ; # ; force use of 'sh.exe'
|
|
|
233 |
|
|
|
234 |
as_i_switch = /i
|
|
|
235 |
as_includes += $(paradigm)/include
|
|
|
236 |
|
|
|
237 |
pasm_flags = /c /ml /t
|
|
|
238 |
ifeq "$(DEBUG)" "1"
|
|
|
239 |
pasm_flags += /w2 /zi /DDEBUG
|
|
|
240 |
endif
|
|
|
241 |
pasm_flags += /D__PARADIGM__ # Target C/C++ compiler
|
|
|
242 |
ifdef DLVL
|
|
|
243 |
pasm_flags += /DDLVL=$(DLVL)
|
|
|
244 |
endif
|
|
|
245 |
ifdef ALVL
|
|
|
246 |
pasm_flags += /DALVL=$(ALVL)
|
|
|
247 |
endif
|
|
|
248 |
as_defines := $(addprefix /D,$(as_defines))
|
|
|
249 |
as_defines += $(pasm_flags)
|
|
|
250 |
|
|
|
251 |
define as_pre
|
|
|
252 |
@$(cmdfile) -ko$(as_cmdfile) "\
|
|
|
253 |
$(patsubst %,%\\n,$(ASFLAGS)) \
|
|
|
254 |
$(patsubst %,%\\n,$(as_defines)) \
|
|
|
255 |
$(patsubst %,$(as_i_switch)%\\n,$(subst /,\\\\,$(INCDIRS))) \
|
|
|
256 |
$(patsubst %,$(as_i_switch)%\\n,$(subst /,\\\\,$(as_includes)))"
|
|
|
257 |
endef
|
|
|
258 |
|
|
|
259 |
ifndef LEAVETMP
|
|
|
260 |
define as_post
|
|
|
261 |
@$(rm) -f $(as_cmdfile)
|
|
|
262 |
endef
|
|
|
263 |
else
|
|
|
264 |
define as_post
|
|
|
265 |
endef
|
|
|
266 |
endif
|
|
|
267 |
|
|
|
268 |
#.. Archiver (AR)
|
|
|
269 |
#
|
|
|
270 |
# /C case-sensitive symbol support
|
|
|
271 |
# /E create an extended dictionary
|
|
|
272 |
# /P page size
|
|
|
273 |
#
|
|
|
274 |
ar = @plib
|
|
|
275 |
ar_init =
|
|
|
276 |
ar_cmdfile = $(subst /,\\,$(basename $@).ar)
|
|
|
277 |
ar_flags = /E /P512
|
|
|
278 |
ar_o_switch = $(subst /,\\,$@) @$(ar_cmdfile)
|
|
|
279 |
ar_term = ; # ; force use of 'sh.exe'
|
|
|
280 |
|
|
|
281 |
define ar_pre
|
|
|
282 |
@$(cmdfile) -ko$(ar_cmdfile) \
|
|
|
283 |
$(patsubst %,+% \&\\n,$(subst /,\\\\,$^)) \
|
|
|
284 |
,$(subst /,\\,$(basename $@).lst); \
|
|
|
285 |
$(rm) -f $@
|
|
|
286 |
endef
|
|
|
287 |
|
|
|
288 |
ifndef LEAVETMP
|
|
|
289 |
define ar_post
|
|
|
290 |
@$(rm) -f $(ar_cmdfile)
|
|
|
291 |
endef
|
|
|
292 |
else
|
|
|
293 |
define ar_post
|
|
|
294 |
endef
|
|
|
295 |
endif
|
|
|
296 |
|
|
|
297 |
|
|
|
298 |
#.. Linker (LD)
|
|
|
299 |
#
|
|
|
300 |
# PLINK32 objfiles, exefile, mapfile, libfiles, deffile, resfiles
|
|
|
301 |
# @xxxx indicates use response file xxxx
|
|
|
302 |
# -m Map file with publics -x No map
|
|
|
303 |
# -s Detailed segment map -L Specify library search paths
|
|
|
304 |
# -M Map with mangled names -j Specify object search paths
|
|
|
305 |
# -c Case sensitive link -v Full symbolic debug information
|
|
|
306 |
# -Enn Max number of errors -n No default libraries
|
|
|
307 |
# -P- Disable code packing -H:xxxx Specify app heap reserve size
|
|
|
308 |
# -B:xxxx Specify image base addr -Hc:xxxx Specify app heap commit size
|
|
|
309 |
# -wxxx Warning control -S:xxxx Specify app stack reserve size
|
|
|
310 |
# -Txx Specify output file type -Sc:xxxx Specify app stack commit size
|
|
|
311 |
# -Tpx PE image -Af:nnnn Specify file alignment
|
|
|
312 |
# (x: e=EXE, d=DLL) -Ao:nnnn Specify object alignment
|
|
|
313 |
# -ax Specify application type -o Import by ordinals
|
|
|
314 |
# -ap Windowing Compatible -Vd.d Specify Windows version
|
|
|
315 |
# -aa Uses Windowing API -r Verbose link
|
|
|
316 |
#
|
|
|
317 |
# Now the fun part... piecing together a variable $(name_ld)
|
|
|
318 |
# which ends up in the command file.
|
|
|
319 |
#
|
|
|
320 |
ld = @plink32
|
|
|
321 |
ld_cmdfile = $(subst /,\\,$(basename $@).ld)
|
|
|
322 |
ld_flags = @$(ld_cmdfile)
|
|
|
323 |
ld_o_switch =
|
|
|
324 |
ld_term = ; # ; force use of 'sh.exe'
|
|
|
325 |
|
|
|
326 |
plink_flags += -s # Detailed segment map
|
|
|
327 |
plink_flags += -n # No default libraries
|
|
|
328 |
plink_flags += -c # Case sensitive link
|
|
|
329 |
plink_flags += -Tpe # PE style
|
|
|
330 |
ifeq "$(DEBUG)" "1"
|
|
|
331 |
plink_flags += -v # Full symbolic debug information
|
|
|
332 |
endif
|
|
|
333 |
|
|
|
334 |
define ld_pre
|
| 6177 |
dpurdie |
335 |
@echo '[$@] linking..'
|
| 227 |
dpurdie |
336 |
@export PD386_LIB; \
|
|
|
337 |
PD386_LIB="$(subst $(space),;,$(LIBDIRS))"; \
|
|
|
338 |
$(cmdfile) -ko$(ld_cmdfile) "\
|
|
|
339 |
$(patsubst %,% +\\n,$(plink_flags)) \
|
|
|
340 |
$($(notdir $(basename $@))_ld)"
|
|
|
341 |
endef
|
|
|
342 |
|
|
|
343 |
ifndef LEAVETMP
|
|
|
344 |
define ld_post
|
|
|
345 |
@$(rm) -f $(ld_cmdfile)
|
|
|
346 |
endef
|
|
|
347 |
else
|
|
|
348 |
define ld_post
|
|
|
349 |
endef
|
|
|
350 |
endif
|
|
|
351 |
|
|
|
352 |
define LDDEPEND
|
|
|
353 |
@export PD386_LIB; \
|
|
|
354 |
PD386_LIB="$(subst $(space),;,$(LIBDIRS))"; \
|
|
|
355 |
$(cmdfile) -ko$(BINDIR)/$(notdir $(basename $@)).dep \
|
|
|
356 |
"$($(notdir $(basename $@))_dp)"
|
|
|
357 |
endef
|
|
|
358 |
|
|
|
359 |
#.. Locate (LD2 - Linker 2nd phase)
|
|
|
360 |
#
|
|
|
361 |
# Usage: LOCATE32 [Options] Application [ConfigFile...]
|
|
|
362 |
#
|
|
|
363 |
# As the locate32 command line interface is limited to
|
|
|
364 |
# explicit arguments without '@' command file support and
|
|
|
365 |
# to allow the section configuration file to be resolved
|
|
|
366 |
# a link time, we must locate the config file during the
|
|
|
367 |
# ld2_pre stage.
|
|
|
368 |
#..
|
|
|
369 |
ld2 = locate32
|
|
|
370 |
ld2_config = $(basename $@).cfg
|
|
|
371 |
ld2_flags = $(LOCATEOPT)
|
|
|
372 |
ld2_term = ; # ; force use of 'sh.exe'
|
|
|
373 |
|
|
|
374 |
define ld2_pre
|
| 6177 |
dpurdie |
375 |
@echo '[$@] locating..'
|
| 227 |
dpurdie |
376 |
@export LOCATE32_CFG; \
|
|
|
377 |
LOCATE32_CFG="$(subst $(space),;,.;$(INCDIRS))"; \
|
|
|
378 |
$(cmdfile) -ko$(ld2_config) \
|
|
|
379 |
"@(vpath2,$(LOCATECFG),LOCATE32_CFG)\\n"
|
|
|
380 |
endef
|
|
|
381 |
|
|
|
382 |
ifndef LEAVETMP
|
|
|
383 |
define ld2_post
|
|
|
384 |
@$(rm) -f $(ld2_config)
|
|
|
385 |
endef
|
|
|
386 |
else
|
|
|
387 |
define ld2_post
|
|
|
388 |
endef
|
|
|
389 |
endif
|
|
|
390 |
|
|
|
391 |
define LD2
|
|
|
392 |
@$(show_environment)
|
|
|
393 |
$(ld2_pre)
|
|
|
394 |
$(ld2) $(ld2_flags) $< `cat $(ld2_config)` $(ld2_term)
|
|
|
395 |
$(ld2_post)
|
|
|
396 |
endef
|
|
|
397 |
|
|
|
398 |
#
|