Minor updates to debug output.
[obnox/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 # $Id$
5
6 include ..\config.nmake
7 include <win32.mak>
8 include ..\Makefile.nmake.inc
9
10 include Makefile.common
11
12 LINK= link
13
14 # We use GENERATED_CFLAGS to get around flex's non-LLP64-compliant output
15 GENERATED_CFLAGS=\
16         $(STANDARD_CFLAGS) \
17         /I. /I.. /I../wiretap $(GLIB_CFLAGS) \
18         $(ZLIB_CFLAGS) $(C_ARES_CFLAGS) $(ADNS_CFLAGS) \
19         $(LUA_CFLAGS) $(GNUTLS_CFLAGS) /I$(PCAP_DIR)\include \
20         $(PYTHON_CFLAGS) $(SMI_CFLAGS) $(GEOIP_CFLAGS)
21
22 CFLAGS=$(WARNINGS_ARE_ERRORS) $(GENERATED_CFLAGS)
23
24 !IFDEF LUA_DIR
25 WSLUA_LIB=wslua\wslua.lib
26 WSLUA_DIR=wslua
27 !ELSE
28 WSLUA_LIB=
29 WSLUA_DIR=
30 !ENDIf
31
32 !IFDEF PYTHON_DIR
33 WSPYTHON_LIB=wspython\wspython.lib
34 WSPYTHON_DIR=wspython
35 !ELSE
36 WSPYTHON_LIB=
37 WSPYTHON_DIR=
38 !ENDIf
39
40 # For use when making libwireshark.dll
41 libwireshark_LIBS = \
42         $(GLIB_LIBS)    \
43         $(C_ARES_LIBS) \
44         $(ADNS_LIBS) \
45         $(KFW_LIBS) \
46         $(NETTLE_LIBS) \
47         $(ZLIB_LIBS) \
48         $(GNUTLS_LIBS) \
49         $(LUA_LIBS) \
50         $(PYTHON_LIBS) \
51         $(SMI_LIBS) \
52         $(GEOIP_LIBS) \
53         ..\wsutil\libwsutil.lib \
54         ..\wiretap\wiretap-$(WTAP_VERSION).lib \
55         crypt\airpdcap.lib \
56         ftypes\ftypes.lib \
57         dfilter\dfilter.lib \
58         $(WSLUA_LIB) \
59         $(WSPYTHON_LIB) \
60         dissectors\dissectors.lib
61
62 .c.obj::
63         $(CC) $(CVARSDLL) $(CFLAGS) -Fd.\ -c $<
64
65 LIBWIRESHARK_OBJECTS = $(LIBWIRESHARK_ALL_SRC:.c=.obj)
66
67 EXTRA_OBJECTS = \
68 !IF defined(NASM) && "$(WIRESHARK_TARGET_PLATFORM)" == "win32"
69         asm_utils_win32_x86.obj
70 !ELSE
71         asm_utils.obj
72 !ENDIF
73
74 !IFDEF DOXYGEN
75 DOXYGEN_DEP=doxygen
76 !ENDIF
77
78 !IFDEF ENABLE_LIBWIRESHARK
79 all: crypt ftypes dfilter $(WSLUA_DIR) $(WSPYTHON_DIR) dissectors libwireshark.dll
80 !ELSE
81 all: crypt ftypes dfilter $(WSLUA_DIR) $(WSPYTHON_DIR) dissectors libwireshark.lib
82 !ENDIF
83
84 # For use when making libwireshark.dll
85 libwireshark.lib: libwireshark.dll
86 libwireshark.exp: libwireshark.dll
87
88 libwireshark.dll: ..\config.h $(LIBWIRESHARK_OBJECTS) libwireshark.def crypt ftypes dfilter $(WSLUA_DIR) $(WSPYTHON_DIR) dissectors $(DOXYGEN_DEP) $(EXTRA_OBJECTS) \
89                  crypt\airpdcap.lib ftypes\ftypes.lib dfilter\dfilter.lib dissectors\dissectors.lib $(WSLUA_LIB) $(WSPYTHON_LIB) ..\image\libwireshark.res
90         @echo Linking libwireshark.dll
91         $(link) $(dlllflags) $(conlibsdll) shell32.lib \
92                 $(LOCAL_LDFLAGS) $(DLL_LDFLAGS) \
93                 /DEF:libwireshark.def /OUT:libwireshark.dll \
94                 /IMPLIB:libwireshark.lib $(LIBWIRESHARK_OBJECTS) \
95                 $(libwireshark_LIBS) ..\image\libwireshark.res \
96                 dissectors\register.obj \
97                 $(EXTRA_OBJECTS)
98
99 libwireshark.lib        : ..\config.h $(LIBWIRESHARK_OBJECTS) crypt ftypes dfilter $(WSLUA_DIR) $(WSPYTHON_DIR) dissectors $(DOXYGEN_DEP) $(EXTRA_OBJECTS) \
100                   crypt\airpdcap.lib ftypes\ftypes.lib dfilter\dfilter.lib $(WSLUA_LIB) $(WSPYTHON_LIB) dissectors\dissectors.lib
101         link /lib /out:libwireshark.lib $(LIBWIRESHARK_OBJECTS) \
102                 $(EXTRA_OBJECTS)
103
104 ..\config.h     : ..\config.h.win32 ..\config.nmake
105         cd ..
106         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake config.h
107         cd epan
108
109 clean-local:
110         rm -f $(LIBWIRESHARK_OBJECTS) $(EXTRA_OBJECTS) \
111                 libwireshark.lib libwireshark.dll *.manifest libwireshark.exp \
112                 *.pdb *.sbr doxygen.cfg html/*.* \
113                 exntest.obj exntest.exe reassemble_test.obj reassemble_test.exe tvbtest.obj tvbtest.exe
114         if exist html rm -rf html
115
116 clean:  clean-local
117         cd crypt
118         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
119         cd ../ftypes
120         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
121         cd ../dfilter
122         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
123         cd ../dissectors
124         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
125         cd ../wslua
126         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
127         cd ../wspython
128         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
129         cd ..
130
131 #
132 # We remove the Flex-generated files with "distclean" because they need
133 # different #includes for UN*X and Windows (UN*X versions of Flex make it
134 # include <unistd.h>, but that's a UN*X-only header), so if you're going
135 # to build from source, you need to build those scanners from the
136 # corresponding ".l" files with Flex.
137 # This might not be necessary for "dtd_grammar.{c,h}", but we handle them
138 # the same for now.
139 #
140 distclean-local: clean-local
141         rm -f config.h register.c mkstemp.c \
142                 $(LIBWIRESHARK_DISTCLEAN_GENERATED_SRC) \
143                 $(LIBWIRESHARK_DISTCLEAN_GENERATED_INCLUDES) \
144                 $(LIBWIRESHARK_NODISTCLEAN_GENERATED_SRC) \
145                 $(LIBWIRESHARK_NODISTCLEAN_GENERATED_INCLUDES) \
146                 dtd_grammar.out sminmpec.c
147
148 distclean: distclean-local
149         cd crypt
150         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
151         cd ../ftypes
152         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
153         cd ../dfilter
154         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
155         cd ../dissectors
156         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
157         cd ../wslua
158         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
159         cd ../wspython
160         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
161         cd ..
162
163 maintainer-clean-local: distclean-local
164
165 maintainer-clean: maintainer-clean-local
166         cd crypt
167         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
168         cd ../ftypes
169         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
170         cd ../dfilter
171         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
172         cd ../dissectors
173         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
174         cd ../wslua
175         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
176         cd ../wspython
177         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
178         cd ..
179
180 crypt:: ..\config.h
181         cd crypt
182         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
183         cd ..
184
185 ftypes:: ..\config.h
186         cd ftypes
187         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
188         cd ..
189
190 dfilter:: ..\config.h
191         cd dfilter
192         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
193         cd ..
194
195 dissectors:: ..\config.h
196         cd dissectors
197         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
198         cd ..
199
200 wslua:: ..\config.h
201         cd wslua
202         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
203         cd ..
204
205 wspython:: ..\config.h
206         cd wspython
207         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
208         cd ..
209
210 doxygen.cfg: ..\config.nmake doxygen.cfg.in
211         sed -e s/@VERSION@/$(VERSION)/ \
212             < doxygen.cfg.in > $@
213
214 doxygen-run:
215 !IFDEF DOXYGEN
216         $(DOXYGEN) doxygen.cfg
217 !ENDIF
218
219 doxygen: doxygen.cfg doxygen-run
220
221 # Rules for making unit tests
222 exntest: exntest.exe
223 reassemble_test: reassemble_test.exe
224 tvbtest: tvbtest.exe
225
226 # Object files for exntest
227 EXNTEST_OBJ=exntest.obj except.obj
228
229 exntest.exe: $(EXNTEST_OBJ)
230         @echo Linking $@
231         $(LINK) /OUT:$@ $(conflags) $(conlibsdll) $(LOCAL_LDFLAGS) /LARGEADDRESSAWARE /SUBSYSTEM:console \
232                 $(GLIB_LIBS) $(EXNTEST_OBJ)
233 !IFDEF MANIFEST_INFO_REQUIRED
234         mt.exe -nologo -manifest "$@.manifest" -outputresource:$@;1
235 !ENDIF
236
237 # Object files for tvbtest
238 TVBTEST_OBJ=tvbtest.obj \
239         tvbuff.obj \
240         except.obj \
241         to_str.obj \
242         strutil.obj \
243         charsets.obj \
244         emem.obj
245
246 tvbtest.exe: $(TVBTEST_OBJ)
247         @echo Linking $@
248         $(LINK) /OUT:$@ $(conflags) $(conlibsdll) $(LOCAL_LDFLAGS) /LARGEADDRESSAWARE /SUBSYSTEM:console \
249                 $(GLIB_LIBS) $(ZLIB_LIBS) $(TVBTEST_OBJ)
250 !IFDEF MANIFEST_INFO_REQUIRED
251         mt.exe -nologo -manifest "$@.manifest" -outputresource:$@;1
252 !ENDIF
253
254 # Object files for reassemble_test
255 REASSEMBLE_TEST_OBJ=reassemble_test.obj \
256         tvbuff.obj \
257         except.obj \
258         to_str.obj \
259         strutil.obj \
260         charsets.obj \
261         emem.obj \
262         reassemble.obj
263
264 reassemble_test.exe: $(REASSEMBLE_TEST_OBJ)
265         @echo Linking $@
266         $(LINK) /OUT:$@ $(conflags) $(conlibsdll) $(LOCAL_LDFLAGS) /LARGEADDRESSAWARE /SUBSYSTEM:console \
267                 $(GLIB_LIBS) $(ZLIB_LIBS) $(REASSEMBLE_TEST_OBJ)
268 !IFDEF MANIFEST_INFO_REQUIRED
269         mt.exe -nologo -manifest "$@.manifest" -outputresource:$@;1
270 !ENDIF
271
272 exntest_install:
273         set copycmd=/y
274         if exist exntest.exe          xcopy exntest.exe          $(INSTALL_DIR) /d
275
276 tvbtest_install:
277         set copycmd=/y
278         if exist tvbtest.exe          xcopy tvbtest.exe          $(INSTALL_DIR) /d
279
280 reassemble_test_install:
281         set copycmd=/y
282         if exist reassemble_test.exe          xcopy reassemble_test.exe          $(INSTALL_DIR) /d
283
284
285 #
286 # Compile some time critical code from assembler if NASM available
287 #
288 !IFDEF NASM
289 asm_utils_win32_x86.obj: asm_utils_win32_x86.asm
290         $(NASM) -f $(WIRESHARK_TARGET_PLATFORM) -o $@ $?
291 !ENDIF
292
293 sminmpec.c: enterprise-numbers ..\tools\make-sminmpec.pl
294         $(PERL) ../tools/make-sminmpec.pl enterprise-numbers sminmpec.c
295
296 RUNLEX=..\tools\runlex.sh
297
298 diam_dict_lex.h: diam_dict.c
299 diam_dict.obj : diam_dict.c
300         $(CC) $(CVARSDLL) $(GENERATED_CFLAGS) -Fd.\ -c $?
301
302 dtd_parse_lex.h: dtd_parse.c
303 dtd_parse.obj : dtd_parse.c
304         $(CC) $(CVARSDLL) $(GENERATED_CFLAGS) -Fd.\ -c $?
305
306 dtd_preparse_lex.h: dtd_preparse.c
307 dtd_preparse.obj : dtd_preparse.c
308         $(CC) $(CVARSDLL) $(GENERATED_CFLAGS) -Fd.\ -c $?
309
310 radius_dict_lex.h: radius_dict.c
311 radius_dict.obj : radius_dict.c
312         $(CC) $(CVARSDLL) $(GENERATED_CFLAGS) -Fd.\ -c $?
313
314 uat_load_lex.h: uat_load.c
315 uat_load.obj : uat_load.c
316         $(CC) $(CVARSDLL) $(GENERATED_CFLAGS) -Fd.\ -c $?
317
318 LEMON=..\tools\lemon
319
320 dtd_grammar.h: dtd_grammar.c
321 dtd_grammar.c: $(LEMON)\lemon.exe $(LEMON)\lempar.c dtd_grammar.lemon
322         $(LEMON)\lemon t=$(LEMON)\lempar.c dtd_grammar.lemon
323
324 checkapi:
325         $(PERL) ../tools/checkAPIs.pl -g termoutput $(LIBWIRESHARK_SRC)