aboutsummaryrefslogtreecommitdiffstats
path: root/epan/Makefile.nmake
blob: 6384324b782c7842a0d08c1425cb75afa910d513 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
## Makefile for building wireshark.exe with Microsoft C and nmake
## Use: $(MAKE) /$(MAKEFLAGS) -f makefile.nmake
#

include ..\config.nmake
include <win32.mak>
include ..\Makefile.nmake.inc

include Makefile.common

LINK= link

#
# These are the flags for all source files.
#
COMMON_CFLAGS=\
	$(STANDARD_CFLAGS) \
	/I. /I.. /I../wiretap $(GLIB_CFLAGS) \
	$(ZLIB_CFLAGS) $(C_ARES_CFLAGS) $(ADNS_CFLAGS) \
	$(LUA_CFLAGS) $(GNUTLS_CFLAGS) /I$(PCAP_DIR)\include \
	$(SMI_CFLAGS) $(GEOIP_CFLAGS)

#
# These are the flags for generated source files; we don't include
# $(WARNINGS_ARE_ERRORS), so that we flex's non-LLP64-compliant output
# doesn't cause compilation to fail.
#
GENERATED_CFLAGS=\
	$(COMMON_CFLAGS) -DWS_BUILD_DLL

#
# These are the flags for test programs; we don't include -DWS_BUILD_DLL,
# as we're building test programs that link with the library, not routines
# incorporated into the library, so they should *import* stuff from the
# library, not *export* stuff from the library.
#
TEST_CFLAGS=\
	$(WARNINGS_ARE_ERRORS) $(COMMON_CFLAGS)

#
# These are flags for everything else; we include $(WARNINGS_ARE_ERRORS),
# as the code should be warning-free, and we include -DWS_BUILD_DLL,
# as these are library routines, not test programs.
#
CFLAGS=$(WARNINGS_ARE_ERRORS) $(GENERATED_CFLAGS) -DWS_BUILD_DLL

!IFDEF LUA_DIR
WSLUA_LIB=wslua\wslua.lib
WSLUA_DIR=wslua
!ELSE
WSLUA_LIB=
WSLUA_DIR=
!ENDIf

# For use when making libwireshark.dll
libwireshark_LIBS = \
	$(GLIB_LIBS)	\
	$(C_ARES_LIBS) \
	$(ADNS_LIBS) \
	$(KFW_LIBS) \
	$(ZLIB_LIBS) \
	$(GNUTLS_LIBS) \
	$(LUA_LIBS) \
	$(SMI_LIBS) \
	$(GEOIP_LIBS) \
	..\wsutil\libwsutil.lib \
	..\wiretap\wiretap-$(WTAP_VERSION).lib \
	compress\lzxpress.lib \
	crypt\airpdcap.lib \
	ftypes\ftypes.lib \
	dfilter\dfilter.lib \
	wmem\wmem.lib \
	$(WSLUA_LIB) \
	nghttp2\nghttp2.lib \
	dissectors\dissectors.lib

.c.obj::
	$(CC) $(CFLAGS) -Fd.\ -c $<

LIBWIRESHARK_OBJECTS = $(LIBWIRESHARK_ALL_SRC:.c=.obj)

EXTRA_OBJECTS = \
!IF defined(NASM) && "$(WIRESHARK_TARGET_PLATFORM)" == "win32"
	asm_utils_win32_x86.obj
!ELSE
	asm_utils.obj
!ENDIF

!IFDEF DOXYGEN
DOXYGEN_DEP=doxygen
!ENDIF

!IFDEF ENABLE_LIBWIRESHARK
all: compress crypt ftypes dfilter wmem $(WSLUA_DIR) nghttp2 dissectors libwireshark.dll
!ELSE
all: compress crypt ftypes dfilter wmem $(WSLUA_DIR) nghttp2 dissectors libwireshark.lib
!ENDIF

# For use when making libwireshark.dll
libwireshark.lib: libwireshark.dll
libwireshark.exp: libwireshark.dll

