summaryrefslogtreecommitdiffstats
path: root/board/MAI/bios_emulator/scitech/makedefs/rules/wc32.mk
blob: 39b8819b2b70fe48d63d2485eee6a752b2aa537b (plain)
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
#############################################################################
#
#					SciTech Multi-platform Graphics Library
#
#  ========================================================================
#
#    The contents of this file are subject to the SciTech MGL Public
#    License Version 1.0 (the "License"); you may not use this file
#    except in compliance with the License. You may obtain a copy of
#    the License at http://www.scitechsoft.com/mgl-license.txt
#
#    Software distributed under the License is distributed on an
#    "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
#    implied. See the License for the specific language governing
#    rights and limitations under the License.
#
#    The Original Code is Copyright (C) 1991-1998 SciTech Software, Inc.
#
#    The Initial Developer of the Original Code is SciTech Software, Inc.
#    All Rights Reserved.
#
#  ========================================================================
#
# Descripton:   Rules makefile definitions, which define the rules used to
#				build targets. We include them here at the end of the
#				makefile so the generic project makefiles can override
#				certain things with macros (such as linking C++ programs
#				differently).
#
#############################################################################

# Take out PMLIB if we don't need to link with it

.IF $(NO_PMLIB)
PMLIB :=
.ENDIF

# Use a larger stack during linking if requested, or use a default stack
# of 200k. The usual default stack provided by Watcom C++ is *way* to small
# for real 32 bit code development. We also need a *huge* stack for OpenGL
# software rendering also!
.IF $(USE_QNX4)
    # Not necessary for QNX code.
.ELSE
.IF $(STKSIZE)
    LDFLAGS		+= OP STACK=$(STKSIZE)
.ELSE
	LDFLAGS		+= OP STACK=204800
.ENDIF
.ENDIF

# Turn on runtime type information as necessary
.IF $(USE_RTTI)
	CPFLAGS		+= -xr
.ENDIF

# Optionally turn on pre-compiled headers
.IF $(PRECOMP_HDR)
	CFLAGS		+= -fhq
.ENDIF

.IF $(USE_QNX)
# Whether to link in real VBIOS library, or just the stub library
.IF $(USE_BIOS)
VBIOSLIB := vbios.lib,
.ELSE
VBIOSLIB := vbstubs.lib,
.END
# Require special privledges for Nucleus programs (requires root access)
.IF $(USE_NUCLEUS)
LDFLAGS		+= OP PRIV=1
.ENDIF
.ENDIF

# Implicit generation rules for making object files
.IF $(WC_LIBBASE) == WC10A
%$O: %.c ; $(CC) $(CFLAGS) $(<:s,/,\)
%$O: %$P ; $(CPP) $(CFLAGS) $(<:s,/,\)
.ELSE
%$O: %.c ; $(CC) @$(mktmp $(CFLAGS:s/\/\\)) $(<:s,/,\)
%$O: %$P ; $(CPP) @$(mktmp $(CPFLAGS:s/\/\\) $(CFLAGS:s/\/\\)) $(<:s,/,\)
.ENDIF
.IF $(USE_NASM)
%$O: %$A ; $(AS) @$(mktmp -o $@ $(ASFLAGS:s/\/\\)) $(<:s,/,\)
.ELSE
%$O: %$A ; $(AS) @$(mktmp $(ASFLAGS:s/\/\\)) $(<:s,/,\)
.ENDIF

# Implit rule to compile .S assembler files. The first version
# uses GAS directly and the second uses a pre-processor to
# produce NASM code.

.IF $(USE_GAS)
.IF $(WC_LIBBASE) == WC11
%$O: %$S ; $(GAS) -c @$(mktmp $(GAS_FLAGS:s/\/\\)) $(<:s,/,\)
.ELSE
# Black magic to build asm sources with Watcom 10.6 (requires sed)
%$O: %$S ;
	$(GAS) -c @$(mktmp $(GAS_FLAGS:s/\/\\)) $(<:s,/,\)
	wdisasm \\ -a $(*:s,/,\).o > $(*:s,/,\).lst
	sed -e "s/\.text/_TEXT/; s/\.data/_DATA/; s/\.bss/_BSS/; s/\.386/\.586/; s/lar *ecx,cx/lar ecx,ecx/" $(*:s,/,\).lst > $(*:s,/,\).asm
	wasm \\ $(WFLAGS) -zq -fr=nul -fp3 -fo=$@ $(*:s,/,\).asm
	$(RM) -S $(mktmp $(*:s,/,\).o)
	$(RM) -S $(mktmp $(*:s,/,\).lst)
	$(RM) -S $(mktmp $(*:s,/,\).asm)
