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