libwireshark.dll: ..\config.h $(LIBWIRESHARK_OBJECTS) compress crypt ftypes dfilter wmem $(WSLUA_DIR) nghttp2 dissectors $(DOXYGEN_DEP) $(EXTRA_OBJECTS) \
		crypt\airpdcap.lib ftypes\ftypes.lib dfilter\dfilter.lib wmem\wmem.lib dissectors\dissectors.lib $(WSLUA_LIB) nghttp2\nghttp2.lib ..\image\libwireshark.res
	@echo Linking libwireshark.dll
	$(link) $(dlllflags) $(conlibsdll) shell32.lib psapi.lib \
		$(LOCAL_LDFLAGS) $(DLL_LDFLAGS) \
		/OUT:libwireshark.dll \
		/IMPLIB:libwireshark.lib $(LIBWIRESHARK_OBJECTS) \
		$(libwireshark_LIBS) ..\image\libwireshark.res \
		dissectors\register.obj \
		$(EXTRA_OBJECTS)

libwireshark.lib	: ..\config.h $(LIBWIRESHARK_OBJECTS) compress crypt ftypes dfilter wmem $(WSLUA_DIR) nghttp2 dissectors $(DOXYGEN_DEP) $(EXTRA_OBJECTS) \
		crypt\airpdcap.lib ftypes\ftypes.lib dfilter\dfilter.lib wmem\wmem.lib $(WSLUA_LIB) nghttp2\nghttp2.lib dissectors\dissectors.lib
	link /lib /out:libwireshark.lib $(LIBWIRESHARK_OBJECTS) \
		$(EXTRA_OBJECTS)

..\config.h	: ..\config.h.win32 ..\config.nmake
	cd ..
	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake config.h
	cd epan

