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