Add *.sbr files to the clean target.
[obnox/wireshark/wip.git] / plugins / opcua / Makefile.nmake
1 # Makefile.nmake
2 # nmake file for Wireshark plugin
3 #
4 # $Id$
5 #
6
7 include ..\..\config.nmake
8 include moduleinfo.nmake
9
10 include Makefile.common
11
12 CFLAGS=$(WARNINGS_ARE_ERRORS) $(STANDARD_CFLAGS) \
13         /I../.. $(GLIB_CFLAGS) \
14         /I$(PCAP_DIR)\include
15
16 .c.obj::
17         $(CC) $(CFLAGS) -Fd.\ -c $<
18
19 LDFLAGS = $(PLUGIN_LDFLAGS)
20
21 !IFDEF ENABLE_LIBWIRESHARK
22 LINK_PLUGIN_WITH=..\..\epan\libwireshark.lib
23 CFLAGS=/D_NEED_VAR_IMPORT_ $(CFLAGS)
24
25 DISSECTOR_OBJECTS = $(DISSECTOR_SRC:.c=.obj)
26
27 DISSECTOR_SUPPORT_OBJECTS = $(DISSECTOR_SUPPORT_SRC:.c=.obj)
28
29 OBJECTS = $(DISSECTOR_OBJECTS) $(DISSECTOR_SUPPORT_OBJECTS) plugin.obj
30
31 RESOURCE=$(PLUGIN_NAME).res
32
33 all: $(PLUGIN_NAME).dll
34
35 $(PLUGIN_NAME).rc : moduleinfo.nmake
36         sed -e s/@PLUGIN_NAME@/$(PLUGIN_NAME)/ \
37         -e s/@RC_MODULE_VERSION@/$(RC_MODULE_VERSION)/ \
38         -e s/@RC_VERSION@/$(RC_VERSION)/ \
39         -e s/@MODULE_VERSION@/$(MODULE_VERSION)/ \
40         -e s/@PACKAGE@/$(PACKAGE)/ \
41         -e s/@VERSION@/$(VERSION)/ \
42         -e s/@MSVC_VARIANT@/$(MSVC_VARIANT)/ \
43         < plugin.rc.in > $@
44
45 $(PLUGIN_NAME).dll $(PLUGIN_NAME).exp $(PLUGIN_NAME).lib : $(OBJECTS) $(LINK_PLUGIN_WITH) $(RESOURCE)
46         link -dll /out:$(PLUGIN_NAME).dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \
47         $(GLIB_LIBS) $(RESOURCE)
48
49 #
50 # Build plugin.c, which contains the plugin version[] string, a
51 # function plugin_register() that calls the register routines for all
52 # protocols, and a function plugin_reg_handoff() that calls the handoff
53 # registration routines for all protocols.
54 #
55 # We do this by scanning sources.  If that turns out to be too slow,
56 # maybe we could just require every .o file to have an register routine
57 # of a given name (packet-aarp.o -> proto_register_aarp, etc.).
58 #
59 # Formatting conventions:  The name of the proto_register_* routines an
60 # proto_reg_handoff_* routines must start in column zero, or must be
61 # preceded only by "void " starting in column zero, and must not be
62 # inside #if.
63 #
64 # DISSECTOR_SRC is assumed to have all the files that need to be scanned.
65 #
66 # For some unknown reason, having a big "for" loop in the Makefile
67 # to scan all the files doesn't work with some "make"s; they seem to
68 # pass only the first few names in the list to the shell, for some
69 # reason.
70 #
71 # Therefore, we have a script to generate the plugin.c file.
72 # The shell script runs slowly, as multiple greps and seds are run
73 # for each input file; this is especially slow on Windows.  Therefore,
74 # if Python is present (as indicated by PYTHON being defined), we run
75 # a faster Python script to do that work instead.
76 #
77 # The first argument is the directory in which the source files live.
78 # The second argument is "plugin", to indicate that we should build
79 # a plugin.c file for a plugin.
80 # All subsequent arguments are the files to scan.
81 #
82 !IFDEF PYTHON
83 plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg.py
84         @echo Making plugin.c (using python)
85         @$(PYTHON) "../../tools/make-dissector-reg.py" . plugin $(DISSECTOR_SRC)
86 !ELSE
87 plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
88         @echo Making plugin.c (using sh)
89         @$(SH) ../../tools/make-dissector-reg . plugin $(DISSECTOR_SRC)
90 !ENDIF
91
92 !ENDIF
93
94 clean:
95         rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb *.sbr \
96             $(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
97             $(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
98
99 distclean: clean
100
101 maintainer-clean: distclean
102
103 checkapi:
104         $(PERL) ../../tools/checkAPIs.pl -g abort -g termoutput $(DISSECTOR_SRC) $(DISSECTOR_INCLUDES)