.ENDIF
.ELSE
%$O: %$S ;
	@gcpp -DNASM_ASSEMBLER -D__WATCOMC__ -EP $(<:s,/,\) > $(*:s,/,\).asm
	nasm @$(mktmp -f obj -o $@) $(*:s,/,\).asm
	@$(RM) -S $(mktmp $(*:s,/,\).asm)
.ENDIF

# Special target to build dllstart.asm using Borland TASM
dllstart.obj: dllstart.asm
	$(DLL_TASM) @$(mktmp /t /mx /m /D__FLAT__ /i$(SCITECH)\INCLUDE /q) $(PRIVATE)\src\common\dllstart.asm

# Implicit rule for building resource files
%$R: %.rc ; $(RC) $(RCFLAGS) -r $<

# Implicit rule for building a DLL using a response file
.IF $(IMPORT_DLL)
.ELSE
.IF $(USE_OS232)
%$D: ;
	@trimlib $(mktmp $(LDFLAGS) OP quiet SYS os2v2 dll\nN $@\nF $(&:t",\n":s/\/\\)\nLIBR $(EXELIBS:t",")) $*.lnk
	rclink $(LD) $(RC) $@ $*.lnk
.IF $(LEAVE_LINKFILE)
.ELSE
	@$(RM) -S $(mktmp *.lnk)
.ENDIF
.ELIF $(USE_WIN32)
%$D: ;
	@trimlib $(mktmp $(LDFLAGS) OP quiet SYS nt_dll\nN $@\nF $(&:t",\n":s/\/\\)\nLIBR $(PMLIB)$(DEFLIBS)$(EXELIBS:t",")) $*.lnk
	rclink $(LD) $(RC) $@ $*.lnk
.IF $(LEAVE_LINKFILE)
.ELSE
	@$(RM) -S $(mktmp *.lnk)
.ENDIF
.ELSE
%$D: ;
	@trimlib $(mktmp $(LDFLAGS) OP quiet SYS win386\nN $*.rex\nF $(&:t",\n":s/\/\\)\nLIBR $(EXELIBS:t",")) $*.lnk
	rclink $(LD) $(RC) $@ $*.lnk
	wbind $* -d -q -n
.IF $(LEAVE_LINKFILE)
.ELSE
	@$(RM) -S $(mktmp *.lnk)
.ENDIF
.ENDIF
.ENDIF

# Implicit rule for building a library file using response file
.IF $(BUILD_DLL)
%$L: ;
	@$(RM) $@
	$(ILIB) $(ILIBFLAGS) $@ +$?
.ELIF $(IMPORT_DLL)
%$L: ;
	@$(RM) $@
	$(ILIB) $(ILIBFLAGS) $@ +$?
.ELSE
%$L: ;
    @$(RM) $@
    $(LIB) $(LIBFLAGS) $@ @$(mktmp,$*.rsp +$(&:t"\n+":s/\/\\)\n)
.ENDIF

# Implicit rule for building an executable file using response file
.IF $(USE_X32)
%$E: ;
	@trimlib $(mktmp OP quiet\nN $@\nF $(&:t",":s/\/\\)\nLIBR $(PMLIB)$(EXELIBS:t",")) $*.lnk
	$(LD) $(LDFLAGS) @$*.lnk
	x32fix $@
.IF $(LEAVE_LINKFILE)
.ELSE
	@$(RM) -S $(mktmp *.lnk)
.ENDIF
.ELIF $(USE_OS232)
.IF $(USE_OS2GUI)
%$E: ;
	@trimlib $(mktmp $(LDFLAGS) OP quiet SYS os2v2_pm\nN $@\nF $(&:t",":s/\/\\)\nLIBR $(PMLIB)$(EXELIBS:t",")) $*.lnk
	rclink $(LD) $(RC) $@ $*.lnk
.IF $(LEAVE_LINKFILE)
.ELSE
	@$(RM) -S $(mktmp *.lnk)
