Remove support for libpcre, we use GRegex in GLib.
[metze/wireshark/wip.git] / epan / Makefile.nmake
1 ## Makefile for building wireshark.exe with Microsoft C and nmake
2 ## Use: $(MAKE) /$(MAKEFLAGS) -f makefile.nmake
3 #
4 # $Id$
5
6 include ..\config.nmake
7 include <win32.mak>
8 include ..\Makefile.nmake.inc
9
10 include Makefile.common
11
12 LINK= link
13
14 # We use GENERATED_CFLAGS to get around flex's non-LLP64-compliant output
15 GENERATED_CFLAGS=\
16         $(STANDARD_CFLAGS) \
17         /I. /I.. /I../wiretap $(GLIB_CFLAGS) \
18         $(ZLIB_CFLAGS) $(C_ARES_CFLAGS) $(ADNS_CFLAGS) \
19         $(LUA_CFLAGS) $(GNUTLS_CFLAGS) /I$(PCAP_DIR)\include \
20         $(PYTHON_CFLAGS) $(SMI_CFLAGS) $(GEOIP_CFLAGS)
21
22 CFLAGS=$(WARNINGS_ARE_ERRORS) $(GENERATED_CFLAGS)
23
24 !IFDEF LUA_DIR
25 WSLUA_LIB=wslua\wslua.lib
26 WSLUA_DIR=wslua
27 !ELSE
28 WSLUA_LIB=
29 WSLUA_DIR=
30 !ENDIf
31
32 !IFDEF PYTHON_DIR
33 WSPYTHON_LIB=wspython\wspython.lib
34 WSPYTHON_DIR=wspython
35 !ELSE
36 WSPYTHON_LIB=
37 WSPYTHON_DIR=
38 !ENDIf
39
40 # For use when making libwireshark.dll
41 libwireshark_LIBS = \
42         $(GLIB_LIBS)    \
43         $(C_ARES_LIBS) \
44         $(ADNS_LIBS) \
45         $(KFW_LIBS) \
46         $(NETTLE_LIBS) \
47         $(ZLIB_LIBS) \
48         $(GNUTLS_LIBS) \
49         $(LUA_LIBS) \
50         $(PYTHON_LIBS) \
51         $(SMI_LIBS) \
52         $(GEOIP_LIBS) \
53         ..\wsutil\libwsutil.lib \
54         ..\wiretap\wiretap-$(WTAP_VERSION).lib \
55         crc\crc.lib \
56         crypt\airpdcap.lib \
57         ftypes\ftypes.lib \
58         dfilter\dfilter.lib \
59         $(WSLUA_LIB) \
60         $(WSPYTHON_LIB) \
61         dissectors\dissectors.lib
62
63 .c.obj::
64         $(CC) $(CVARSDLL) $(CFLAGS) -Fd.\ -c $<
65
66 LIBWIRESHARK_OBJECTS = $(LIBWIRESHARK_ALL_SRC:.c=.obj)
67
68 EXTRA_OBJECTS = \
69 !IF defined(NASM) && "$(WIRESHARK_TARGET_PLATFORM)" == "win32"
70         asm_utils_win32_x86.obj
71 !ELSE
72         asm_utils.obj
73 !ENDIF
74
75 !IFDEF DOXYGEN
76 DOXYGEN_DEP=doxygen
77 !ENDIF
78
79 !IFDEF ENABLE_LIBWIRESHARK
80 all: crc crypt ftypes dfilter $(WSLUA_DIR) $(WSPYTHON_DIR) dissectors libwireshark.dll
81 !ELSE
82 all: crc crypt ftypes dfilter $(WSLUA_DIR) $(WSPYTHON_DIR) dissectors libwireshark.lib
83 !ENDIF
84
85 # For use when making libwireshark.dll
86 libwireshark.lib: libwireshark.dll
87 libwireshark.exp: libwireshark.dll
88
89 libwireshark.dll: ..\config.h $(LIBWIRESHARK_OBJECTS) libwireshark.def crc crypt ftypes dfilter $(WSLUA_DIR) $(WSPYTHON_DIR) dissectors $(DOXYGEN_DEP) $(EXTRA_OBJECTS) \
90                  crc\crc.lib crypt\airpdcap.lib ftypes\ftypes.lib dfilter\dfilter.lib dissectors\dissectors.lib $(WSLUA_LIB) $(WSPYTHON_LIB) ..\image\libwireshark.res
91         @echo Linking libwireshark.dll
92         $(link) $(dlllflags) $(conlibsdll) shell32.lib \
93                 $(LOCAL_LDFLAGS) $(DLL_LDFLAGS) \
94                 /DEF:libwireshark.def /OUT:libwireshark.dll \
95                 /IMPLIB:libwireshark.lib $(LIBWIRESHARK_OBJECTS) \
96                 $(libwireshark_LIBS) ..\image\libwireshark.res \
97                 dissectors\register.obj \
98                 $(EXTRA_OBJECTS)
99
100 libwireshark.lib        : ..\config.h $(LIBWIRESHARK_OBJECTS) crc crypt ftypes dfilter $(WSLUA_DIR) $(WSPYTHON_DIR) dissectors $(DOXYGEN_DEP) $(EXTRA_OBJECTS) \
101                   crc\crc.lib crypt\airpdcap.lib ftypes\ftypes.lib dfilter\dfilter.lib $(WSLUA_LIB) $(WSPYTHON_LIB) dissectors\dissectors.lib
102         link /lib /out:libwireshark.lib $(LIBWIRESHARK_OBJECTS) \
103                 $(EXTRA_OBJECTS)
104
105 ..\config.h     : ..\config.h.win32 ..\config.nmake
106         cd ..
107         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake config.h
108         cd epan
109
110 clean-local:
111         rm -f $(LIBWIRESHARK_OBJECTS) $(EXTRA_OBJECTS) \
112                 libwireshark.lib libwireshark.dll *.manifest libwireshark.exp \
113                 *.pdb doxygen.cfg html/*.* \
114                 exntest.obj exntest.exe reassemble_test.obj reassemble_test.exe tvbtest.obj tvbtest.exe
115         if exist html rm -rf html
116
117 clean:  clean-local
118         cd crc
119         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
120         cd ../crypt
121         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
122         cd ../ftypes
123         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
124         cd ../dfilter
125         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
126         cd ../dissectors
127         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
128         cd ../wslua
129         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
130         cd ../wspython
131         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
132         cd ..
133
134 #
135 # We remove the Flex-generated files with "distclean" because they need
136 # different #includes for UN*X and Windows (UN*X versions of Flex make it
137 # include <unistd.h>, but that's a UN*X-only header), so if you're going
138 # to build from source, you need to build those scanners from the
139 # corresponding ".l" files with Flex.
140 # This might not be necessary for "dtd_grammar.{c,h}", but we handle them
141 # the same for now.
142 #
143 distclean-local: clean-local
144         rm -f config.h register.c mkstemp.c \
145                 $(LIBWIRESHARK_DISTCLEAN_GENERATED_SRC) \
146                 $(LIBWIRESHARK_DISTCLEAN_GENERATED_INCLUDES) \
147                 $(LIBWIRESHARK_NODISTCLEAN_GENERATED_SRC) \
148                 $(LIBWIRESHARK_NODISTCLEAN_GENERATED_INCLUDES) \
149                 dtd_grammar.out sminmpec.c
150
151 distclean: distclean-local
152         cd crc
153         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
154         cd ../crypt
155         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
156         cd ../ftypes
157         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
158         cd ../dfilter
159         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
160         cd ../dissectors
161         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
162         cd ../wslua
163         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
164         cd ../wspython
165         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
166         cd ..
167
168 maintainer-clean-local: distclean-local
169
170 maintainer-clean: maintainer-clean-local
171         cd crc
172         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
173         cd ../crypt
174         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
175         cd ../ftypes
176         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
177         cd ../dfilter
178         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
179         cd ../dissectors
180         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
181         cd ../wslua
182         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
183         cd ../wspython
184         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
185         cd ..
186
187 crc:: ..\config.h
188         cd crc
189         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
190         cd ..
191
192 crypt:: ..\config.h
193         cd crypt
194         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
195         cd ..
196
197 ftypes:: ..\config.h
198         cd ftypes
199         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
200         cd ..
201
202 dfilter:: ..\config.h
203         cd dfilter
204         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
205         cd ..
206
207 dissectors:: ..\config.h
208         cd dissectors
209         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
210         cd ..
211
212 wslua:: ..\config.h
213         cd wslua
214         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
215         cd ..
216
217 wspython:: ..\config.h
218         cd wspython
219         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
220         cd ..
221
222 doxygen.cfg: ..\config.nmake doxygen.cfg.in
223         sed -e s/@VERSION@/$(VERSION)/ \
224             < doxygen.cfg.in > $@
225
226 doxygen-run:
227 !IFDEF DOXYGEN
228         $(DOXYGEN) doxygen.cfg
229 !ENDIF
230
231 doxygen: doxygen.cfg doxygen-run
232
233 # Rules for making unit tests
234 exntest: exntest.exe
235 reassemble_test: reassemble_test.exe
236 tvbtest: tvbtest.exe
237
238 # Object files for exntest
239 EXNTEST_OBJ=exntest.obj except.obj
240
241 exntest.exe: $(EXNTEST_OBJ)
242         @echo Linking $@
243         $(LINK) /OUT:$@ $(conflags) $(conlibsdll) $(LOCAL_LDFLAGS) /LARGEADDRESSAWARE /SUBSYSTEM:console \
244                 $(GLIB_LIBS) $(EXNTEST_OBJ)
245 !IFDEF MANIFEST_INFO_REQUIRED
246         mt.exe -nologo -manifest "$@.manifest" -outputresource:$@;1
247 !ENDIF
248
249 # Object files for tvbtest
250 TVBTEST_OBJ=tvbtest.obj \
251         tvbuff.obj \
252         except.obj \
253         to_str.obj \
254         strutil.obj \
255         charsets.obj \
256         emem.obj
257
258 tvbtest.exe: $(TVBTEST_OBJ)
259         @echo Linking $@
260         $(LINK) /OUT:$@ $(conflags) $(conlibsdll) $(LOCAL_LDFLAGS) /LARGEADDRESSAWARE /SUBSYSTEM:console \
261                 $(GLIB_LIBS) $(ZLIB_LIBS) $(TVBTEST_OBJ)
262 !IFDEF MANIFEST_INFO_REQUIRED
263         mt.exe -nologo -manifest "$@.manifest" -outputresource:$@;1
264 !ENDIF
265
266 # Object files for reassemble_test
267 REASSEMBLE_TEST_OBJ=reassemble_test.obj \
268         tvbuff.obj \
269         except.obj \
270         to_str.obj \
271         strutil.obj \
272         charsets.obj \
273         emem.obj \
274         reassemble.obj
275
276 reassemble_test.exe: $(REASSEMBLE_TEST_OBJ)
277         @echo Linking $@
278         $(LINK) /OUT:$@ $(conflags) $(conlibsdll) $(LOCAL_LDFLAGS) /LARGEADDRESSAWARE /SUBSYSTEM:console \
279                 $(GLIB_LIBS) $(ZLIB_LIBS) $(REASSEMBLE_TEST_OBJ)
280 !IFDEF MANIFEST_INFO_REQUIRED
281         mt.exe -nologo -manifest "$@.manifest" -outputresource:$@;1
282 !ENDIF
283
284 exntest_install:
285         set copycmd=/y
286         if exist exntest.exe          xcopy exntest.exe          $(INSTALL_DIR) /d
287
288 tvbtest_install:
289         set copycmd=/y
290         if exist tvbtest.exe          xcopy tvbtest.exe          $(INSTALL_DIR) /d
291
292 reassemble_test_install:
293         set copycmd=/y
294         if exist reassemble_test.exe          xcopy reassemble_test.exe          $(INSTALL_DIR) /d
295
296
297 #
298 # Compile some time critical code from assembler if NASM available
299 #
300 !IFDEF NASM
301 asm_utils_win32_x86.obj: asm_utils_win32_x86.asm
302         $(NASM) -f $(WIRESHARK_TARGET_PLATFORM) -o $@ $?
303 !ENDIF
304
305 sminmpec.c: enterprise-numbers ..\tools\make-sminmpec.pl
306         $(PERL) ../tools/make-sminmpec.pl enterprise-numbers sminmpec.c
307
308 RUNLEX=..\tools\runlex.sh
309
310 diam_dict_lex.h: diam_dict.c
311 diam_dict.obj : diam_dict.c
312         $(CC) $(CVARSDLL) $(GENERATED_CFLAGS) -Fd.\ -c $?
313
314 dtd_parse_lex.h: dtd_parse.c
315 dtd_parse.obj : dtd_parse.c
316         $(CC) $(CVARSDLL) $(GENERATED_CFLAGS) -Fd.\ -c $?
317
318 dtd_preparse_lex.h: dtd_preparse.c
319 dtd_preparse.obj : dtd_preparse.c
320         $(CC) $(CVARSDLL) $(GENERATED_CFLAGS) -Fd.\ -c $?
321
322 radius_dict_lex.h: radius_dict.c
323 radius_dict.obj : radius_dict.c
324         $(CC) $(CVARSDLL) $(GENERATED_CFLAGS) -Fd.\ -c $?
325
326 uat_load_lex.h: uat_load.c
327 uat_load.obj : uat_load.c
328         $(CC) $(CVARSDLL) $(GENERATED_CFLAGS) -Fd.\ -c $?
329
330 LEMON=..\tools\lemon
331
332 dtd_grammar.h: dtd_grammar.c
333 dtd_grammar.c: $(LEMON)\lemon.exe $(LEMON)\lempar.c dtd_grammar.lemon
334         $(LEMON)\lemon t=$(LEMON)\lempar.c dtd_grammar.lemon
335
336 checkapi:
337         $(PERL) ../tools/checkAPIs.pl -g termoutput $(LIBWIRESHARK_SRC)