ISO14443: Fix Dead Store (Dead assignement/Dead increment) Warning found by Clang
[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
5 include ..\config.nmake
6 include <win32.mak>
7 include ..\Makefile.nmake.inc
8
9 include Makefile.common
10
11 LINK= link
12
13 #
14 # These are the flags for all source files.
15 #
16 COMMON_CFLAGS=\
17         $(STANDARD_CFLAGS) \
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)
22
23 #
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.
27 #
28 GENERATED_CFLAGS=\
29         $(COMMON_CFLAGS) -DWS_BUILD_DLL
30
31 #
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.
36 #
37 TEST_CFLAGS=\
38         $(WARNINGS_ARE_ERRORS) $(COMMON_CFLAGS)
39
40 #
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.
44 #
45 CFLAGS=$(WARNINGS_ARE_ERRORS) $(GENERATED_CFLAGS) -DWS_BUILD_DLL
46
47 !IFDEF LUA_DIR
48 WSLUA_LIB=wslua\wslua.lib
49 WSLUA_DIR=wslua
50 !ELSE
51 WSLUA_LIB=
52 WSLUA_DIR=
53 !ENDIf
54
55 # For use when making libwireshark.dll
56 libwireshark_LIBS = \
57         $(GLIB_LIBS)    \
58         $(C_ARES_LIBS) \
59         $(ADNS_LIBS) \
60         $(KFW_LIBS) \
61         $(ZLIB_LIBS) \
62         $(GNUTLS_LIBS) \
63         $(LUA_LIBS) \
64         $(SMI_LIBS) \
65         $(GEOIP_LIBS) \
66         ..\wsutil\libwsutil.lib \
67         ..\wiretap\wiretap-$(WTAP_VERSION).lib \
68         compress\lzxpress.lib \
69         crypt\airpdcap.lib \
70         ftypes\ftypes.lib \
71         dfilter\dfilter.lib \
72         wmem\wmem.lib \
73         $(WSLUA_LIB) \
74         nghttp2\nghttp2.lib \
75         dissectors\dissectors.lib
76
77 .c.obj::
78         $(CC) $(CFLAGS) -Fd.\ -c $<
79
80 LIBWIRESHARK_OBJECTS = $(LIBWIRESHARK_ALL_SRC:.c=.obj)
81
82 EXTRA_OBJECTS = \
83 !IF defined(NASM) && "$(WIRESHARK_TARGET_PLATFORM)" == "win32"
84         asm_utils_win32_x86.obj
85 !ELSE
86         asm_utils.obj
87 !ENDIF
88
89 !IFDEF DOXYGEN
90 DOXYGEN_DEP=doxygen
91 !ENDIF
92
93 !IFDEF ENABLE_LIBWIRESHARK
94 all: compress crypt ftypes dfilter wmem $(WSLUA_DIR) nghttp2 dissectors libwireshark.dll
95 !ELSE
96 all: compress crypt ftypes dfilter wmem $(WSLUA_DIR) nghttp2 dissectors libwireshark.lib
97 !ENDIF
98
99 # For use when making libwireshark.dll
100 libwireshark.lib: libwireshark.dll
101 libwireshark.exp: libwireshark.dll
102
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 \
112                 $(EXTRA_OBJECTS)
113
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) \
117                 $(EXTRA_OBJECTS)
118
119 ..\config.h     : ..\config.h.win32 ..\config.nmake
120         cd ..
121         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake config.h
122         cd epan
123
124 clean-local:
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
130
131 clean:  clean-local
132         cd compress
133         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
134         cd ../crypt
135         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
136         cd ../ftypes
137         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
138         cd ../dfilter
139         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
140         cd ../dissectors
141         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
142         cd ../wmem
143         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
144         cd ../wslua
145         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
146         cd ../nghttp2
147         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
148         cd ..
149
150 #
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
157 # the same for now.
158 #
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) \
165                 dtd_grammar.out
166
167 distclean: distclean-local
168         cd compress
169         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
170         cd ../crypt
171         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
172         cd ../ftypes
173         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
174         cd ../dfilter
175         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
176         cd ../dissectors
177         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
178         cd ../wmem
179         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
180         cd ../wslua
181         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
182         cd ../nghttp2
183         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
184         cd ..
185
186 maintainer-clean-local: distclean-local
187
188 maintainer-clean: maintainer-clean-local
189         cd compress
190         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
191         cd ../crypt
192         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
193         cd ../ftypes
194         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
195         cd ../dfilter
196         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
197         cd ../dissectors
198         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
199         cd ../wmem
200         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
201         cd ../wslua
202         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
203         cd ../nghttp2
204         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
205         cd ..
206
207 crypt:: ..\config.h
208         cd crypt
209         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
210         cd ..
211
212 compress:: ..\config.h
213         cd compress
214         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
215         cd ..
216
217 ftypes:: ..\config.h
218         cd ftypes
219         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
220         cd ..
221
222 dfilter:: ..\config.h
223         cd dfilter
224         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
225         cd ..
226
227 dissectors:: ..\config.h
228         cd dissectors
229         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
230         cd ..
231
232 wmem:: ..\config.h
233         cd wmem
234         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
235         cd ..
236
237 wslua:: ..\config.h
238         cd wslua
239         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
240         cd ..
241
242 nghttp2:: ..\config.h
243         cd nghttp2
244         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
245         cd ..
246
247 doxygen.cfg: ..\config.nmake doxygen.cfg.in
248         sed -e s/@VERSION@/$(VERSION)/ \
249             < doxygen.cfg.in > $@
250
251 doxygen-run:
252 !IFDEF DOXYGEN
253         $(DOXYGEN) doxygen.cfg
254 !ENDIF
255
256 doxygen: doxygen.cfg doxygen-run
257
258 # Rules for making unit tests
259 exntest: exntest.exe
260 reassemble_test: reassemble_test.exe
261 tvbtest: tvbtest.exe
262 oids_test: oids_test.exe
263
264 # Object files for exntest
265 EXNTEST_OBJ=exntest.obj except.obj
266
267 exntest.exe: $(EXNTEST_OBJ)
268         @echo Linking $@
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
273 !ENDIF
274
275 # Object files for tvbtest
276 TVBTEST_OBJ=tvbtest.obj
277 TVBTEST_LIBS= ..\wiretap\wiretap-$(WTAP_VERSION).lib \
278         wsock32.lib user32.lib \
279         $(GLIB_LIBS) \
280         ..\wsutil\libwsutil.lib \
281         $(GNUTLS_LIBS) \
282 !IFDEF ENABLE_LIBWIRESHARK
283         libwireshark.lib \
284 !ELSE
285         dissectors\dissectors.lib \
286         wireshark.lib \
287         compress\lzxpress.lib \
288         crypt\airpdcap.lib \
289         dfilter\dfilter.lib \
290         ftypes\ftypes.lib \
291         $(C_ARES_LIBS) \
292         $(ADNS_LIBS) \
293         $(ZLIB_LIBS)
294 !ENDIF
295
296 tvbtest.exe: $(TVBTEST_OBJ)
297         @echo Linking $@
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
302 !ENDIF
303
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 \
308         $(GLIB_LIBS) \
309         ..\wsutil\libwsutil.lib \
310         $(GNUTLS_LIBS) \
311 !IFDEF ENABLE_LIBWIRESHARK
312         libwireshark.lib \
313 !ELSE
314         dissectors\dissectors.lib \
315         wireshark.lib \
316         compress\lzxpress.lib \
317         crypt\airpdcap.lib \
318         dfilter\dfilter.lib \
319         ftypes\ftypes.lib \
320         wmem\wmem.lib \
321         $(C_ARES_LIBS) \
322         $(ADNS_LIBS) \
323         $(ZLIB_LIBS)
324 !ENDIF
325
326 oids_test.exe: $(OIDS_TEST_OBJ)
327         @echo Linking $@
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
332 !ENDIF
333
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 \
338         $(GLIB_LIBS) \
339         ..\wsutil\libwsutil.lib \
340         $(GNUTLS_LIBS) \
341 !IFDEF ENABLE_LIBWIRESHARK
342         libwireshark.lib \
343 !ELSE
344         dissectors\dissectors.lib \
345         wireshark.lib \
346         compress\lzxpress.lib \
347         crypt\airpdcap.lib \
348         dfilter\dfilter.lib \
349         ftypes\ftypes.lib \
350         $(C_ARES_LIBS) \
351         $(ADNS_LIBS) \
352         $(ZLIB_LIBS)
353 !ENDIF
354
355 reassemble_test.exe: $(REASSEMBLE_TEST_OBJ)
356         @echo Linking $@
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
361 !ENDIF
362
363 exntest_install: exntest.exe
364         set copycmd=/y
365         xcopy exntest.exe ..\$(INSTALL_DIR) /d
366
367 tvbtest_install: tvbtest.exe
368         set copycmd=/y
369         xcopy tvbtest.exe ..\$(INSTALL_DIR) /d
370
371 oids_test_install: oids_test.exe
372         set copycmd=/y
373         xcopy oids_test.exe ..\$(INSTALL_DIR) /d
374
375 reassemble_test_install: reassemble_test.exe
376         set copycmd=/y
377         xcopy reassemble_test.exe ..\$(INSTALL_DIR) /d
378
379 test-programs: exntest_install tvbtest_install oids_test_install reassemble_test_install
380         cd wmem
381         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake test-programs
382         cd ..
383
384 #
385 # Compile some time critical code from assembler if NASM available
386 #
387 !IFDEF NASM
388 asm_utils_win32_x86.obj: asm_utils_win32_x86.asm
389         $(NASM) -f $(WIRESHARK_TARGET_PLATFORM) -o $@ $?
390 !ENDIF
391
392 update-sminmpec:
393         $(PERL) ../tools/make-sminmpec.pl
394
395 RUNLEX=../tools/runlex.sh
396
397 #
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.
401 #
402 diam_dict_lex.h: diam_dict.c
403 diam_dict.obj : diam_dict.c
404         $(CC) $(GENERATED_CFLAGS) -Fd.\ -c $?
405
406 #
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.
412 #
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
417
418 dtd_preparse_lex.h: dtd_preparse.c
419 dtd_preparse.obj : dtd_preparse.c
420         $(CC) $(GENERATED_CFLAGS) -Fd.\ -c $?
421
422 radius_dict_lex.h: radius_dict.c
423 radius_dict.obj : radius_dict.c
424         $(CC) $(GENERATED_CFLAGS) -Fd.\ -c $?
425
426 uat_load_lex.h: uat_load.c
427 uat_load.obj : uat_load.c
428         $(CC) $(GENERATED_CFLAGS) -Fd.\ -c $?
429
430 LEMON=..\tools\lemon
431
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
435
436 #
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.
440 #
441 exntest.obj: exntest.c
442         $(CC) $(TEST_CFLAGS) -Fd.\ -c $?
443
444 reassemble_test.obj: reassemble_test.c
445         $(CC) $(TEST_CFLAGS) -Fd.\ -c $?
446
447 tvbtest.obj: tvbtest.c
448         $(CC) $(TEST_CFLAGS) -Fd.\ -c $?
449
450 oids_test.obj: oids_test.c
451         $(CC) $(TEST_CFLAGS) -Fd.\ -c $?
452
453 ps.c: ..\tools\rdps.py print.ps
454         $(PYTHON) ..\tools\rdps.py print.ps ps.c
455
456 checkapi:
457         $(PERL) ../tools/checkAPIs.pl -g termoutput -build $(LIBWIRESHARK_SRC)
458
459 #
460 # Editor modelines  -  https://www.wireshark.org/tools/modelines.html
461 #
462 # Local variables:
463 # c-basic-offset: 8
464 # tab-width: 8
465 # indent-tabs-mode: t
466 # End:
467 #
468 # vi: set shiftwidth=8 tabstop=8 noexpandtab:
469 # :indentSize=8:tabSize=8:noTabs=false:
470 #