dae50a16c26dd8fdc261b58e24581ac3070181cd
[jelmer/wireshark.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 CFLAGS=-WX -DHAVE_CONFIG_H /I. /I.. /I../wiretap $(GLIB_CFLAGS) \
15         $(ZLIB_CFLAGS) $(ADNS_CFLAGS) $(PCRE_CFLAGS) $(GNUTLS_CFLAGS) /I$(PCAP_DIR)\include \
16         -D_U_="" $(LOCAL_CFLAGS)
17
18 CVARSDLL=-DWIN32 -DNULL=0 -D_MT -D_DLL
19
20 !IFDEF LUA_DIR
21 WSLUA_LIB=wslua\wslua.lib
22 WSLUA_DIR=wslua
23 !ELSE
24 WSLUA_LIB=
25 WSLUA_DIR=
26 !ENDIf
27
28 # For use when making libwireshark.dll
29 libwireshark_LIBS = \
30         $(GLIB_LIBS)    \
31         $(ADNS_LIBS) \
32         $(PCRE_LIBS) \
33         $(KFW_LIBS) \
34         $(NETTLE_LIBS) \
35         $(ZLIB_LIBS) \
36         $(GNUTLS_LIBS) \
37         $(NET_SNMP_LIBS) \
38         $(LUA_LIBS) \
39         ..\wiretap\wiretap-$(WTAP_VERSION).lib \
40         $(ICONV_DIR)\lib\iconv.lib \
41         crypt\airpdcap.lib \
42         ftypes\ftypes.lib \
43         dfilter\dfilter.lib \
44         $(WSLUA_LIB) \
45         dissectors\dissectors.lib
46
47 .c.obj::
48         $(CC) $(CVARSDLL) $(CFLAGS) -Fd.\ -c $<
49
50 LIBWIRESHARK_OBJECTS = $(LIBWIRESHARK_ALL_SRC:.c=.obj)
51
52 EXTRA_OBJECTS = \
53 #       strerror.obj    \
54         inet_aton.obj   \
55         inet_pton.obj   \
56         inet_ntop.obj   \
57         mkstemp.obj     \
58         strptime.obj
59
60
61 !IFDEF DOXYGEN
62 DOXYGEN_DEP=doxygen
63 !ENDIF
64
65 !IFDEF ENABLE_LIBWIRESHARK
66 all: crypt ftypes dfilter $(WSLUA_DIR) dissectors libwireshark.dll
67 !ELSE
68 all: crypt ftypes dfilter $(WSLUA_DIR) dissectors libwireshark.lib
69 !ENDIF
70
71 # For use when making libwireshark.dll
72 libwireshark.lib: libwireshark.dll
73 libwireshark.exp: libwireshark.dll
74
75 libwireshark.dll: ..\config.h $(LIBWIRESHARK_OBJECTS) libwireshark.def crypt ftypes dfilter $(WSLUA_DIR) dissectors $(DOXYGEN_DEP) $(EXTRA_OBJECTS) \
76                  crypt\airpdcap.lib ftypes\ftypes.lib dfilter\dfilter.lib dissectors\dissectors.lib $(WSLUA_LIB) ..\image\libwireshark.res
77         @echo Linking libwireshark.dll
78         $(link) $(dlllflags) $(conlibsdll) shell32.lib \
79                 $(LOCAL_LDFLAGS) \
80                 /DEF:libwireshark.def /OUT:libwireshark.dll \
81                 /IMPLIB:libwireshark.lib $(LIBWIRESHARK_OBJECTS) \
82                 $(libwireshark_LIBS) ..\image\libwireshark.res \
83                 dissectors\register.obj \
84                 $(EXTRA_OBJECTS)
85 !IF "$(MSVC_VARIANT)" == "MSVC2005" || "$(MSVC_VARIANT)" == "MSVC2005EE" || "$(MSVC_VARIANT)" == "DOTNET20" 
86         mt.exe -nologo -manifest "libwireshark.dll.manifest" -outputresource:libwireshark.dll;2
87 !ENDIF
88
89
90 libwireshark.lib        : ..\config.h $(LIBWIRESHARK_OBJECTS) crypt ftypes dfilter $(WSLUA_DIR) dissectors $(DOXYGEN_DEP) $(EXTRA_OBJECTS) \
91                   crypt\airpdcap.lib ftypes\ftypes.lib dfilter\dfilter.lib $(WSLUA_LIB) dissectors\dissectors.lib
92         link /lib /out:libwireshark.lib $(LIBWIRESHARK_OBJECTS) \
93                 $(EXTRA_OBJECTS)
94
95 ..\config.h     : ..\config.h.win32 ..\config.nmake
96         cd ..
97         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake config.h
98         cd epan
99
100 clean:
101         rm -f $(LIBWIRESHARK_OBJECTS) $(EXTRA_OBJECTS) \
102                 libwireshark.lib libwireshark.dll libwireshark.dll.manifest libwireshark.exp libwireshark.pdb \
103                 vc60.pdb vc80.pdb doxygen.cfg html/*.* \
104                 exntest.obj exntest.exe reassemble_test.obj reassemble_test.exe tvbtest.obj tvbtest.exe
105
106         if exist html rmdir html        
107         cd crypt
108         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
109         cd ../ftypes
110         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
111         cd ../dfilter
112         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
113         cd ../dissectors
114         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
115         cd ../wslua
116         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
117         cd ..
118
119 #
120 # We remove the Flex-generated files with "distclean" because they need
121 # different #includes for UN*X and Windows (UN*X versions of Flex make it
122 # include <unistd.h>, but that's a UN*X-only header), so if you're going
123 # to build from source, you need to build those scanners from the
124 # corresponding ".l" files with Flex.
125 # This might not be necessary for "dtd_grammar.{c,h}", but we handle them
126 # the same for now.
127 #
128 distclean: clean
129         rm -f config.h register.c mkstemp.c strptime.c \
130                 inet_ntop.c inet_pton.c \
131                 $(LIBWIRESHARK_DISTCLEAN_GENERATED_SRC) \
132                 $(LIBWIRESHARK_NODISTCLEAN_GENERATED_SRC) \
133                 dtd_grammar.out dtd_grammar.h sminmpec.c 
134         cd crypt
135         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
136         cd ../ftypes
137         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
138         cd ../dfilter
139         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
140         cd ../dissectors
141         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
142         cd ../wslua
143         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
144         cd ..
145
146 maintainer-clean: distclean
147         cd crypt
148         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
149         cd ../ftypes
150         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
151         cd ../dfilter
152         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
153         cd ../dissectors
154         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
155         cd ../wslua
156         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
157         cd ..
158
159 crypt:: ..\config.h
160         cd crypt
161         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
162         cd ..
163
164 ftypes:: ..\config.h
165         cd ftypes
166         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
167         cd ..
168
169 dfilter:: ..\config.h
170         cd dfilter
171         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
172         cd ..
173
174 dissectors:: ..\config.h
175         cd dissectors
176         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
177         cd ..
178
179 wslua:: ..\config.h
180         cd wslua
181         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
182         cd ..
183
184 doxygen.cfg: ..\config.nmake doxygen.cfg.in
185         sed -e s/@VERSION@/$(VERSION)/ \
186             < doxygen.cfg.in > $@
187
188 doxygen-run:
189 !IFDEF DOXYGEN
190         $(DOXYGEN) doxygen.cfg
191 !ENDIF
192
193 doxygen: doxygen.cfg doxygen-run
194
195 # Rules for making unit tests
196 exntest: exntest.exe
197 reassemble_test: reassemble_test.exe
198 tvbtest: tvbtest.exe
199
200
201
202 exntest.exe: exntest.obj except.obj
203         @echo Linking $@
204         $(LINK) /OUT:$@ $(conflags) $(conlibsdll) $(LOCAL_LDFLAGS) /LARGEADDRESSAWARE /SUBSYSTEM:console \
205                 $(GLIB_LIBS) exntest.obj except.obj
206 !IF "$(MSVC_VARIANT)" == "MSVC2005" || "$(MSVC_VARIANT)" == "MSVC2005EE" || "$(MSVC_VARIANT)" == "DOTNET20" 
207         mt.exe -nologo -manifest "$@.manifest" -outputresource:$@;1
208 !ENDIF
209
210 tvbtest.exe: tvbtest.obj tvbuff.obj except.obj strutil.obj emem.obj
211         @echo Linking $@
212         $(LINK) /OUT:$@ $(conflags) $(conlibsdll) $(LOCAL_LDFLAGS) /LARGEADDRESSAWARE /SUBSYSTEM:console \
213                 $(GLIB_LIBS) $(ZLIB_LIBS) tvbtest.obj tvbuff.obj except.obj strutil.obj emem.obj
214 !IF "$(MSVC_VARIANT)" == "MSVC2005" || "$(MSVC_VARIANT)" == "MSVC2005EE" || "$(MSVC_VARIANT)" == "DOTNET20" 
215         mt.exe -nologo -manifest "$@.manifest" -outputresource:$@;1
216 !ENDIF
217
218 reassemble_test.exe: reassemble_test.obj tvbuff.obj except.obj strutil.obj emem.obj \
219                  reassemble.obj
220         @echo Linking $@
221         $(LINK) /OUT:$@ $(conflags) $(conlibsdll) $(LOCAL_LDFLAGS) /LARGEADDRESSAWARE /SUBSYSTEM:console \
222                 $(GLIB_LIBS) $(ZLIB_LIBS) reassemble_test.obj tvbuff.obj \
223                 except.obj strutil.obj emem.obj reassemble.obj
224 !IF "$(MSVC_VARIANT)" == "MSVC2005" || "$(MSVC_VARIANT)" == "MSVC2005EE" || "$(MSVC_VARIANT)" == "DOTNET20" 
225         mt.exe -nologo -manifest "$@.manifest" -outputresource:$@;1
226 !ENDIF
227
228 exntest_install:
229         set copycmd=/y
230         if exist exntest.exe          xcopy exntest.exe          $(INSTALL_DIR) /d
231
232 tvbtest_install:
233         set copycmd=/y
234         if exist tvbtest.exe          xcopy tvbtest.exe          $(INSTALL_DIR) /d
235
236 reassemble_test_install:
237         set copycmd=/y
238         if exist reassemble_test.exe          xcopy reassemble_test.exe          $(INSTALL_DIR) /d
239
240
241 # (Windows only) Copy some sources from /trunk to /trunk/epan.
242 # It is a cleaner to compile these sources seperately with this makefile than
243 # using the object code compiled by the makefile in /trunk for both dynamically
244 # and statically linking
245
246 mkstemp.c: ..\mkstemp.c
247         xcopy ..\mkstemp.c . /d
248
249 strptime.c: ..\strptime.c
250         xcopy ..\strptime.c . /d
251
252 inet_ntop.c: ..\inet_ntop.c
253         xcopy ..\inet_ntop.c . /d
254
255 inet_pton.c: ..\inet_pton.c
256         xcopy ..\inet_pton.c . /d
257
258 sminmpec.c: enterprise-numbers make-sminmpec.pl
259         $(PERL) make-sminmpec.pl enterprise-numbers sminmpec.c
260
261 dtd_grammar.h: dtd_grammar.c
262
263 radius_dict.obj : radius_dict.c
264
265 diam_dict.obj : diam_dict.c
266
267 dtd_parse.obj : dtd_parse.c
268
269 dtd_preparse.obj : dtd_preparse.c
270
271 uat_load.obj : uat_load.c
272
273 LEMON=..\tools\lemon
274
275 dtd_grammar.c: dtd_grammar.lemon $(LEMON)\lemon.exe
276         $(LEMON)\lemon t=$(LEMON)\lempar.c dtd_grammar.lemon
277