1 # Makefile to create the Lustre/LNet plugins for Wireshark.
2 # It is intended to be used by script `wsbuild´ that will buil
3 # a RPM for wireshark and a separate RPM for the Lustre/LNet plugins.
5 # All configuration should be performed with help of shell script
6 # `wsconfigs.sh' (see can-edit sections).
8 # When using as a stand-alone makefile, set the macros WS_HOME,
9 # PLUGIN_DIR and PLUGIN_COMPILE_FLAGS to the values associated with
10 # your wireshark installation.
11 # Alternatively modify `wsconfigs.sh´ accordingly to your wireshar
12 # installation, source wsconfigs.sh and build with help of:
18 # Minimum Wireshark Version - This should match the README file.
20 MIN_WIRESHARK_VERSION=1.6.8
22 # Installation directory of the Wireshark source code
23 # Note: Leave the macro undefined when using the wsbuild script.
28 # Installation directory for the (compiled) Wireshark plugins
29 # Change the value of the following macro to the installation directory
30 # of the Wireshark plugins for your installation
32 # Note: When using the cbuild script leave the macro undefined
33 # (default: /usr/lib/wireshark/plugins/$(WS_VERSION))
35 # For non-root and non-rpmbuilds you might want to set the value to ${HOME}/.wireshark/plugins
38 CFLAGS = -DINET6 -D_U_=__attribute__\(\(unused\)\) -Wall -Wpointer-arith -g -DXTHREADS -D_REENTRANT -DXUSE_MTSAFE_API -fPIC -DPIC
41 #INCS = $(shell echo "-I${WS_HOME} `pkg-config --libs --cflags glib-2.0`")
42 INCS = $(shell echo "-I${WS_HOME} $(PLUGIN_COMPILE_FLAGS)") -DHAVE_CONFIG_H
45 INCS = $(shell pkg-config --libs --cflags wireshark) $(shell echo "$(PLUGIN_COMPILE_FLAGS)") -DHAVE_CONFIG_H
46 WS_VERSION = $(shell pkg-config --modversion wireshark)
47 LIBDIR = $(shell pkg-config --variable=libdir wireshark)
48 CHECK=pkg-config --atleast-version=${MIN_WIRESHARK_VERSION} wireshark
53 SRCS_LNET = packet-lnet.c
54 SRCS_LUSTRE = packet-lustre.c
58 OBJS_LNET = $(foreach src, $(SRCS_LNET), $(src:.c=.o))
59 OBJS_LUSTRE = $(foreach src, $(SRCS_LUSTRE), $(src:.c=.o))
61 PLUGINS=lnet.so lustre.so
67 ifneq ($(shell id -u), 0)
69 PLUGIN_DIR = ${HOME}/.wireshark/plugins
76 $(error "WS_HOME not defined")
78 WS_CONFIG=$(WS_HOME)/config.h
79 WS_VERSION:=$(shell sed "s/^.define[[:space:]]*VERSION[[:space:]]*\"\(.*\)\"/\1/p;d" ${WS_CONFIG})
82 ifeq ($(shell if [ -r /etc/SuSE-release ] ; then echo 0; else echo 1; fi ), 0)
88 PLUGIN_DIR = $(DESTDIR)$(LIBDIR)/wireshark/plugins/$(WS_VERSION)
96 echo "Wireshark must be at least version ${MIN_WIRESHARK_VERSION} (installed ${WS_VERSION})";\
100 lustre.so: $(OBJS_LUSTRE)
101 $(CC) -shared $(OBJS_LUSTRE) -o $@
103 lnet.so: $(OBJS_LNET)
104 $(CC) -shared $(OBJS_LNET) -o $@
107 mkdir -p $(PLUGIN_DIR)
108 install $(PLUGINS) $(PLUGIN_DIR)/
111 @echo "Includes: "$(INCS)
112 @echo "Install Dir: "$(PLUGIN_DIR)
115 rm -f $(PLUGINS) $(OBJS_LNET) $(OBJS_LUSTRE)
118 (cd $(PLUGIN_DIR)/; rm -f $(PLUGINS))
120 .PHONEY: check help install extraclean clean all