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.. /I../wiretap $(GLIB_CFLAGS) \
19 $(ZLIB_CFLAGS) $(C_ARES_CFLAGS) $(ADNS_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
66 ..\wsutil\libwsutil.lib \
67 ..\wiretap\wiretap-$(WTAP_VERSION).lib \
68 compress\lzxpress.lib \
75 dissectors\dissectors.lib
78 $(CC) $(CFLAGS) -Fd.\ -c $<
80 LIBWIRESHARK_OBJECTS = $(LIBWIRESHARK_ALL_SRC:.c=.obj)
83 !IF defined(NASM) && "$(WIRESHARK_TARGET_PLATFORM)" == "win32"
84 asm_utils_win32_x86.obj
93 !IFDEF ENABLE_LIBWIRESHARK
94 all: compress crypt ftypes dfilter wmem $(WSLUA_DIR) nghttp2 dissectors libwireshark.dll
96 all: compress crypt ftypes dfilter wmem $(WSLUA_DIR) nghttp2 dissectors libwireshark.lib
99 # For use when making libwireshark.dll
100 libwireshark.lib: libwireshark.dll
101 libwireshark.exp: libwireshark.dll
103 libwireshark.dll: ..\config.h $(LIBWIRESHARK_OBJECTS) compress crypt ftypes dfilter wmem $(WSLUA_DIR) nghttp2 dissectors $(DOXYGEN_DEP) $(EXTRA_OBJECTS) \
104 crypt\airpdcap.lib ftypes\ftypes.lib dfilter\dfilter.lib wmem\wmem.lib dissectors\dissectors.lib $(WSLUA_LIB) nghttp2\nghttp2.lib ..\image\libwireshark.res
105 @echo Linking libwireshark.dll
106 $(link) $(dlllflags) $(conlibsdll) shell32.lib psapi.lib \
107 $(LOCAL_LDFLAGS) $(DLL_LDFLAGS) \
108 /OUT:libwireshark.dll \
109 /IMPLIB:libwireshark.lib $(LIBWIRESHARK_OBJECTS) \
110 $(libwireshark_LIBS) ..\image\libwireshark.res \
111 dissectors\register.obj \
114 libwireshark.lib : ..\config.h $(LIBWIRESHARK_OBJECTS) compress crypt ftypes dfilter wmem $(WSLUA_DIR) nghttp2 dissectors $(DOXYGEN_DEP) $(EXTRA_OBJECTS) \
115 crypt\airpdcap.lib ftypes\ftypes.lib dfilter\dfilter.lib wmem\wmem.lib $(WSLUA_LIB) nghttp2\nghttp2.lib dissectors\dissectors.lib
116 link /lib /out:libwireshark.lib $(LIBWIRESHARK_OBJECTS) \
119 ..\config.h : ..\config.h.win32 ..\config.nmake
121 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake config.h
125 rm -f $(LIBWIRESHARK_OBJECTS) $(EXTRA_OBJECTS) \
126 libwireshark.lib libwireshark.dll *.manifest libwireshark.exp \
127 *.nativecodeanalysis.xml *.pdb *.sbr doxygen.cfg html/*.* \
128 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
129 if exist html rm -rf html
133 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
135 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
137 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
139 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
141 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
143 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
145 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
147 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
151 # We remove the Flex-generated files with "distclean" because they need
152 # different #includes for UN*X and Windows (UN*X versions of Flex make it
153 # include <unistd.h>, but that's a UN*X-only header), so if you're going
154 # to build from source, you need to build those scanners from the
155 # corresponding ".l" files with Flex.
156 # This might not be necessary for "dtd_grammar.{c,h}", but we handle them
159 distclean-local: clean-local
160 rm -f config.h register.c mkstemp.c \
161 $(NODIST_LIBWIRESHARK_GENERATED_C_FILES) \
162 $(NODIST_LIBWIRESHARK_GENERATED_HEADER_FILES) \
163 $(LIBWIRESHARK_GENERATED_C_FILES) \
164 $(LIBWIRESHARK_GENERATED_HEADER_FILES) \
167 distclean: distclean-local
169 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
171 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
173 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
175 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
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
186 maintainer-clean-local: distclean-local
188 maintainer-clean: maintainer-clean-local
190 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
192 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
194 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
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
209 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
212 compress:: ..\config.h
214 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
219 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
222 dfilter:: ..\config.h
224 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
227 dissectors:: ..\config.h
229 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
234 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
239 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
242 nghttp2:: ..\config.h
244 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
247 doxygen.cfg: ..\config.nmake doxygen.cfg.in
248 sed -e s/@VERSION@/$(VERSION)/ \
249 < doxygen.cfg.in > $@
253 $(DOXYGEN) doxygen.cfg
256 doxygen: doxygen.cfg doxygen-run
258 # Rules for making unit tests
260 reassemble_test: reassemble_test.exe
262 oids_test: oids_test.exe
264 # Object files for exntest
265 EXNTEST_OBJ=exntest.obj except.obj
267 exntest.exe: $(EXNTEST_OBJ)
269 $(LINK) /OUT:$@ $(conflags) $(conlibsdll) $(LOCAL_LDFLAGS) /LARGEADDRESSAWARE /SUBSYSTEM:console \
270 $(GLIB_LIBS) $(EXNTEST_OBJ)
271 !IFDEF MANIFEST_INFO_REQUIRED
272 mt.exe -nologo -manifest "$@.manifest" -outputresource:$@;1
275 # Object files for tvbtest
276 TVBTEST_OBJ=tvbtest.obj
277 TVBTEST_LIBS= ..\wiretap\wiretap-$(WTAP_VERSION).lib \
278 wsock32.lib user32.lib \
280 ..\wsutil\libwsutil.lib \
282 !IFDEF ENABLE_LIBWIRESHARK
285 dissectors\dissectors.lib \
287 compress\lzxpress.lib \
289 dfilter\dfilter.lib \
296 tvbtest.exe: $(TVBTEST_OBJ)
298 $(LINK) /OUT:$@ $(conflags) $(conlibsdll) $(LOCAL_LDFLAGS) /LARGEADDRESSAWARE /SUBSYSTEM:console \
299 $(TVBTEST_LIBS) $(GLIB_LIBS) $(ZLIB_LIBS) $(TVBTEST_OBJ)
300 !IFDEF MANIFEST_INFO_REQUIRED
301 mt.exe -nologo -manifest "$@.manifest" -outputresource:$@;1
304 # Object files for oids_test
305 OIDS_TEST_OBJ=oids_test.obj
306 OIDS_TEST_LIBS= ..\wiretap\wiretap-$(WTAP_VERSION).lib \
307 wsock32.lib user32.lib \
309 ..\wsutil\libwsutil.lib \
311 !IFDEF ENABLE_LIBWIRESHARK
314 dissectors\dissectors.lib \
316 compress\lzxpress.lib \
318 dfilter\dfilter.lib \
326 oids_test.exe: $(OIDS_TEST_OBJ)
328 $(LINK) /OUT:$@ $(conflags) $(conlibsdll) $(LOCAL_LDFLAGS) /LARGEADDRESSAWARE /SUBSYSTEM:console \
329 $(OIDS_TEST_LIBS) $(GLIB_LIBS) $(ZLIB_LIBS) $(OIDS_TEST_OBJ)
330 !IFDEF MANIFEST_INFO_REQUIRED
331 mt.exe -nologo -manifest "$@.manifest" -outputresource:$@;1
334 # Object files for reassemble_test
335 REASSEMBLE_TEST_OBJ=reassemble_test.obj
336 REASSEMBLE_TEST_LIBS= ..\wiretap\wiretap-$(WTAP_VERSION).lib \
337 wsock32.lib user32.lib \
339 ..\wsutil\libwsutil.lib \
341 !IFDEF ENABLE_LIBWIRESHARK
344 dissectors\dissectors.lib \
346 compress\lzxpress.lib \
348 dfilter\dfilter.lib \
355 reassemble_test.exe: $(REASSEMBLE_TEST_OBJ)
357 $(LINK) /OUT:$@ $(conflags) $(conlibsdll) $(LOCAL_LDFLAGS) /LARGEADDRESSAWARE /SUBSYSTEM:console \
358 $(REASSEMBLE_TEST_LIBS) $(GLIB_LIBS) $(ZLIB_LIBS) $(REASSEMBLE_TEST_OBJ)
359 !IFDEF MANIFEST_INFO_REQUIRED
360 mt.exe -nologo -manifest "$@.manifest" -outputresource:$@;1
363 exntest_install: exntest.exe
365 xcopy exntest.exe ..\$(INSTALL_DIR) /d
367 tvbtest_install: tvbtest.exe
369 xcopy tvbtest.exe ..\$(INSTALL_DIR) /d
371 oids_test_install: oids_test.exe
373 xcopy oids_test.exe ..\$(INSTALL_DIR) /d
375 reassemble_test_install: reassemble_test.exe
377 xcopy reassemble_test.exe ..\$(INSTALL_DIR) /d
379 test-programs: exntest_install tvbtest_install oids_test_install reassemble_test_install
381 $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake test-programs
385 # Compile some time critical code from assembler if NASM available
388 asm_utils_win32_x86.obj: asm_utils_win32_x86.asm
389 $(NASM) -f $(WIRESHARK_TARGET_PLATFORM) -o $@ $?
393 $(PERL) ../tools/make-sminmpec.pl
395 RUNLEX=../tools/runlex.sh
398 # We compile these specially because they're Flex-generated and thus
399 # "warnings are errors" will fail because there's a bunch of
400 # warnings we can't eliminate.
402 diam_dict_lex.h: diam_dict.c
403 diam_dict.obj : diam_dict.c
404 $(CC) $(GENERATED_CFLAGS) -Fd.\ -c $?
407 # This depends on dtd_grammar.h to force dtd_grammar.h to be
408 # built before we try to compile it, as dtd_parse.c includes
409 # dtd_grammar.h, and dtd_grammar.h is not distributed with
410 # the source (it's generated with Lemon). That means we can't
411 # use $?, as that would make it try to compile dtd_grammar.h.
413 dtd_parse_lex.h: dtd_parse.c
414 dtd_parse.obj : dtd_grammar.h
415 dtd_parse.obj : dtd_parse.c
416 $(CC) $(GENERATED_CFLAGS) -Fd.\ -c dtd_parse.c
418 dtd_preparse_lex.h: dtd_preparse.c
419 dtd_preparse.obj : dtd_preparse.c
420 $(CC) $(GENERATED_CFLAGS) -Fd.\ -c $?
422 radius_dict_lex.h: radius_dict.c
423 radius_dict.obj : radius_dict.c
424 $(CC) $(GENERATED_CFLAGS) -Fd.\ -c $?
426 uat_load_lex.h: uat_load.c
427 uat_load.obj : uat_load.c
428 $(CC) $(GENERATED_CFLAGS) -Fd.\ -c $?
432 dtd_grammar.h: dtd_grammar.c
433 dtd_grammar.c: $(LEMON)\lemon.exe $(LEMON)\lempar.c dtd_grammar.lemon
434 $(LEMON)\lemon T=$(LEMON)\lempar.c dtd_grammar.lemon
437 # We compile these specially because they're test programs, not library
438 # routines, and thus they import stuff from the library rather than
439 # exporting stuff from the library.
441 exntest.obj: exntest.c
442 $(CC) $(TEST_CFLAGS) -Fd.\ -c $?
444 reassemble_test.obj: reassemble_test.c
445 $(CC) $(TEST_CFLAGS) -Fd.\ -c $?
447 tvbtest.obj: tvbtest.c
448 $(CC) $(TEST_CFLAGS) -Fd.\ -c $?
450 oids_test.obj: oids_test.c
451 $(CC) $(TEST_CFLAGS) -Fd.\ -c $?
453 ps.c: ..\tools\rdps.py print.ps
454 $(PYTHON) ..\tools\rdps.py print.ps ps.c
457 $(PERL) ../tools/checkAPIs.pl -g termoutput -build $(LIBWIRESHARK_SRC)
460 # Editor modelines - https://www.wireshark.org/tools/modelines.html
465 # indent-tabs-mode: t
468 # vi: set shiftwidth=8 tabstop=8 noexpandtab:
469 # :indentSize=8:tabSize=8:noTabs=false: