Import upstream u-boot 1.1.4
[u-boot.git] / board / MAI / bios_emulator / scitech / makedefs / rules / wc32.mk
1 #############################################################################
2 #
3 #                                       SciTech Multi-platform Graphics Library
4 #
5 #  ========================================================================
6 #
7 #    The contents of this file are subject to the SciTech MGL Public
8 #    License Version 1.0 (the "License"); you may not use this file
9 #    except in compliance with the License. You may obtain a copy of
10 #    the License at http://www.scitechsoft.com/mgl-license.txt
11 #
12 #    Software distributed under the License is distributed on an
13 #    "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
14 #    implied. See the License for the specific language governing
15 #    rights and limitations under the License.
16 #
17 #    The Original Code is Copyright (C) 1991-1998 SciTech Software, Inc.
18 #
19 #    The Initial Developer of the Original Code is SciTech Software, Inc.
20 #    All Rights Reserved.
21 #
22 #  ========================================================================
23 #
24 # Descripton:   Rules makefile definitions, which define the rules used to
25 #                               build targets. We include them here at the end of the
26 #                               makefile so the generic project makefiles can override
27 #                               certain things with macros (such as linking C++ programs
28 #                               differently).
29 #
30 #############################################################################
31
32 # Take out PMLIB if we don't need to link with it
33
34 .IF $(NO_PMLIB)
35 PMLIB :=
36 .ENDIF
37
38 # Use a larger stack during linking if requested, or use a default stack
39 # of 200k. The usual default stack provided by Watcom C++ is *way* to small
40 # for real 32 bit code development. We also need a *huge* stack for OpenGL
41 # software rendering also!
42 .IF $(USE_QNX4)
43     # Not necessary for QNX code.
44 .ELSE
45 .IF $(STKSIZE)
46     LDFLAGS             += OP STACK=$(STKSIZE)
47 .ELSE
48         LDFLAGS         += OP STACK=204800
49 .ENDIF
50 .ENDIF
51
52 # Turn on runtime type information as necessary
53 .IF $(USE_RTTI)
54         CPFLAGS         += -xr
55 .ENDIF
56
57 # Optionally turn on pre-compiled headers
58 .IF $(PRECOMP_HDR)
59         CFLAGS          += -fhq
60 .ENDIF
61
62 .IF $(USE_QNX)
63 # Whether to link in real VBIOS library, or just the stub library
64 .IF $(USE_BIOS)
65 VBIOSLIB := vbios.lib,
66 .ELSE
67 VBIOSLIB := vbstubs.lib,
68 .END
69 # Require special privledges for Nucleus programs (requires root access)
70 .IF $(USE_NUCLEUS)
71 LDFLAGS         += OP PRIV=1
72 .ENDIF
73 .ENDIF
74
75 # Implicit generation rules for making object files
76 .IF $(WC_LIBBASE) == WC10A
77 %$O: %.c ; $(CC) $(CFLAGS) $(<:s,/,\)
78 %$O: %$P ; $(CPP) $(CFLAGS) $(<:s,/,\)
79 .ELSE
80 %$O: %.c ; $(CC) @$(mktmp $(CFLAGS:s/\/\\)) $(<:s,/,\)
81 %$O: %$P ; $(CPP) @$(mktmp $(CPFLAGS:s/\/\\) $(CFLAGS:s/\/\\)) $(<:s,/,\)
82 .ENDIF
83 .IF $(USE_NASM)
84 %$O: %$A ; $(AS) @$(mktmp -o $@ $(ASFLAGS:s/\/\\)) $(<:s,/,\)
85 .ELSE
86 %$O: %$A ; $(AS) @$(mktmp $(ASFLAGS:s/\/\\)) $(<:s,/,\)
87 .ENDIF
88
89 # Implit rule to compile .S assembler files. The first version
90 # uses GAS directly and the second uses a pre-processor to
91 # produce NASM code.
92
93 .IF $(USE_GAS)
94 .IF $(WC_LIBBASE) == WC11
95 %$O: %$S ; $(GAS) -c @$(mktmp $(GAS_FLAGS:s/\/\\)) $(<:s,/,\)
96 .ELSE
97 # Black magic to build asm sources with Watcom 10.6 (requires sed)
98 %$O: %$S ;
99         $(GAS) -c @$(mktmp $(GAS_FLAGS:s/\/\\)) $(<:s,/,\)
100         wdisasm \\ -a $(*:s,/,\).o > $(*:s,/,\).lst
101         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
102         wasm \\ $(WFLAGS) -zq -fr=nul -fp3 -fo=$@ $(*:s,/,\).asm
103         $(RM) -S $(mktmp $(*:s,/,\).o)
104         $(RM) -S $(mktmp $(*:s,/,\).lst)
105         $(RM) -S $(mktmp $(*:s,/,\).asm)
106 .ENDIF
107 .ELSE
108 %$O: %$S ;
109         @gcpp -DNASM_ASSEMBLER -D__WATCOMC__ -EP $(<:s,/,\) > $(*:s,/,\).asm
110         nasm @$(mktmp -f obj -o $@) $(*:s,/,\).asm
111         @$(RM) -S $(mktmp $(*:s,/,\).asm)
112 .ENDIF
113
114 # Special target to build dllstart.asm using Borland TASM
115 dllstart.obj: dllstart.asm
116         $(DLL_TASM) @$(mktmp /t /mx /m /D__FLAT__ /i$(SCITECH)\INCLUDE /q) $(PRIVATE)\src\common\dllstart.asm
117
118 # Implicit rule for building resource files
119 %$R: %.rc ; $(RC) $(RCFLAGS) -r $<
120
121 # Implicit rule for building a DLL using a response file
122 .IF $(IMPORT_DLL)
123 .ELSE
124 .IF $(USE_OS232)
125 %$D: ;
126         @trimlib $(mktmp $(LDFLAGS) OP quiet SYS os2v2 dll\nN $@\nF $(&:t",\n":s/\/\\)\nLIBR $(EXELIBS:t",")) $*.lnk
127         rclink $(LD) $(RC) $@ $*.lnk
128 .IF $(LEAVE_LINKFILE)
129 .ELSE
130         @$(RM) -S $(mktmp *.lnk)
131 .ENDIF
132 .ELIF $(USE_WIN32)
133 %$D: ;
134         @trimlib $(mktmp $(LDFLAGS) OP quiet SYS nt_dll\nN $@\nF $(&:t",\n":s/\/\\)\nLIBR $(PMLIB)$(DEFLIBS)$(EXELIBS:t",")) $*.lnk
135         rclink $(LD) $(RC) $@ $*.lnk
136 .IF $(LEAVE_LINKFILE)
137 .ELSE
138         @$(RM) -S $(mktmp *.lnk)
139 .ENDIF
140 .ELSE
141 %$D: ;
142         @trimlib $(mktmp $(LDFLAGS) OP quiet SYS win386\nN $*.rex\nF $(&:t",\n":s/\/\\)\nLIBR $(EXELIBS:t",")) $*.lnk
143         rclink $(LD) $(RC) $@ $*.lnk
144         wbind $* -d -q -n
145 .IF $(LEAVE_LINKFILE)
146 .ELSE
147         @$(RM) -S $(mktmp *.lnk)
148 .ENDIF
149 .ENDIF
150 .ENDIF
151
152 # Implicit rule for building a library file using response file
153 .IF $(BUILD_DLL)
154 %$L: ;
155         @$(RM) $@
156         $(ILIB) $(ILIBFLAGS) $@ +$?
157 .ELIF $(IMPORT_DLL)
158 %$L: ;
159         @$(RM) $@
160         $(ILIB) $(ILIBFLAGS) $@ +$?
161 .ELSE
162 %$L: ;
163     @$(RM) $@
164     $(LIB) $(LIBFLAGS) $@ @$(mktmp,$*.rsp +$(&:t"\n+":s/\/\\)\n)
165 .ENDIF
166
167 # Implicit rule for building an executable file using response file
168 .IF $(USE_X32)
169 %$E: ;
170         @trimlib $(mktmp OP quiet\nN $@\nF $(&:t",":s/\/\\)\nLIBR $(PMLIB)$(EXELIBS:t",")) $*.lnk
171         $(LD) $(LDFLAGS) @$*.lnk
172         x32fix $@
173 .IF $(LEAVE_LINKFILE)
174 .ELSE
175         @$(RM) -S $(mktmp *.lnk)
176 .ENDIF
177 .ELIF $(USE_OS232)
178 .IF $(USE_OS2GUI)
179 %$E: ;
180         @trimlib $(mktmp $(LDFLAGS) OP quiet SYS os2v2_pm\nN $@\nF $(&:t",":s/\/\\)\nLIBR $(PMLIB)$(EXELIBS:t",")) $*.lnk
181         rclink $(LD) $(RC) $@ $*.lnk
182 .IF $(LEAVE_LINKFILE)
183 .ELSE
184         @$(RM) -S $(mktmp *.lnk)
185 .ENDIF
186 .IF $(LXLITE)
187         lxlite $@
188 .ENDIF
189 .ELSE
190 %$E: ;
191         @trimlib $(mktmp $(LDFLAGS) OP quiet SYS os2v2\nN $@\nF $(&:t",":s/\/\\)\nLIBR $(PMLIB)$(EXELIBS:t",")) $*.lnk
192         rclink $(LD) $(RC) $@ $*.lnk
193 .IF $(LEAVE_LINKFILE)
194 .ELSE
195         @$(RM) -S $(mktmp *.lnk)
196 .ENDIF
197 .IF $(LXLITE)
198         lxlite $@
199 .ENDIF
200 .ENDIF
201 .ELIF $(USE_SNAP)
202 %$E: ;
203         @trimlib $(mktmp $(LDFLAGS) OP quiet SYS nt\nN $@\nF $(&:t",":s/\/\\)\nLIBR $(DEFLIBS)$(EXELIBS:t",")) $*.lnk
204         rclink $(LD) $(RC) $@ $*.lnk
205 .IF $(LEAVE_LINKFILE)
206 .ELSE
207         @$(RM) -S $(mktmp *.lnk)
208 .ENDIF
209 .ELIF $(USE_WIN32)
210 .IF $(WIN32_GUI)
211 %$E: ;
212         @trimlib $(mktmp $(LDFLAGS) OP quiet SYS win95\nN $@\nF $(&:t",":s/\/\\)\nLIBR $(PMLIB)$(DEFLIBS)$(EXELIBS:t",")) $*.lnk
213         rclink $(LD) $(RC) $@ $*.lnk
214 .IF $(LEAVE_LINKFILE)
215 .ELSE
216         @$(RM) -S $(mktmp *.lnk)
217 .ENDIF
218 .ELSE
219 %$E: ;
220         @trimlib $(mktmp $(LDFLAGS) OP quiet SYS nt\nN $@\nF $(&:t",":s/\/\\)\nLIBR $(PMLIB)$(DEFLIBS)$(EXELIBS:t",")) $*.lnk
221         rclink $(LD) $(RC) $@ $*.lnk
222 .IF $(LEAVE_LINKFILE)
223 .ELSE
224         @$(RM) -S $(mktmp *.lnk)
225 .ENDIF
226 .ENDIF
227 .ELIF $(USE_WIN386)
228 %$E: ;
229         @trimlib $(mktmp $(LDFLAGS) OP quiet SYS win386\nN $*.rex\nF $(&:t",":s/\/\\)\nLIBR $(PMLIB)$(EXELIBS:t",")) $*.lnk
230         rclink $(LD) wbind $*.rex $*.lnk
231 .IF $(LEAVE_LINKFILE)
232 .ELSE
233         @$(RM) -S $(mktmp *.lnk)
234 .ENDIF
235 .ELIF $(USE_TNT)
236 %$E: ;
237         @trimlib $(mktmp $(LDFLAGS) OP quiet\nN $@\nF $(&:t",":s/\/\\)\nLIBR dosx32.lib,tntapi.lib,$(PMLIB)$(EXELIBS:t",")) $*.lnk
238         $(LD) @$*.lnk
239 .IF $(LEAVE_LINKFILE)
240 .ELSE
241         @$(RM) -S $(mktmp *.lnk)
242 .ENDIF
243 .IF $(DOSSTYLE)
244         @markphar $@
245 .ENDIF
246 .ELIF $(USE_QNX4)
247 %$E: ;
248         @trimlib $(mktmp $(LDFLAGS) OP quiet\nN $@\nF $(&:t",":s/\/\\)\nLIBR $(PMLIB)$(VBIOSLIB)$(EXELIBS:t",")) $*.lnk
249         @+if exist $*.exe attrib -s $*.exe > NUL
250         $(LD) @$*.lnk
251         @attrib +s $*.exe
252 .IF $(LEAVE_LINKFILE)
253 .ELSE
254         @$(RM) -S $(mktmp *.lnk)
255 .ENDIF
256 .ELSE
257 %$E: ;
258         @trimlib $(mktmp $(LDFLAGS) OP quiet\nN $@\nF $(&:t",":s/\/\\)\nLIBR $(PMLIB)$(EXELIBS:t",")) $*.lnk
259         $(LD) @$*.lnk
260 .IF $(LEAVE_LINKFILE)
261 .ELSE
262         @$(RM) -S $(mktmp *.lnk)
263 .ENDIF
264 .ENDIF