1 ######################################################################
3 # Open Watcom 1.5 multiplatform target makefile. This file is called
6 # Author : Michael Greene, July 2006
8 # User selectable project options are set in buildopts.inc
10 ######################################################################
12 # include options set by main makefile
15 # include user selectable option
16 !include buildopts.inc
20 RELDIR = $(PROJ)\release
21 DEBDIR = $(PROJ)\debug
22 SRCDIR = $(PROJ)\..\lib
23 TSTDIR = $(PROJ)\..\tests
24 XMLDIR = $(PROJ)\..\xmlwf
31 ########################################
33 # ***** platform specific options *****
35 !ifeqi SYSPLATFORM os2
39 COMINC = $(%watcom)\h;$(%watcom)\h\os2
42 !else ifeqi SYSPLATFORM nt
46 COMINC = $(%watcom)\h;$(%watcom)\h\nt
49 NTLIB = LIB $(%watcom)\lib386\nt\kernel32.lib
50 !else ifeqi SYSPLATFORM linux
53 COMINC = $(%watcom)\lh
57 # ***** END platform specific options *****
60 ########################################
62 # ***** Release/Debug options *****
66 # -wcd to quiet warning 201 - might need to check
67 C_COMMON = -d0 -wcd=201
71 LD_OPTS = d all op map,symf
72 C_COMMON = $(DEBUGOPTS) -of
73 # overrides optimization options set in buildopts.inc
77 # ***** END Release/Debug options *****
80 # MULTITHREAD set in buildopts.inc
85 # CLIBLNK set in buildopts.inc
90 INCLUDE = $(SRCDIR);$(TSTDIR);$(COMINC)
92 EXTRA_C = $(C_COMMON) $(OPT) $(MT) $(CLIBOPT) $(MACHINE)
93 COMMONC = -w4 -e25 -zq -bt=$(SYSCOMP) -mf
95 CFLAGS = -i=$(INCLUDE) $(DEFS) $(COMMONC) $(EXTRA_C)
96 LDFLAGS = $(LD_OPTS) op maxe=25
97 LIBFLAGS = -b -c -n -p=512
99 SRCS = $(SRCDIR)\xmlparse.c $(SRCDIR)\xmlrole.c $(SRCDIR)\xmltok.c
100 OBJS = xmlparse.obj xmlrole.obj xmltok.obj
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
106 TESTSRC = ..\tests\chardata.c ..\tests\minicheck.c ..\tests\runtests.c
107 TESTOBJ = chardata.obj minicheck.obj runtests.obj
110 #############################################################
112 # ***** Project target build procedures *****
114 #############################################################
116 all: clean $(EXPATDLL) $(TARGLIB) xmlwf$(EXT) tests release .SYMBOLIC
118 # dll is built only for OS/2-ECS and LINUX platforms
121 $(CC) -c $(CFLAGS) -bd $(SRCS)
122 !ifeqi SYSPLATFORM os2
123 $(LD) NAME $* @expat.lnk $(LDFLAGS) FILE {$(OBJS)}
125 $(LD) NAME $* @wexpat.lnk $(LDFLAGS) FILE {$(OBJS)}
127 $(LB) $(IMPORTLIB) +$*.dll
129 # build static lib for platform
131 $(CC) -c $(CFLAGS) $(CLIBOPT) $(SRCS)
132 $(LB) $(LIBFLAGS) $*.lib $(OBJS)
134 # build standalone XML parser
136 $(CC) -c $(CFLAGS) $(CLIBOPT) $(XMLWFS)
137 $(LD) NAME $* SYS $(SYSLINK) $(LDFLAGS) $(LINUXEXT) LIB $(TARGLIB) $(NTLIB) FILE {$(XMLWFO)}
139 # The following builds EXPAT test and example programs
140 tests: runtests$(EXT) elements$(EXT) outline$(EXT) benchmark$(EXT) .SYMBOLIC
142 runtests$(EXT): $(LINKLIB)
143 $(CC) -c $(CFLAGS) $(CLIBOPT) $(TESTSRC)
144 $(LD) NAME $* SYS $(SYSLINK) $(LDFLAGS) $(LINUXEXT) LIB $(TARGLIB) FILE {$(TESTOBJ)}
146 elements$(EXT): $(LINKLIB)
147 $(CC) -c $(CFLAGS) $(CLIBOPT) ..\examples\elements.c
148 $(LD) NAME $* SYS $(SYSLINK) $(LDFLAGS) $(LINUXEXT) LIB $(TARGLIB) FILE $*.obj
150 outline$(EXT): $(LINKLIB)
151 $(CC) -c $(CFLAGS) $(CLIBOPT) ..\examples\outline.c
152 $(LD) NAME $* SYS $(SYSLINK) $(LDFLAGS) $(LINUXEXT) LIB $(TARGLIB) FILE $*.obj
154 benchmark$(EXT): $(LINKLIB)
155 $(CC) -c $(CFLAGS) $(CLIBOPT) ..\tests\benchmark\benchmark.c
156 $(LD) NAME $* SYS $(SYSLINK) $(LDFLAGS) $(LINUXEXT) LIB $(TARGLIB) FILE $*.obj
158 # requires wget to download and unzip XML_TEST_SUITE
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
165 #############################################################
167 # ***** Project make release directories procedures *****
169 #############################################################
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
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
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
192 #############################################################
194 # ***** Project clean procedures *****
196 #############################################################
198 # cleanup build files
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*
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
219 @if EXIST xmlts.zip -@rm xmlts.zip
220 @echo Clean complete.