]>
Commit | Line | Data |
---|---|---|
11a3e7b6 VZ |
1 | ###################################################################### |
2 | # | |
3 | # Open Watcom 1.5 multiplatform target makefile. This file is called | |
4 | # by main makefile. | |
5 | # | |
6 | # Author : Michael Greene, July 2006 | |
7 | # | |
8 | # User selectable project options are set in buildopts.inc | |
9 | # | |
10 | ###################################################################### | |
11 | ||
12 | # include options set by main makefile | |
13 | !include watopts.tmp | |
14 | ||
15 | # include user selectable option | |
16 | !include buildopts.inc | |
17 | ||
18 | # project directories | |
19 | PROJ = $+ $(%cwd) $- | |
20 | RELDIR = $(PROJ)\release | |
21 | DEBDIR = $(PROJ)\debug | |
22 | SRCDIR = $(PROJ)\..\lib | |
23 | TSTDIR = $(PROJ)\..\tests | |
24 | XMLDIR = $(PROJ)\..\xmlwf | |
25 | ||
26 | CC = wcl386 | |
27 | LD = wlink | |
28 | LB = wlib | |
29 | ||
30 | ||
31 | ######################################## | |
32 | # | |
33 | # ***** platform specific options ***** | |
34 | # | |
35 | !ifeqi SYSPLATFORM os2 | |
36 | SYSCOMP = os2 | |
37 | SYSLINK = os2v2 | |
38 | LINKFILE = expat.lnk | |
39 | COMINC = $(%watcom)\h;$(%watcom)\h\os2 | |
40 | EXPATDLL = $(DLLNAME) | |
41 | EXT = .exe | |
42 | !else ifeqi SYSPLATFORM nt | |
43 | SYSCOMP = nt | |
44 | SYSLINK = nt | |
45 | LINKFILE = wexpat.lnk | |
46 | COMINC = $(%watcom)\h;$(%watcom)\h\nt | |
47 | EXPATDLL = $(DLLNAME) | |
48 | EXT = .exe | |
49 | NTLIB = LIB $(%watcom)\lib386\nt\kernel32.lib | |
50 | !else ifeqi SYSPLATFORM linux | |
51 | SYSCOMP = linux | |
52 | SYSLINK = linux | |
53 | COMINC = $(%watcom)\lh | |
54 | LINUXEXT = op noext | |
55 | #EXT = .elf | |
56 | !endif | |
57 | # ***** END platform specific options ***** | |
58 | ||
59 | ||
60 | ######################################## | |
61 | # | |
62 | # ***** Release/Debug options ***** | |
63 | # | |
64 | !ifndef DEBUG | |
65 | LD_OPTS = op el | |
66 | # -wcd to quiet warning 201 - might need to check | |
67 | C_COMMON = -d0 -wcd=201 | |
68 | OPT = $(OPTIMIZATION) | |
69 | TARGDIR = $(RELDIR) | |
70 | !else | |
71 | LD_OPTS = d all op map,symf | |
72 | C_COMMON = $(DEBUGOPTS) -of | |
73 | # overrides optimization options set in buildopts.inc | |
74 | OPT = -od | |
75 | TARGDIR = $(DEBDIR) | |
76 | !endif | |
77 | # ***** END Release/Debug options ***** | |
78 | ||
79 | ||
80 | # MULTITHREAD set in buildopts.inc | |
81 | !ifdef MULTITHREAD | |
82 | MT = -bm | |
83 | !endif | |
84 | ||
85 | # CLIBLNK set in buildopts.inc | |
86 | !ifdef CLIBLNK | |
87 | CLIBOPT = -br | |
88 | !endif | |
89 | ||
90 | INCLUDE = $(SRCDIR);$(TSTDIR);$(COMINC) | |
91 | ||
92 | EXTRA_C = $(C_COMMON) $(OPT) $(MT) $(CLIBOPT) $(MACHINE) | |
93 | COMMONC = -w4 -e25 -zq -bt=$(SYSCOMP) -mf | |
94 | ||
95 | CFLAGS = -i=$(INCLUDE) $(DEFS) $(COMMONC) $(EXTRA_C) | |
96 | LDFLAGS = $(LD_OPTS) op maxe=25 | |
97 | LIBFLAGS = -b -c -n -p=512 | |
98 | ||
99 | SRCS = $(SRCDIR)\xmlparse.c $(SRCDIR)\xmlrole.c $(SRCDIR)\xmltok.c | |
100 | OBJS = xmlparse.obj xmlrole.obj xmltok.obj | |
101 | ||
102 | XMLWFS = $(XMLDIR)\xmlwf.c $(XMLDIR)\xmlfile.c $(XMLDIR)\codepage.c & | |
103 | $(XMLDIR)\readfilemap.c | |
104 | XMLWFO = xmlwf.obj xmlfile.obj codepage.obj readfilemap.obj | |
105 | ||
106 | TESTSRC = ..\tests\chardata.c ..\tests\minicheck.c ..\tests\runtests.c | |
107 | TESTOBJ = chardata.obj minicheck.obj runtests.obj | |
108 | ||
109 | ||
110 | ############################################################# | |
111 | # | |
112 | # ***** Project target build procedures ***** | |
113 | # | |
114 | ############################################################# | |
115 | ||
116 | all: clean $(EXPATDLL) $(TARGLIB) xmlwf$(EXT) tests release .SYMBOLIC | |
117 | ||
118 | # dll is built only for OS/2-ECS and LINUX platforms | |
119 | #expat.dll: .ALWAYS | |
120 | $(DLLNAME): .ALWAYS | |
121 | $(CC) -c $(CFLAGS) -bd $(SRCS) | |
122 | !ifeqi SYSPLATFORM os2 | |
123 | $(LD) NAME $* @expat.lnk $(LDFLAGS) FILE {$(OBJS)} | |
124 | !else | |
125 | $(LD) NAME $* @wexpat.lnk $(LDFLAGS) FILE {$(OBJS)} | |
126 | !endif | |
127 | $(LB) $(IMPORTLIB) +$*.dll | |
128 | ||
129 | # build static lib for platform | |
130 | $(TARGLIB): .ALWAYS | |
131 | $(CC) -c $(CFLAGS) $(CLIBOPT) $(SRCS) | |
132 | $(LB) $(LIBFLAGS) $*.lib $(OBJS) | |
133 | ||
134 | # build standalone XML parser | |
135 | xmlwf$(EXT): | |
136 | $(CC) -c $(CFLAGS) $(CLIBOPT) $(XMLWFS) | |
137 | $(LD) NAME $* SYS $(SYSLINK) $(LDFLAGS) $(LINUXEXT) LIB $(TARGLIB) $(NTLIB) FILE {$(XMLWFO)} | |
138 | ||
139 | # The following builds EXPAT test and example programs | |
140 | tests: runtests$(EXT) elements$(EXT) outline$(EXT) benchmark$(EXT) .SYMBOLIC | |
141 | ||
142 | runtests$(EXT): $(LINKLIB) | |
143 | $(CC) -c $(CFLAGS) $(CLIBOPT) $(TESTSRC) | |
144 | $(LD) NAME $* SYS $(SYSLINK) $(LDFLAGS) $(LINUXEXT) LIB $(TARGLIB) FILE {$(TESTOBJ)} | |
145 | ||
146 | elements$(EXT): $(LINKLIB) | |
147 | $(CC) -c $(CFLAGS) $(CLIBOPT) ..\examples\elements.c | |
148 | $(LD) NAME $* SYS $(SYSLINK) $(LDFLAGS) $(LINUXEXT) LIB $(TARGLIB) FILE $*.obj | |
149 | ||
150 | outline$(EXT): $(LINKLIB) | |
151 | $(CC) -c $(CFLAGS) $(CLIBOPT) ..\examples\outline.c | |
152 | $(LD) NAME $* SYS $(SYSLINK) $(LDFLAGS) $(LINUXEXT) LIB $(TARGLIB) FILE $*.obj | |
153 | ||
154 | benchmark$(EXT): $(LINKLIB) | |
155 | $(CC) -c $(CFLAGS) $(CLIBOPT) ..\tests\benchmark\benchmark.c | |
156 | $(LD) NAME $* SYS $(SYSLINK) $(LDFLAGS) $(LINUXEXT) LIB $(TARGLIB) FILE $*.obj | |
157 | ||
158 | # requires wget to download and unzip XML_TEST_SUITE | |
159 | xmlts.zip: .SYMBOLIC | |
160 | $(WGET)wget --output-document=..\tests\xmlts.zip & | |
161 | http://www.w3.org/XML/Test/xmlts20020606.zip | |
162 | unzip -q ..\tests\xmlts.zip -d ..\tests | |
163 | ||
164 | ||
165 | ############################################################# | |
166 | # | |
167 | # ***** Project make release directories procedures ***** | |
168 | # | |
169 | ############################################################# | |
170 | ||
171 | release: .SYMBOLIC | |
172 | TARGEXE = xmlwf$(EXT) runtests$(EXT) elements$(EXT) outline$(EXT) benchmark$(EXT) | |
173 | @if not EXIST $(TARGDIR) -@mkdir $(TARGDIR) | |
174 | @if not EXIST $(TARGDIR)\$(SYSPLATFORM) @%make mktargdir | |
175 | !ifneqi SYSPLATFORM linux | |
176 | -@copy .\$(EXPATDLL) $(TARGDIR)\$(SYSPLATFORM)\dll | |
177 | !endif | |
178 | @for %a in ($(TARGEXE)) do -@copy .\%a $(TARGDIR)\$(SYSPLATFORM)\bin | |
179 | -@copy .\*.lib $(TARGDIR)\$(SYSPLATFORM)\lib | |
180 | -@copy ..\lib\expat.h $(TARGDIR)\$(SYSPLATFORM)\include | |
181 | -@copy ..\lib\expat_external.h $(TARGDIR)\$(SYSPLATFORM)\include | |
182 | ||
183 | mktargdir: .PROCEDURE | |
184 | -@mkdir $(TARGDIR)\$(SYSPLATFORM) | |
185 | -@mkdir $(TARGDIR)\$(SYSPLATFORM)\bin | |
186 | -@mkdir $(TARGDIR)\$(SYSPLATFORM)\lib | |
187 | -@mkdir $(TARGDIR)\$(SYSPLATFORM)\include | |
188 | !ifneqi SYSPLATFORM linux | |
189 | -@mkdir $(TARGDIR)\$(SYSPLATFORM)\dll | |
190 | !endif | |
191 | ||
192 | ############################################################# | |
193 | # | |
194 | # ***** Project clean procedures ***** | |
195 | # | |
196 | ############################################################# | |
197 | ||
198 | # cleanup build files | |
199 | clean: .SYMBOLIC | |
200 | CLEANEXTS = obj exe err lst map sym lib dll | |
201 | CLEANLINUX = xmlwf runtests elements outline benchmark | |
202 | @for %a in ($(CLEANEXTS)) do -@rm *.%a | |
203 | @for %a in ($(CLEANLINUX)) do -@rm %a* | |
204 | ||
205 | cleanall: clean .SYMBOLIC | |
206 | @%write watclean.tmp RELDIR=$(RELDIR) | |
207 | @%append watclean.tmp DEBDIR=$(DEBDIR) | |
208 | @if EXIST $(RELDIR)\os2 @wmake -h -f watclean.mif os2 | |
209 | @if EXIST $(DEBDIR)\os2 @wmake -h -f watclean.mif os2d | |
210 | @if EXIST $(RELDIR)\nt @wmake -h -f watclean.mif nt | |
211 | @if EXIST $(DEBDIR)\nt @wmake -h -f watclean.mif ntd | |
212 | @if EXIST $(RELDIR)\linux @wmake -h -f watclean.mif linux | |
213 | @if EXIST $(DEBDIR)\linux @wmake -h -f watclean.mif linuxd | |
214 | @if EXIST $(RELDIR) -@rd $(RELDIR) | |
215 | @if EXIST $(DEBDIR) -@rd $(DEBDIR) | |
216 | @if EXIST watclean.tmp -@rm watclean.tmp | |
217 | @if EXIST watopts.tmp -@rm watopts.tmp | |
218 | @cd ..\tests | |
219 | @if EXIST xmlts.zip -@rm xmlts.zip | |
220 | @echo Clean complete. | |
221 | ||
222 | ||
223 |