1 #############################################################################
3 # SciTech Multi-platform Graphics Library
5 # ========================================================================
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
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.
17 # The Original Code is Copyright (C) 1991-1998 SciTech Software, Inc.
19 # The Initial Developer of the Original Code is SciTech Software, Inc.
20 # All Rights Reserved.
22 # ========================================================================
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
30 #############################################################################
32 # Take out PMLIB if we don't need to link with it
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!
43 # Not necessary for QNX code.
46 LDFLAGS += OP STACK=$(STKSIZE)
48 LDFLAGS += OP STACK=204800
52 # Turn on runtime type information as necessary
57 # Optionally turn on pre-compiled headers
63 # Whether to link in real VBIOS library, or just the stub library
65 VBIOSLIB := vbios.lib,
67 VBIOSLIB := vbstubs.lib,
69 # Require special privledges for Nucleus programs (requires root access)
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,/,\)
80 %$O: %.c ; $(CC) @$(mktmp $(CFLAGS:s/\/\\)) $(<:s,/,\)
81 %$O: %$P ; $(CPP) @$(mktmp $(CPFLAGS:s/\/\\) $(CFLAGS:s/\/\\)) $(<:s,/,\)
84 %$O: %$A ; $(AS) @$(mktmp -o $@ $(ASFLAGS:s/\/\\)) $(<:s,/,\)
86 %$O: %$A ; $(AS) @$(mktmp $(ASFLAGS:s/\/\\)) $(<:s,/,\)
89 # Implit rule to compile .S assembler files. The first version
90 # uses GAS directly and the second uses a pre-processor to
94 .IF $(WC_LIBBASE) == WC11
95 %$O: %$S ; $(GAS) -c @$(mktmp $(GAS_FLAGS:s/\/\\)) $(<:s,/,\)
97 # Black magic to build asm sources with Watcom 10.6 (requires sed)
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)
109 @gcpp -DNASM_ASSEMBLER -D__WATCOMC__ -EP $(<:s,/,\) > $(*:s,/,\).asm
110 nasm @$(mktmp -f obj -o $@) $(*:s,/,\).asm
111 @$(RM) -S $(mktmp $(*:s,/,\).asm)
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
118 # Implicit rule for building resource files
119 %$R: %.rc ; $(RC) $(RCFLAGS) -r $<
121 # Implicit rule for building a DLL using a response file
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)
130 @$(RM) -S $(mktmp *.lnk)
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)
138 @$(RM) -S $(mktmp *.lnk)
142 @trimlib $(mktmp $(LDFLAGS) OP quiet SYS win386\nN $*.rex\nF $(&:t",\n":s/\/\\)\nLIBR $(EXELIBS:t",")) $*.lnk
143 rclink $(LD) $(RC) $@ $*.lnk
145 .IF $(LEAVE_LINKFILE)
147 @$(RM) -S $(mktmp *.lnk)
152 # Implicit rule for building a library file using response file
156 $(ILIB) $(ILIBFLAGS) $@ +$?
160 $(ILIB) $(ILIBFLAGS) $@ +$?
164 $(LIB) $(LIBFLAGS) $@ @$(mktmp,$*.rsp +$(&:t"\n+":s/\/\\)\n)
167 # Implicit rule for building an executable file using response file
170 @trimlib $(mktmp OP quiet\nN $@\nF $(&:t",":s/\/\\)\nLIBR $(PMLIB)$(EXELIBS:t",")) $*.lnk
171 $(LD) $(LDFLAGS) @$*.lnk
173 .IF $(LEAVE_LINKFILE)
175 @$(RM) -S $(mktmp *.lnk)
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)
184 @$(RM) -S $(mktmp *.lnk)
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)
195 @$(RM) -S $(mktmp *.lnk)
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)
207 @$(RM) -S $(mktmp *.lnk)
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)
216 @$(RM) -S $(mktmp *.lnk)
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)
224 @$(RM) -S $(mktmp *.lnk)
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)
233 @$(RM) -S $(mktmp *.lnk)
237 @trimlib $(mktmp $(LDFLAGS) OP quiet\nN $@\nF $(&:t",":s/\/\\)\nLIBR dosx32.lib,tntapi.lib,$(PMLIB)$(EXELIBS:t",")) $*.lnk
239 .IF $(LEAVE_LINKFILE)
241 @$(RM) -S $(mktmp *.lnk)
248 @trimlib $(mktmp $(LDFLAGS) OP quiet\nN $@\nF $(&:t",":s/\/\\)\nLIBR $(PMLIB)$(VBIOSLIB)$(EXELIBS:t",")) $*.lnk
249 @+if exist $*.exe attrib -s $*.exe > NUL
252 .IF $(LEAVE_LINKFILE)
254 @$(RM) -S $(mktmp *.lnk)
258 @trimlib $(mktmp $(LDFLAGS) OP quiet\nN $@\nF $(&:t",":s/\/\\)\nLIBR $(PMLIB)$(EXELIBS:t",")) $*.lnk
260 .IF $(LEAVE_LINKFILE)
262 @$(RM) -S $(mktmp *.lnk)