f8f4940a854834f9261920328eaaf427ea7bdd70
[obnox/wireshark/wip.git] / epan / dissectors / Makefile.nmake
1 ## Makefile for building ethereal.exe with Microsoft C and nmake
2 ## Use: $(MAKE) /$(MAKEFLAGS) -f makefile.nmake
3 #
4 # $Id$
5
6 include ..\..\config.nmake
7
8 ############### no need to modify below this line #########
9
10 include Makefile.common
11
12 CFLAGS=-DHAVE_CONFIG_H /I. /I.. /I../.. $(GLIB_CFLAGS) \
13         /I$(NET_SNMP_DIR)\include /I$(NET_SNMP_DIR)\win32 \
14         $(PCRE_CFLAGS) $(GNUTLS_CFLAGS) $(NETTLE_CFLAGS) \
15         /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
16
17 CVARSDLL=-DWIN32 -DNULL=0 -D_MT -D_DLL 
18
19 .c.obj::
20    $(CC) $(CVARSDLL) $(CFLAGS) -Fd.\ -c $<
21
22 DISSECTOR_OBJECTS = $(DISSECTOR_SRC:.c=.obj)
23
24 DISSECTOR_SUPPORT_OBJECTS = $(DISSECTOR_SUPPORT_SRC:.c=.obj)
25
26 dissectors.lib: register.obj packet-ncp2222.c $(GENERATED_HEADER_FILES) ../../config.h $(DISSECTOR_OBJECTS) $(DISSECTOR_SUPPORT_OBJECTS)
27         @echo Linking dissectors.lib
28         link /lib /out:dissectors.lib $(DISSECTOR_OBJECTS) $(DISSECTOR_SUPPORT_OBJECTS)
29
30 #
31 # The header files listed here are built from x11-fields using Perl;
32 # we declare a dependency here so that they get built.
33 #
34 packet-x11.obj  : packet-x11.c x11-declarations.h x11-register-info.h
35
36 #
37 # Build various header files for the X11 dissector.
38 #
39 x11-declarations.h x11-register-info.h: x11-fields process-x11-fields.pl
40         $(PERL) process-x11-fields.pl <x11-fields
41
42 #
43 # Build register.c, which contains a function register_all_protocols()
44 # that calls the register routines for all protocols and a function
45 # register_all_protocol_handoffs() that calls the handoff registration
46 # routines for all protocols.
47 #
48 # We do this by scanning through sources.  If that turns out to be too slow,
49 # maybe we could just require every .o file to have an register routine
50 # of a given name (packet-aarp.o -> proto_register_aarp, etc.).
51 #
52 # Formatting conventions:  The name of the proto_register_* routines an
53 # proto_reg_handoff_* routines must start in column zero, or must be
54 # preceded only by "void " starting in column zero, and must not be
55 # inside #if.
56 #
57 # DISSECTOR_SRC is assumed to have all the files that need to be scanned.
58 #
59 # For some unknown reason, having a big "for" loop in the Makefile
60 # to scan all the files doesn't work with some "make"s; they seem to
61 # pass only the first few names in the list to the shell, for some
62 # reason.
63 #
64 # Therefore, we have a script to generate the register.c file.
65 # The shell script runs slowly, as multiple greps and seds are run
66 # for each input file; this is especially slow on Windows.  Therefore,
67 # if Python is present (as indicated by PYTHON being defined), we run
68 # a faster Python script to do that work instead.
69 #
70 # The first argument is the directory in which the source files live.
71 # The second argument is "dissectors", to indicate that we should build
72 # a register.c file for libethereal.
73 # All subsequent arguments are the files to scan.
74 #
75 register.c: $(DISSECTOR_SRC)
76 !IFDEF PYTHON
77         @echo Making register.c (using python)
78         @$(PYTHON) ../../tools/make-dissector-reg.py . dissectors $(DISSECTOR_SRC)
79 !ELSE
80         @echo Making register.c (using sh)
81         @$(SH) ../../tools/make-dissector-reg . dissectors $(DISSECTOR_SRC)
82 !ENDIF
83
84 packet-ncp2222.c : ncp2222.py
85 !IFDEF PYTHON
86         @echo Making packet-ncp2222.c
87         $(PYTHON) ncp2222.py -o packet-ncp2222.c
88 !ELSE
89         @echo Faking packet-ncp2222.c...
90         @echo Python is required to build the NCP disector
91         @echo Hiding packet-ncp.c...
92         mv packet-ncp.c packet-ncp.c.save
93         touch packet-ncp.c $@
94 !ENDIF
95
96 clean:
97         rm -f dissectors.lib $(PDB_FILE) \
98                 $(DISSECTOR_OBJECTS) $(DISSECTOR_SUPPORT_OBJECTS)
99
100 distclean: clean
101
102 maintainer-clean: distclean
103         rm -f $(GENERATED_FILES)