1 ## Makefile for building wireshark.exe with Microsoft C and nmake
2 ## Use: $(MAKE) /$(MAKEFLAGS) -f makefile.nmake
6 include ..\config.nmake
8 include ..\Makefile.nmake.inc
10 include Makefile.common
15 # These are the flags for all source files.
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.
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.
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
49 WSLUA_LIB=wslua\wslua.lib
57 WSPYTHON_LIB=wspython\wspython.lib
64 # For use when making libwireshark.dll
77 ..\wsutil\libwsutil.lib \
78 ..\wiretap\wiretap-$(WTAP_VERSION).lib \
85 dissectors\dissectors.lib
88 $(CC) $(CFLAGS) -Fd.\ -c $<
90 LIBWIRESHARK_OBJECTS = $(LIBWIRESHARK_ALL_SRC:.c=.obj)
93 !IF defined(NASM) && "$(WIRESHARK_TARGET_PLATFORM)" == "win32"
94 asm_utils_win32_x86.obj
103 !IFDEF ENABLE_LIBWIRESHARK
104 all: crypt ftypes dfilter wmem $(WSLUA_DIR) $(WSPYTHON_DIR) dissectors libwireshark.dll
106 all: crypt ftypes dfilter wmem $(WSLUA_DIR) $(WSPYTHON_DIR) dissectors libwireshark.lib
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 \
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) \
129 ..\config.h : ..\config.h.win32 ..\config.nmake
131 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake config.h
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
143 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
145 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
147 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
149 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
151 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
153 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
155 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
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
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
177 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
179 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
181 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
183 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
185 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
187 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
189 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
192 maintainer-clean-local: distclean-local
194 maintainer-clean: maintainer-clean-local
196 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
198 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
200 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
202 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
204 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
206 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
208 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
213 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
218 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
221 dfilter:: ..\config.h
223 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
226 dissectors:: ..\config.h
228 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
233 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
238 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
241 wspython:: ..\config.h
243 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
246 doxygen.cfg: ..\config.nmake doxygen.cfg.in
247 sed -e s/@VERSION@/$(VERSION)/ \
248 < doxygen.cfg.in > $@
252 $(DOXYGEN) doxygen.cfg
255 doxygen: doxygen.cfg doxygen-run
257 # Rules for making unit tests
259 reassemble_test: reassemble_test.exe
261 oids_test: oids_test.exe
263 # Object files for exntest
264 EXNTEST_OBJ=exntest.obj except.obj
266 exntest.exe: $(EXNTEST_OBJ)
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
274 # Object files for tvbtest
275 TVBTEST_OBJ=tvbtest.obj
276 TVBTEST_LIBS= ..\wiretap\wiretap-$(WTAP_VERSION).lib \
277 wsock32.lib user32.lib \
279 ..\wsutil\libwsutil.lib \
282 !IFDEF ENABLE_LIBWIRESHARK
285 dissectors\dissectors.lib \
288 dfilter\dfilter.lib \
295 tvbtest.exe: $(TVBTEST_OBJ)
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
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 \
308 ..\wsutil\libwsutil.lib \
311 !IFDEF ENABLE_LIBWIRESHARK
314 dissectors\dissectors.lib \
317 dfilter\dfilter.lib \
325 oids_test.exe: $(OIDS_TEST_OBJ)
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
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 \
338 ..\wsutil\libwsutil.lib \
341 !IFDEF ENABLE_LIBWIRESHARK
344 dissectors\dissectors.lib \
347 dfilter\dfilter.lib \
354 reassemble_test.exe: $(REASSEMBLE_TEST_OBJ)
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
364 if exist exntest.exe xcopy exntest.exe ..\$(INSTALL_DIR) /d
368 if exist tvbtest.exe xcopy tvbtest.exe ..\$(INSTALL_DIR) /d
372 if exist oids_test.exe xcopy oids_test.exe ..\$(INSTALL_DIR) /d
374 reassemble_test_install:
376 if exist reassemble_test.exe xcopy reassemble_test.exe ..\$(INSTALL_DIR) /d
380 # Compile some time critical code from assembler if NASM available
383 asm_utils_win32_x86.obj: asm_utils_win32_x86.asm
384 $(NASM) -f $(WIRESHARK_TARGET_PLATFORM) -o $@ $?
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 $?
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
452 $(PERL) ../tools/checkAPIs.pl -g termoutput -build $(LIBWIRESHARK_SRC)