.ENDIF
.IF $(LXLITE)
 	lxlite $@
.ENDIF
.ELSE
%$E: ;
	@trimlib $(mktmp $(LDFLAGS) OP quiet SYS os2v2\nN $@\nF $(&:t",":s/\/\\)\nLIBR $(PMLIB)$(EXELIBS:t",")) $*.lnk
	rclink $(LD) $(RC) $@ $*.lnk
.IF $(LEAVE_LINKFILE)
.ELSE
	@$(RM) -S $(mktmp *.lnk)
.ENDIF
.IF $(LXLITE)
 	lxlite $@
.ENDIF
.ENDIF
.ELIF $(USE_SNAP)
%$E: ;
	@trimlib $(mktmp $(LDFLAGS) OP quiet SYS nt\nN $@\nF $(&:t",":s/\/\\)\nLIBR $(DEFLIBS)$(EXELIBS:t",")) $*.lnk
	rclink $(LD) $(RC) $@ $*.lnk
.IF $(LEAVE_LINKFILE)
.ELSE
	@$(RM) -S $(mktmp *.lnk)
.ENDIF
.ELIF $(USE_WIN32)
.IF $(WIN32_GUI)
%$E: ;
	@trimlib $(mktmp $(LDFLAGS) OP quiet SYS win95\nN $@\nF $(&:t",":s/\/\\)\nLIBR $(PMLIB)$(DEFLIBS)$(EXELIBS:t",")) $*.lnk
	rclink $(LD) $(RC) $@ $*.lnk
.IF $(LEAVE_LINKFILE)
.ELSE
	@$(RM) -S $(mktmp *.lnk)
.ENDIF
.ELSE
%$E: ;
	@trimlib $(mktmp $(LDFLAGS) OP quiet SYS nt\nN $@\nF $(&:t",":s/\/\\)\nLIBR $(PMLIB)$(DEFLIBS)$(EXELIBS:t",")) $*.lnk
	rclink $(LD) $(RC) $@ $*.lnk
.IF $(LEAVE_LINKFILE)
.ELSE
	@$(RM) -S $(mktmp *.lnk)
.ENDIF
.ENDIF
.ELIF $(USE_WIN386)
%$E: ;
	@trimlib $(mktmp $(LDFLAGS) OP quiet SYS win386\nN $*.rex\nF $(&:t",":s/\/\\)\nLIBR $(PMLIB)$(EXELIBS:t",")) $*.lnk
	rclink $(LD) wbind $*.rex $*.lnk
.IF $(LEAVE_LINKFILE)
.ELSE
	@$(RM) -S $(mktmp *.lnk)
.ENDIF
.ELIF $(USE_TNT)
%$E: ;
	@trimlib $(mktmp $(LDFLAGS) OP quiet\nN $@\nF $(&:t",":s/\/\\)\nLIBR dosx32.lib,tntapi.lib,$(PMLIB)$(EXELIBS:t",")) $*.lnk
	$(LD) @$*.lnk
.IF $(LEAVE_LINKFILE)
.ELSE
	@$(RM) -S $(mktmp *.lnk)
.ENDIF
.IF $(DOSSTYLE)
	@markphar $@
.ENDIF
.ELIF $(USE_QNX4)
%$E: ;
	@trimlib $(mktmp $(LDFLAGS) OP quiet\nN $@\nF $(&:t",":s/\/\\)\nLIBR $(PMLIB)$(VBIOSLIB)$(EXELIBS:t",")) $*.lnk
	@+if exist $*.exe attrib -s $*.exe > NUL
	$(LD) @$*.lnk
	@attrib +s $*.exe
.IF $(LEAVE_LINKFILE)
.ELSE
	@$(RM) -S $(mktmp *.lnk)
.ENDIF
.ELSE
%$E: ;
	@trimlib $(mktmp $(LDFLAGS) OP quiet\nN $@\nF $(&:t",":s/\/\\)\nLIBR $(PMLIB)$(EXELIBS:t",")) $*.lnk
	$(LD) @$*.lnk
.IF $(LEAVE_LINKFILE)
.ELSE
	@$(RM) -S $(mktmp *.lnk)
.ENDIF
.ENDIF
OpenPOWER on IntegriCloud