clean-local:
	rm -f $(LIBWIRESHARK_OBJECTS) $(EXTRA_OBJECTS) \
		libwireshark.lib libwireshark.dll *.manifest libwireshark.exp \
		*.nativecodeanalysis.xml *.pdb *.sbr doxygen.cfg html/*.* \
		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
	if exist html rm -rf html

clean:  clean-local
	cd compress
	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
	cd ../crypt
	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
	cd ../ftypes
	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
	cd ../dfilter
	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
	cd ../dissectors
	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
	cd ../wmem
	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
	cd ../wslua
	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
	cd ../nghttp2
	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
	cd ..

#
# We remove the Flex-generated files with "distclean" because they need
# different #includes for UN*X and Windows (UN*X versions of Flex make it
# include <unistd.h>, but that's a UN*X-only header), so if you're going
# to build from source, you need to build those scanners from the
# corresponding ".l" files with Flex.
# This might not be necessary for "dtd_grammar.{c,h}", but we handle them
# the same for now.
#
distclean-local: clean-local
	rm -f config.h register.c mkstemp.c \
		$(NODIST_LIBWIRESHARK_GENERATED_C_FILES) \
		$(NODIST_LIBWIRESHARK_GENERATED_HEADER_FILES) \
		$(LIBWIRESHARK_GENERATED_C_FILES) \
		$(LIBWIRESHARK_GENERATED_HEADER_FILES) \
		dtd_grammar.out

distclean: distclean-local
	cd compress
	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
	cd ../crypt
	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
	cd ../ftypes
	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
	cd ../dfilter
	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
	cd ../dissectors
	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
	cd ../wmem
	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
	cd ../wslua
	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
	cd ../nghttp2
	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
	cd ..

maintainer-clean-local: distclean-local

maintainer-clean: maintainer-clean-local
	cd compress
	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
	cd ../crypt
	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
	cd ../ftypes
	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
	cd ../dfilter
	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
	cd ../dissectors
	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
	cd ../wmem
	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
	cd ../wslua
	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
	cd ../nghttp2
	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
	cd ..

crypt:: ..\config.h
	cd crypt
	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
	cd ..

compress:: ..\config.h
	cd compress
	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
	cd ..

ftypes:: ..\config.h
	cd ftypes
	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
	cd ..

dfilter:: ..\config.h
	cd dfilter
	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
	cd ..

dissectors:: ..\config.h
	cd dissectors
	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
	cd ..

wmem:: ..\config.h
	cd wmem
	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
	cd ..

wslua:: ..\config.h
	cd wslua
	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
	cd ..

nghttp2:: ..\config.h
	cd nghttp2
	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
	cd ..

doxygen.cfg: ..\config.nmake doxygen.cfg.in
	sed -e s/@VERSION@/$(VERSION)/ \
	    < doxygen.cfg.in > $@

doxygen-run:
!IFDEF DOXYGEN
	$(DOXYGEN) doxygen.cfg
!ENDIF

doxygen: doxygen.cfg doxygen-run

# Rules for making unit tests
exntest: exntest.exe
reassemble_test: reassemble_test.exe
tvbtest: tvbtest.exe
oids_test: oids_test.exe

# Object files for exntest
EXNTEST_OBJ=exntest.obj except.obj

exntest.exe: $(EXNTEST_OBJ)
	@echo Linking $@
	$(LINK) /OUT:$@ $(conflags) $(conlibsdll) $(LOCAL_LDFLAGS) /LARGEADDRESSAWARE /SUBSYSTEM:console \
		$(GLIB_LIBS) $(EXNTEST_OBJ)
!IFDEF MANIFEST_INFO_REQUIRED
	mt.exe -nologo -manifest "$@.manifest" -outputresource:$@;1
!ENDIF

# Object files for tvbtest
TVBTEST_OBJ=tvbtest.obj
TVBTEST_LIBS= ..\wiretap\wiretap-$(WTAP_VERSION).lib \
	wsock32.lib user32.lib \
	$(GLIB_LIBS) \
	..\wsutil\libwsutil.lib \
	$(GNUTLS_LIBS) \
!IFDEF ENABLE_LIBWIRESHARK
	libwireshark.lib \
!ELSE
	dissectors\dissectors.lib \
	wireshark.lib \
	compress\lzxpress.lib \
	crypt\airpdcap.lib \
	dfilter\dfilter.lib \
	ftypes\ftypes.lib \
	$(C_ARES_LIBS) \
	$(ADNS_LIBS) \
	$(ZLIB_LIBS)
!ENDIF

tvbtest.exe: $(TVBTEST_OBJ)
	@echo Linking $@
	$(LINK) /OUT:$@ $(conflags) $(conlibsdll) $(LOCAL_LDFLAGS) /LARGEADDRESSAWARE /SUBSYSTEM:console \
		$(TVBTEST_LIBS) $(GLIB_LIBS) $(ZLIB_LIBS) $(TVBTEST_OBJ)
!IFDEF MANIFEST_INFO_REQUIRED
	mt.exe -nologo -manifest "$@.manifest" -outputresource:$@;1
!ENDIF

# Object files for oids_test
OIDS_TEST_OBJ=oids_test.obj
OIDS_TEST_LIBS= ..\wiretap\wiretap-$(WTAP_VERSION).lib \
	wsock32.lib user32.lib \
	$(GLIB_LIBS) \
	..\wsutil\libwsutil.lib \
	$(GNUTLS_LIBS) \
!IFDEF ENABLE_LIBWIRESHARK
	libwireshark.lib \
!ELSE
	dissectors\dissectors.lib \
	wireshark.lib \
	compress\lzxpress.lib \
	crypt\airpdcap.lib \
	dfilter\dfilter.lib \
	ftypes\ftypes.lib \
	wmem\wmem.lib \
	$(C_ARES_LIBS) \
	$(ADNS_LIBS) \
	$(ZLIB_LIBS)
!ENDIF

oids_test.exe: $(OIDS_TEST_OBJ)
	@echo Linking $@
	$(LINK) /OUT:$@ $(conflags) $(conlibsdll) $(LOCAL_LDFLAGS) /LARGEADDRESSAWARE /SUBSYSTEM:console \
		$(OIDS_TEST_LIBS) $(GLIB_LIBS) $(ZLIB_LIBS) $(OIDS_TEST_OBJ)
!IFDEF MANIFEST_INFO_REQUIRED
	mt.exe -nologo -manifest "$@.manifest" -outputresource:$@;1
!ENDIF

# Object files for reassemble_test
REASSEMBLE_TEST_OBJ=reassemble_test.obj
REASSEMBLE_TEST_LIBS= ..\wiretap\wiretap-$(WTAP_VERSION).lib \
	wsock32.lib user32.lib \
	$(GLIB_LIBS) \
	..\wsutil\libwsutil.lib \
	$(GNUTLS_LIBS) \
!IFDEF ENABLE_LIBWIRESHARK
	libwireshark.lib \
!ELSE
	dissectors\dissectors.lib \
	wireshark.lib \
	compress\lzxpress.lib \
	crypt\airpdcap.lib \
	dfilter\dfilter.lib \
	ftypes\ftypes.lib \
	$(C_ARES_LIBS) \
	$(ADNS_LIBS) \
	$(ZLIB_LIBS)
!ENDIF

reassemble_test.exe: $(REASSEMBLE_TEST_OBJ)
	@echo Linking $@
	$(LINK) /OUT:$@ $(conflags) $(conlibsdll) $(LOCAL_LDFLAGS) /LARGEADDRESSAWARE /SUBSYSTEM:console \
		$(REASSEMBLE_TEST_LIBS) $(GLIB_LIBS) $(ZLIB_LIBS) $(REASSEMBLE_TEST_OBJ)
!IFDEF MANIFEST_INFO_REQUIRED
	mt.exe -nologo -manifest "$@.manifest" -outputresource:$@;1
!ENDIF

exntest_install: exntest.exe
	set copycmd=/y
	xcopy exntest.exe ..\$(INSTALL_DIR) /d

tvbtest_install: tvbtest.exe
	set copycmd=/y
	xcopy tvbtest.exe ..\$(INSTALL_DIR) /d

oids_test_install: oids_test.exe
	set copycmd=/y
	xcopy oids_test.exe ..\$(INSTALL_DIR) /d

reassemble_test_install: reassemble_test.exe
	set copycmd=/y
	xcopy reassemble_test.exe ..\$(INSTALL_DIR) /d

test-programs: exntest_install tvbtest_install oids_test_install reassemble_test_install
	cd wmem
	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake test-programs
	cd ..

#
# Compile some time critical code from assembler if NASM available
#
!IFDEF NASM
asm_utils_win32_x86.obj: asm_utils_win32_x86.asm
	$(NASM) -f $(WIRESHARK_TARGET_PLATFORM) -o $@ $?
!ENDIF

update-sminmpec:
	$(PERL) ../tools/make-sminmpec.pl

RUNLEX=../tools/runlex.sh

#
# We compile these specially because they're Flex-generated and thus
# "warnings are errors" will fail because there's a bunch of
# warnings we can't eliminate.
#
diam_dict_lex.h: diam_dict.c
diam_dict.obj : diam_dict.c
	$(CC) $(GENERATED_CFLAGS) -Fd.\ -c $?

#
# This depends on dtd_grammar.h to force dtd_grammar.h to be
# built before we try to compile it, as dtd_parse.c includes
# dtd_grammar.h, and dtd_grammar.h is not distributed with
# the source (it's generated with Lemon).  That means we can't
# use $?, as that would make it try to compile dtd_grammar.h.
#
dtd_parse_lex.h: dtd_parse.c
dtd_parse.obj : dtd_grammar.h
dtd_parse.obj : dtd_parse.c
	$(CC) $(GENERATED_CFLAGS) -Fd.\ -c dtd_parse.c

dtd_preparse_lex.h: dtd_preparse.c
dtd_preparse.obj : dtd_preparse.c
	$(CC) $(GENERATED_CFLAGS) -Fd.\ -c $?

radius_dict_lex.h: radius_dict.c
radius_dict.obj : radius_dict.c
	$(CC) $(GENERATED_CFLAGS) -Fd.\ -c $?

uat_load_lex.h: uat_load.c
uat_load.obj : uat_load.c
	$(CC) $(GENERATED_CFLAGS) -Fd.\ -c $?

LEMON=..\tools\lemon

dtd_grammar.h: dtd_grammar.c
dtd_grammar.c: $(LEMON)\lemon.exe $(LEMON)\lempar.c dtd_grammar.lemon
	$(LEMON)\lemon T=$(LEMON)\lempar.c dtd_grammar.lemon

#
# We compile these specially because they're test programs, not library
# routines, and thus they import stuff from the library rather than
# exporting stuff from the library.
#
exntest.obj: exntest.c
	$(CC) $(TEST_CFLAGS) -Fd.\ -c $?

reassemble_test.obj: reassemble_test.c
	$(CC) $(TEST_CFLAGS) -Fd.\ -c $?

tvbtest.obj: tvbtest.c
	$(CC) $(TEST_CFLAGS) -Fd.\ -c $?

oids_test.obj: oids_test.c
	$(CC) $(TEST_CFLAGS) -Fd.\ -c $?

ps.c: ..\tools\rdps.py print.ps
	$(PYTHON) ..\tools\rdps.py print.ps ps.c

checkapi:
	$(PERL) ../tools/checkAPIs.pl -g termoutput -build $(LIBWIRESHARK_SRC)

#
# Editor modelines  -  https://www.wireshark.org/tools/modelines.html
#
# Local variables:
# c-basic-offset: 8
# tab-width: 8
# indent-tabs-mode: t
# End:
#
# vi: set shiftwidth=8 tabstop=8 noexpandtab:
# :indentSize=8:tabSize=8:noTabs=false:
#