1 ## Makefile for building wireshark.exe with Microsoft C and nmake
2 ## Use: $(MAKE) /$(MAKEFLAGS) -f makefile.nmake
5 include ..\config.nmake
7 include ..\Makefile.nmake.inc
9 include Makefile.common
14 # These are the flags for all source files.
18 /I. /I.. $(GLIB_CFLAGS) \
19 $(ZLIB_CFLAGS) $(C_ARES_CFLAGS) \
20 $(LUA_CFLAGS) $(GNUTLS_CFLAGS) /I$(PCAP_DIR)\include \
21 $(SMI_CFLAGS) $(GEOIP_CFLAGS)
24 # These are the flags for generated source files; we don't include
25 # $(WARNINGS_ARE_ERRORS), so that we flex's non-LLP64-compliant output
26 # doesn't cause compilation to fail.
29 $(COMMON_CFLAGS) -DWS_BUILD_DLL
32 # These are the flags for test programs; we don't include -DWS_BUILD_DLL,
33 # as we're building test programs that link with the library, not routines
34 # incorporated into the library, so they should *import* stuff from the
35 # library, not *export* stuff from the library.
38 $(WARNINGS_ARE_ERRORS) $(COMMON_CFLAGS)
41 # These are flags for everything else; we include $(WARNINGS_ARE_ERRORS),
42 # as the code should be warning-free, and we include -DWS_BUILD_DLL,
43 # as these are library routines, not test programs.
45 CFLAGS=$(WARNINGS_ARE_ERRORS) $(GENERATED_CFLAGS) -DWS_BUILD_DLL
48 WSLUA_LIB=wslua\wslua.lib
55 # For use when making libwireshark.dll
65 ..\wsutil\libwsutil.lib \
66 ..\wiretap\wiretap-$(WTAP_VERSION).lib \
67 compress\lzxpress.lib \
74 dissectors\dissectors.lib
77 $(CC) $(CFLAGS) -Fd.\ -c $<
79 LIBWIRESHARK_OBJECTS = $(LIBWIRESHARK_ALL_SRC:.c=.obj)
82 !IF defined(NASM) && "$(WIRESHARK_TARGET_PLATFORM)" == "win32"
83 asm_utils_win32_x86.obj
92 !IFDEF ENABLE_LIBWIRESHARK
93 all: compress crypt ftypes dfilter wmem $(WSLUA_DIR) nghttp2 dissectors libwireshark.dll
95 all: compress crypt ftypes dfilter wmem $(WSLUA_DIR) nghttp2 dissectors libwireshark.lib
98 # For use when making libwireshark.dll
99 libwireshark.lib: libwireshark.dll
100 libwireshark.exp: libwireshark.dll
102 libwireshark.dll: ..\config.h $(LIBWIRESHARK_OBJECTS) compress crypt ftypes dfilter wmem $(WSLUA_DIR) nghttp2 dissectors $(DOXYGEN_DEP) $(EXTRA_OBJECTS) \
103 crypt\airpdcap.lib ftypes\ftypes.lib dfilter\dfilter.lib wmem\wmem.lib dissectors\dissectors.lib $(WSLUA_LIB) nghttp2\nghttp2.lib ..\image\libwireshark.res
104 @echo Linking libwireshark.dll
105 $(link) $(dlllflags) $(conlibsdll) shell32.lib psapi.lib \
106 $(LOCAL_LDFLAGS) $(DLL_LDFLAGS) \
107 /OUT:libwireshark.dll \
108 /IMPLIB:libwireshark.lib $(LIBWIRESHARK_OBJECTS) \
109 $(libwireshark_LIBS) ..\image\libwireshark.res \
110 dissectors\register.obj \
113 libwireshark.lib : ..\config.h $(LIBWIRESHARK_OBJECTS) compress crypt ftypes dfilter wmem $(WSLUA_DIR) nghttp2 dissectors $(DOXYGEN_DEP) $(EXTRA_OBJECTS) \
114 crypt\airpdcap.lib ftypes\ftypes.lib dfilter\dfilter.lib wmem\wmem.lib $(WSLUA_LIB) nghttp2\nghttp2.lib dissectors\dissectors.lib
115 link /lib /out:libwireshark.lib $(LIBWIRESHARK_OBJECTS) \
118 ..\config.h : ..\config.h.win32 ..\config.nmake
120 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake config.h
124 rm -f $(LIBWIRESHARK_OBJECTS) $(EXTRA_OBJECTS) \
125 libwireshark.lib libwireshark.dll *.manifest libwireshark.exp \
126 *.nativecodeanalysis.xml *.pdb *.sbr doxygen.cfg html/*.* \
127 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
128 if exist html rm -rf html
132 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
134 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
136 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
138 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
140 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
142 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
144 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
146 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
150 # We remove the Flex-generated files with "distclean" because they need
151 # different #includes for UN*X and Windows (UN*X versions of Flex make it
152 # include <unistd.h>, but that's a UN*X-only header), so if you're going
153 # to build from source, you need to build those scanners from the
154 # corresponding ".l" files with Flex.
155 # This might not be necessary for "dtd_grammar.{c,h}", but we handle them
158 distclean-local: clean-local
159 rm -f config.h register.c mkstemp.c \
160 $(NODIST_LIBWIRESHARK_GENERATED_C_FILES) \
161 $(NODIST_LIBWIRESHARK_GENERATED_HEADER_FILES) \
162 $(LIBWIRESHARK_GENERATED_C_FILES) \
163 $(LIBWIRESHARK_GENERATED_HEADER_FILES) \
166 distclean: distclean-local
168 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
170 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
172 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
174 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
176 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
178 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
180 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
182 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
185 maintainer-clean-local: distclean-local
187 maintainer-clean: maintainer-clean-local
189 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
191 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
193 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
195 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
197 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
199 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
201 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
203 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
208 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
211 compress:: ..\config.h
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 nghttp2:: ..\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 \
281 !IFDEF ENABLE_LIBWIRESHARK
284 dissectors\dissectors.lib \
286 compress\lzxpress.lib \
288 dfilter\dfilter.lib \
294 tvbtest.exe: $(TVBTEST_OBJ)
296 $(LINK) /OUT:$@ $(conflags) $(conlibsdll) $(LOCAL_LDFLAGS) /LARGEADDRESSAWARE /SUBSYSTEM:console \
297 $(TVBTEST_LIBS) $(GLIB_LIBS) $(ZLIB_LIBS) $(TVBTEST_OBJ)
298 !IFDEF MANIFEST_INFO_REQUIRED
299 mt.exe -nologo -manifest "$@.manifest" -outputresource:$@;1
302 # Object files for oids_test
303 OIDS_TEST_OBJ=oids_test.obj
304 OIDS_TEST_LIBS= ..\wiretap\wiretap-$(WTAP_VERSION).lib \
305 wsock32.lib user32.lib \
307 ..\wsutil\libwsutil.lib \
309 !IFDEF ENABLE_LIBWIRESHARK
312 dissectors\dissectors.lib \
314 compress\lzxpress.lib \
316 dfilter\dfilter.lib \
323 oids_test.exe: $(OIDS_TEST_OBJ)
325 $(LINK) /OUT:$@ $(conflags) $(conlibsdll) $(LOCAL_LDFLAGS) /LARGEADDRESSAWARE /SUBSYSTEM:console \
326 $(OIDS_TEST_LIBS) $(GLIB_LIBS) $(ZLIB_LIBS) $(OIDS_TEST_OBJ)
327 !IFDEF MANIFEST_INFO_REQUIRED
328 mt.exe -nologo -manifest "$@.manifest" -outputresource:$@;1
331 # Object files for reassemble_test
332 REASSEMBLE_TEST_OBJ=reassemble_test.obj
333 REASSEMBLE_TEST_LIBS= ..\wiretap\wiretap-$(WTAP_VERSION).lib \
334 wsock32.lib user32.lib \
336 ..\wsutil\libwsutil.lib \
338 !IFDEF ENABLE_LIBWIRESHARK
341 dissectors\dissectors.lib \
343 compress\lzxpress.lib \
345 dfilter\dfilter.lib \
351 reassemble_test.exe: $(REASSEMBLE_TEST_OBJ)
353 $(LINK) /OUT:$@ $(conflags) $(conlibsdll) $(LOCAL_LDFLAGS) /LARGEADDRESSAWARE /SUBSYSTEM:console \
354 $(REASSEMBLE_TEST_LIBS) $(GLIB_LIBS) $(ZLIB_LIBS) $(REASSEMBLE_TEST_OBJ)
355 !IFDEF MANIFEST_INFO_REQUIRED
356 mt.exe -nologo -manifest "$@.manifest" -outputresource:$@;1
359 exntest_install: exntest.exe
361 xcopy exntest.exe ..\$(INSTALL_DIR) /d
363 tvbtest_install: tvbtest.exe
365 xcopy tvbtest.exe ..\$(INSTALL_DIR) /d
367 oids_test_install: oids_test.exe
369 xcopy oids_test.exe ..\$(INSTALL_DIR) /d
371 reassemble_test_install: reassemble_test.exe
373 xcopy reassemble_test.exe ..\$(INSTALL_DIR) /d
375 test-programs: exntest_install tvbtest_install oids_test_install reassemble_test_install
377 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake test-programs
381 # Compile some time critical code from assembler if NASM available
384 asm_utils_win32_x86.obj: asm_utils_win32_x86.asm
385 $(NASM) -f $(WIRESHARK_TARGET_PLATFORM) -o $@ $?
389 $(PERL) ../tools/make-sminmpec.pl
391 RUNLEX=../tools/runlex.sh
394 # We compile these specially because they're Flex-generated and thus
395 # "warnings are errors" will fail because there's a bunch of
396 # warnings we can't eliminate.
398 diam_dict_lex.h: diam_dict.c
399 diam_dict.obj : diam_dict.c
400 $(CC) $(GENERATED_CFLAGS) -Fd.\ -c $?
403 # This depends on dtd_grammar.h to force dtd_grammar.h to be
404 # built before we try to compile it, as dtd_parse.c includes
405 # dtd_grammar.h, and dtd_grammar.h is not distributed with
406 # the source (it's generated with Lemon). That means we can't
407 # use $?, as that would make it try to compile dtd_grammar.h.
409 dtd_parse_lex.h: dtd_parse.c
410 dtd_parse.obj : dtd_grammar.h
411 dtd_parse.obj : dtd_parse.c
412 $(CC) $(GENERATED_CFLAGS) -Fd.\ -c dtd_parse.c
414 dtd_preparse_lex.h: dtd_preparse.c
415 dtd_preparse.obj : dtd_preparse.c
416 $(CC) $(GENERATED_CFLAGS) -Fd.\ -c $?
418 radius_dict_lex.h: radius_dict.c
419 radius_dict.obj : radius_dict.c
420 $(CC) $(GENERATED_CFLAGS) -Fd.\ -c $?
422 uat_load_lex.h: uat_load.c
423 uat_load.obj : uat_load.c
424 $(CC) $(GENERATED_CFLAGS) -Fd.\ -c $?
428 dtd_grammar.h: dtd_grammar.c
429 dtd_grammar.c: $(LEMON)\lemon.exe $(LEMON)\lempar.c dtd_grammar.lemon
430 $(LEMON)\lemon T=$(LEMON)\lempar.c dtd_grammar.lemon
433 # We compile these specially because they're test programs, not library
434 # routines, and thus they import stuff from the library rather than
435 # exporting stuff from the library.
437 exntest.obj: exntest.c
438 $(CC) $(TEST_CFLAGS) -Fd.\ -c $?
440 reassemble_test.obj: reassemble_test.c
441 $(CC) $(TEST_CFLAGS) -Fd.\ -c $?
443 tvbtest.obj: tvbtest.c
444 $(CC) $(TEST_CFLAGS) -Fd.\ -c $?
446 oids_test.obj: oids_test.c
447 $(CC) $(TEST_CFLAGS) -Fd.\ -c $?
449 ps.c: ..\tools\rdps.py print.ps
450 $(PYTHON) ..\tools\rdps.py print.ps ps.c
453 $(PERL) ../tools/checkAPIs.pl -g termoutput -build $(LIBWIRESHARK_SRC)
456 # Editor modelines - https://www.wireshark.org/tools/modelines.html
461 # indent-tabs-mode: t
464 # vi: set shiftwidth=8 tabstop=8 noexpandtab:
465 # :indentSize=8:tabSize=8:noTabs=false: