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