Witness: add pidl output
[wireshark-wip.git] / epan / Makefile.nmake
blob0e214ee97912b4a31b62714948545306756ba7ee
1 ## Makefile for building wireshark.exe with Microsoft C and nmake
2 ## Use: $(MAKE) /$(MAKEFLAGS) -f makefile.nmake
4 # $Id$
6 include ..\config.nmake
7 include <win32.mak>
8 include ..\Makefile.nmake.inc
10 include Makefile.common
12 LINK= link
15 # These are the flags for all source files.
17 COMMON_CFLAGS=\
18         $(STANDARD_CFLAGS) \
19         /I. /I.. /I../wiretap $(GLIB_CFLAGS) \
20         $(ZLIB_CFLAGS) $(C_ARES_CFLAGS) $(ADNS_CFLAGS) \
21         $(LUA_CFLAGS) $(GNUTLS_CFLAGS) /I$(PCAP_DIR)\include \
22         $(PYTHON_CFLAGS) $(SMI_CFLAGS) $(GEOIP_CFLAGS)
25 # These are the flags for generated source files; we don't include
26 # $(WARNINGS_ARE_ERRORS), so that we flex's non-LLP64-compliant output
27 # doesn't cause compilation to fail.
29 GENERATED_CFLAGS=\
30         $(COMMON_CFLAGS) -DWS_BUILD_DLL
33 # These are the flags for test programs; we don't include -DWS_BUILD_DLL,
34 # as we're building test programs that link with the library, not routines
35 # incorporated into the library, so they should *import* stuff from the
36 # library, not *export* stuff from the library.
38 TEST_CFLAGS=\
39         $(WARNINGS_ARE_ERRORS) $(COMMON_CFLAGS)
42 # These are flags for everything else; we include $(WARNINGS_ARE_ERRORS),
43 # as the code should be warning-free, and we include -DWS_BUILD_DLL,
44 # as these are library routines, not test programs.
46 CFLAGS=$(WARNINGS_ARE_ERRORS) $(GENERATED_CFLAGS) -DWS_BUILD_DLL
48 !IFDEF LUA_DIR
49 WSLUA_LIB=wslua\wslua.lib
50 WSLUA_DIR=wslua
51 !ELSE
52 WSLUA_LIB=
53 WSLUA_DIR=
54 !ENDIf
56 !IFDEF PYTHON_DIR
57 WSPYTHON_LIB=wspython\wspython.lib
58 WSPYTHON_DIR=wspython
59 !ELSE
60 WSPYTHON_LIB=
61 WSPYTHON_DIR=
62 !ENDIf
64 # For use when making libwireshark.dll
65 libwireshark_LIBS = \
66         $(GLIB_LIBS)    \
67         $(C_ARES_LIBS) \
68         $(ADNS_LIBS) \
69         $(KFW_LIBS) \
70         $(NETTLE_LIBS) \
71         $(ZLIB_LIBS) \
72         $(GNUTLS_LIBS) \
73         $(LUA_LIBS) \
74         $(PYTHON_LIBS) \
75         $(SMI_LIBS) \
76         $(GEOIP_LIBS) \
77         ..\wsutil\libwsutil.lib \
78         ..\wiretap\wiretap-$(WTAP_VERSION).lib \
79         crypt\airpdcap.lib \
80         ftypes\ftypes.lib \
81         dfilter\dfilter.lib \
82         wmem\wmem.lib \
83         $(WSLUA_LIB) \
84         $(WSPYTHON_LIB) \
85         dissectors\dissectors.lib
87 .c.obj::
88         $(CC) $(CFLAGS) -Fd.\ -c $<
90 LIBWIRESHARK_OBJECTS = $(LIBWIRESHARK_ALL_SRC:.c=.obj)
92 EXTRA_OBJECTS = \
93 !IF defined(NASM) && "$(WIRESHARK_TARGET_PLATFORM)" == "win32"
94         asm_utils_win32_x86.obj
95 !ELSE
96         asm_utils.obj
97 !ENDIF
99 !IFDEF DOXYGEN
100 DOXYGEN_DEP=doxygen
101 !ENDIF
103 !IFDEF ENABLE_LIBWIRESHARK
104 all: crypt ftypes dfilter wmem $(WSLUA_DIR) $(WSPYTHON_DIR) dissectors libwireshark.dll
105 !ELSE
106 all: crypt ftypes dfilter wmem $(WSLUA_DIR) $(WSPYTHON_DIR) dissectors libwireshark.lib
107 !ENDIF
109 # For use when making libwireshark.dll
110 libwireshark.lib: libwireshark.dll
111 libwireshark.exp: libwireshark.dll
113 libwireshark.dll: ..\config.h $(LIBWIRESHARK_OBJECTS) crypt ftypes dfilter wmem $(WSLUA_DIR) $(WSPYTHON_DIR) dissectors $(DOXYGEN_DEP) $(EXTRA_OBJECTS) \
114                 crypt\airpdcap.lib ftypes\ftypes.lib dfilter\dfilter.lib wmem/wmem.lib dissectors\dissectors.lib $(WSLUA_LIB) $(WSPYTHON_LIB) ..\image\libwireshark.res
115         @echo Linking libwireshark.dll
116         $(link) $(dlllflags) $(conlibsdll) shell32.lib psapi.lib \
117                 $(LOCAL_LDFLAGS) $(DLL_LDFLAGS) \
118                 /OUT:libwireshark.dll \
119                 /IMPLIB:libwireshark.lib $(LIBWIRESHARK_OBJECTS) \
120                 $(libwireshark_LIBS) ..\image\libwireshark.res \
121                 dissectors\register.obj \
122                 $(EXTRA_OBJECTS)
124 libwireshark.lib        : ..\config.h $(LIBWIRESHARK_OBJECTS) crypt ftypes dfilter wmem $(WSLUA_DIR) $(WSPYTHON_DIR) dissectors $(DOXYGEN_DEP) $(EXTRA_OBJECTS) \
125                 crypt\airpdcap.lib ftypes\ftypes.lib dfilter\dfilter.lib wmem/wmem.lib $(WSLUA_LIB) $(WSPYTHON_LIB) dissectors\dissectors.lib
126         link /lib /out:libwireshark.lib $(LIBWIRESHARK_OBJECTS) \
127                 $(EXTRA_OBJECTS)
129 ..\config.h     : ..\config.h.win32 ..\config.nmake
130         cd ..
131         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake config.h
132         cd epan
134 clean-local:
135         rm -f $(LIBWIRESHARK_OBJECTS) $(EXTRA_OBJECTS) \
136                 libwireshark.lib libwireshark.dll *.manifest libwireshark.exp \
137                 *.pdb *.sbr doxygen.cfg html/*.* \
138                 exntest.obj exntest.exe exntest.exp reassemble_test.obj reassemble_test.exe tvbtest.obj tvbtest.exe tvbtest.exp oids_test.obj oids_test.exe oids_test.exp
139         if exist html rm -rf html
141 clean:  clean-local
142         cd crypt
143         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
144         cd ../ftypes
145         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
146         cd ../dfilter
147         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
148         cd ../dissectors
149         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
150         cd ../wmem
151         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
152         cd ../wslua
153         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
154         cd ../wspython
155         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
156         cd ..
159 # We remove the Flex-generated files with "distclean" because they need
160 # different #includes for UN*X and Windows (UN*X versions of Flex make it
161 # include <unistd.h>, but that's a UN*X-only header), so if you're going
162 # to build from source, you need to build those scanners from the
163 # corresponding ".l" files with Flex.
164 # This might not be necessary for "dtd_grammar.{c,h}", but we handle them
165 # the same for now.
167 distclean-local: clean-local
168         rm -f config.h register.c mkstemp.c \
169                 $(NODIST_LIBWIRESHARK_GENERATED_C_FILES) \
170                 $(NODIST_LIBWIRESHARK_GENERATED_HEADER_FILES) \
171                 $(LIBWIRESHARK_GENERATED_C_FILES) \
172                 $(LIBWIRESHARK_GENERATED_HEADER_FILES) \
173                 dtd_grammar.out sminmpec.c
175 distclean: distclean-local
176         cd crypt
177         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
178         cd ../ftypes
179         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
180         cd ../dfilter
181         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
182         cd ../dissectors
183         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
184         cd ../wmem
185         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
186         cd ../wslua
187         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
188         cd ../wspython
189         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
190         cd ..
192 maintainer-clean-local: distclean-local
194 maintainer-clean: maintainer-clean-local
195         cd crypt
196         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
197         cd ../ftypes
198         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
199         cd ../dfilter
200         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
201         cd ../dissectors
202         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
203         cd ../wmem
204         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
205         cd ../wslua
206         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
207         cd ../wspython
208         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
209         cd ..
211 crypt:: ..\config.h
212         cd crypt
213         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
214         cd ..
216 ftypes:: ..\config.h
217         cd ftypes
218         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
219         cd ..
221 dfilter:: ..\config.h
222         cd dfilter
223         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
224         cd ..
226 dissectors:: ..\config.h
227         cd dissectors
228         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
229         cd ..
231 wmem:: ..\config.h
232         cd wmem
233         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
234         cd ..
236 wslua:: ..\config.h
237         cd wslua
238         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
239         cd ..
241 wspython:: ..\config.h
242         cd wspython
243         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
244         cd ..
246 doxygen.cfg: ..\config.nmake doxygen.cfg.in
247         sed -e s/@VERSION@/$(VERSION)/ \
248             < doxygen.cfg.in > $@
250 doxygen-run:
251 !IFDEF DOXYGEN
252         $(DOXYGEN) doxygen.cfg
253 !ENDIF
255 doxygen: doxygen.cfg doxygen-run
257 # Rules for making unit tests
258 exntest: exntest.exe
259 reassemble_test: reassemble_test.exe
260 tvbtest: tvbtest.exe
261 oids_test: oids_test.exe
263 # Object files for exntest
264 EXNTEST_OBJ=exntest.obj except.obj
266 exntest.exe: $(EXNTEST_OBJ)
267         @echo Linking $@
268         $(LINK) /OUT:$@ $(conflags) $(conlibsdll) $(LOCAL_LDFLAGS) /LARGEADDRESSAWARE /SUBSYSTEM:console \
269                 $(GLIB_LIBS) $(EXNTEST_OBJ)
270 !IFDEF MANIFEST_INFO_REQUIRED
271         mt.exe -nologo -manifest "$@.manifest" -outputresource:$@;1
272 !ENDIF
274 # Object files for tvbtest
275 TVBTEST_OBJ=tvbtest.obj
276 TVBTEST_LIBS= ..\wiretap\wiretap-$(WTAP_VERSION).lib \
277         wsock32.lib user32.lib \
278         $(GLIB_LIBS) \
279         ..\wsutil\libwsutil.lib \
280         $(GNUTLS_LIBS) \
281         $(PYTHON_LIBS) \
282 !IFDEF ENABLE_LIBWIRESHARK
283         libwireshark.lib \
284 !ELSE
285         dissectors\dissectors.lib \
286         wireshark.lib \
287         crypt\airpdcap.lib \
288         dfilter\dfilter.lib \
289         ftypes\ftypes.lib \
290         $(C_ARES_LIBS) \
291         $(ADNS_LIBS) \
292         $(ZLIB_LIBS)
293 !ENDIF
295 tvbtest.exe: $(TVBTEST_OBJ)
296         @echo Linking $@
297         $(LINK) /OUT:$@ $(conflags) $(conlibsdll) $(LOCAL_LDFLAGS) /LARGEADDRESSAWARE /SUBSYSTEM:console \
298                 $(TVBTEST_LIBS) $(GLIB_LIBS) $(ZLIB_LIBS) $(TVBTEST_OBJ)
299 !IFDEF MANIFEST_INFO_REQUIRED
300         mt.exe -nologo -manifest "$@.manifest" -outputresource:$@;1
301 !ENDIF
303 # Object files for oids_test
304 OIDS_TEST_OBJ=oids_test.obj
305 OIDS_TEST_LIBS= ..\wiretap\wiretap-$(WTAP_VERSION).lib \
306         wsock32.lib user32.lib \
307         $(GLIB_LIBS) \
308         ..\wsutil\libwsutil.lib \
309         $(GNUTLS_LIBS) \
310         $(PYTHON_LIBS) \
311 !IFDEF ENABLE_LIBWIRESHARK
312         libwireshark.lib \
313 !ELSE
314         dissectors\dissectors.lib \
315         wireshark.lib \
316         crypt\airpdcap.lib \
317         dfilter\dfilter.lib \
318         ftypes\ftypes.lib \
319         wmem\wmem.lib \
320         $(C_ARES_LIBS) \
321         $(ADNS_LIBS) \
322         $(ZLIB_LIBS)
323 !ENDIF
325 oids_test.exe: $(OIDS_TEST_OBJ)
326         @echo Linking $@
327         $(LINK) /OUT:$@ $(conflags) $(conlibsdll) $(LOCAL_LDFLAGS) /LARGEADDRESSAWARE /SUBSYSTEM:console \
328                 $(OIDS_TEST_LIBS) $(GLIB_LIBS) $(ZLIB_LIBS) $(OIDS_TEST_OBJ)
329 !IFDEF MANIFEST_INFO_REQUIRED
330         mt.exe -nologo -manifest "$@.manifest" -outputresource:$@;1
331 !ENDIF
333 # Object files for reassemble_test
334 REASSEMBLE_TEST_OBJ=reassemble_test.obj
335 REASSEMBLE_TEST_LIBS= ..\wiretap\wiretap-$(WTAP_VERSION).lib \
336         wsock32.lib user32.lib \
337         $(GLIB_LIBS) \
338         ..\wsutil\libwsutil.lib \
339         $(GNUTLS_LIBS) \
340         $(PYTHON_LIBS) \
341 !IFDEF ENABLE_LIBWIRESHARK
342         libwireshark.lib \
343 !ELSE
344         dissectors\dissectors.lib \
345         wireshark.lib \
346         crypt\airpdcap.lib \
347         dfilter\dfilter.lib \
348         ftypes\ftypes.lib \
349         $(C_ARES_LIBS) \
350         $(ADNS_LIBS) \
351         $(ZLIB_LIBS)
352 !ENDIF
354 reassemble_test.exe: $(REASSEMBLE_TEST_OBJ)
355         @echo Linking $@
356         $(LINK) /OUT:$@ $(conflags) $(conlibsdll) $(LOCAL_LDFLAGS) /LARGEADDRESSAWARE /SUBSYSTEM:console \
357                 $(REASSEMBLE_TEST_LIBS) $(GLIB_LIBS) $(ZLIB_LIBS) $(REASSEMBLE_TEST_OBJ)
358 !IFDEF MANIFEST_INFO_REQUIRED
359         mt.exe -nologo -manifest "$@.manifest" -outputresource:$@;1
360 !ENDIF
362 exntest_install:
363         set copycmd=/y
364         if exist exntest.exe          xcopy exntest.exe          ..\$(INSTALL_DIR) /d
366 tvbtest_install:
367         set copycmd=/y
368         if exist tvbtest.exe          xcopy tvbtest.exe          ..\$(INSTALL_DIR) /d
370 oids_test_install:
371         set copycmd=/y
372         if exist oids_test.exe          xcopy oids_test.exe          ..\$(INSTALL_DIR) /d
374 reassemble_test_install:
375         set copycmd=/y
376         if exist reassemble_test.exe          xcopy reassemble_test.exe          ..\$(INSTALL_DIR) /d
380 # Compile some time critical code from assembler if NASM available
382 !IFDEF NASM
383 asm_utils_win32_x86.obj: asm_utils_win32_x86.asm
384         $(NASM) -f $(WIRESHARK_TARGET_PLATFORM) -o $@ $?
385 !ENDIF
387 sminmpec.c: enterprise-numbers ..\tools\make-sminmpec.pl
388         $(PERL) ../tools/make-sminmpec.pl enterprise-numbers sminmpec.c
390 RUNLEX=..\tools\runlex.sh
393 # We compile these specially because they're Flex-generated and thus
394 # "warnings are errors" will fail because there's a bunch of
395 # warnings we can't eliminate.
397 diam_dict_lex.h: diam_dict.c
398 diam_dict.obj : diam_dict.c
399         $(CC) $(GENERATED_CFLAGS) -Fd.\ -c $?
402 # This depends on dtd_grammar.h to force dtd_grammar.h to be
403 # built before we try to compile it, as dtd_parse.c includes
404 # dtd_grammar.h, and dtd_grammar.h is not distributed with
405 # the source (it's generated with Lemon).  That means we can't
406 # use $?, as that would make it try to compile dtd_grammar.h.
408 dtd_parse_lex.h: dtd_parse.c
409 dtd_parse.obj : dtd_grammar.h
410 dtd_parse.obj : dtd_parse.c
411         $(CC) $(GENERATED_CFLAGS) -Fd.\ -c dtd_parse.c
413 dtd_preparse_lex.h: dtd_preparse.c
414 dtd_preparse.obj : dtd_preparse.c
415         $(CC) $(GENERATED_CFLAGS) -Fd.\ -c $?
417 radius_dict_lex.h: radius_dict.c
418 radius_dict.obj : radius_dict.c
419         $(CC) $(GENERATED_CFLAGS) -Fd.\ -c $?
421 uat_load_lex.h: uat_load.c
422 uat_load.obj : uat_load.c
423         $(CC) $(GENERATED_CFLAGS) -Fd.\ -c $?
425 LEMON=..\tools\lemon
427 dtd_grammar.h: dtd_grammar.c
428 dtd_grammar.c: $(LEMON)\lemon.exe $(LEMON)\lempar.c dtd_grammar.lemon
429         $(LEMON)\lemon t=$(LEMON)\lempar.c dtd_grammar.lemon
432 # We compile these specially because they're test programs, not library
433 # routines, and thus they import stuff from the library rather than
434 # exporting stuff from the library.
436 exntest.obj: exntest.c
437         $(CC) $(TEST_CFLAGS) -Fd.\ -c $?
439 reassemble_test.obj: reassemble_test.c
440         $(CC) $(TEST_CFLAGS) -Fd.\ -c $?
442 tvbtest.obj: tvbtest.c
443         $(CC) $(TEST_CFLAGS) -Fd.\ -c $?
445 oids_test.obj: oids_test.c
446         $(CC) $(TEST_CFLAGS) -Fd.\ -c $?
448 ps.c: ..\tools\rdps.py print.ps
449         $(PYTHON) ..\tools\rdps.py print.ps ps.c
451 checkapi:
452         $(PERL) ../tools/checkAPIs.pl -g termoutput -build $(LIBWIRESHARK_SRC)