octsdr-2g-wireshark/application/tool/wireshark/plugins/octasic/MakeRules.nmake

155 lines
5.2 KiB
Plaintext

# Makefile.nmake
# nmake file for Wireshark plugin
#
# $Id: Makefile.nmake 24520 2008-03-01 12:31:01Z jake $
#
!IF "$(DEBUG)" == "1"
OUT_DIR=Debug_$(TGT_WS_VERSION)
!ELSE
OUT_DIR=Release_$(TGT_WS_VERSION)
!ENDIF
!IFNDEF WS_ROOT
WS_ROOT=../../..
!ENDIF
OUT_PATH=$(OUT_DIR)/
CFLAGS=/DHAVE_CONFIG_H /I$(WIRESHARK_LIBS)/../ $(GLIB_CFLAGS) \
/I $(WS_ROOT)/$(TGT_WS_VERSION)/ \
/I$(OCT_INC) \
/I$(OCT_INC)/octpkt \
!IF EXIST("$(OCT_INC)/octcodec")
/I$(OCT_INC)/octcodec \
!ENDIF
!IF EXIST("$(OCT_INC)/octvc1")
/I$(OCT_INC)/octvc1 \
!ELSEIF EXIST("$(OCT_INC)/vocallo")
/I$(OCT_INC)/vocallo \
!ENDIF
!IF EXIST("$(OCT_INC)/../octmfa_api/include")
/I$(OCT_INC)/../octmfa_api/include \
!ENDIF
/I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
LDFLAGS = $(PLUGIN_LDFLAGS)
!IFDEF ENABLE_LIBWIRESHARK
LINK_PLUGIN_WITH=$(WIRESHARK_LIBS)/../epan/libwireshark.lib
CFLAGS=/DHAVE_WIN32_LIBWIRESHARK_LIB /D_NEED_VAR_IMPORT_ $(CFLAGS)
!ENDIF
{$(SRC_PATH)}.c{$(OUT_PATH)}.obj::
@$(CC) $(CFLAGS) -Fd$(OUT_PATH) -Fo$(OUT_PATH) -c $<
!IFNDEF DISSECTOR_OBJ_PATH
!IF "$(DEBUG)" == "1"
DISSECTOR_OBJ_PATH = $(DISSECTOR_SRC:source=Debug)
#!ELSE
DISSECTOR_OBJ_PATH = $(DISSECTOR_SRC:source=Release)
!ENDIF
!ENDIF
DISSECTOR_OBJECTS = $(DISSECTOR_OBJ_PATH:.c=.obj)
DISSECTOR_SUPPORT_OBJECTS = $(DISSECTOR_SUPPORT_SRC:.c=.obj)
DLL_NAME=$(PLUGIN_NAME)
OBJECTS = $(DISSECTOR_OBJECTS) $(DISSECTOR_SUPPORT_OBJECTS) $(OUT_PATH)plugin.obj
RESOURCE=$(OUT_PATH)$(PLUGIN_NAME).res
WIRESHARK_PLUGING_DEST_EXIST = 0
!IF EXIST( "$(WIRESHARK_PLUGING_DEST)")
WIRESHARK_PLUGING_DEST_EXIST = 1
!ENDIF
!if defined( NO_TGT_VERSION )
LOCAL_CFLAGS=/DNO_TGT_VERSION=$(NO_TGT_VERSION) $(LOCAL_CFLAGS)
!endif
all: $(OUT_PATH)$(DLL_NAME).dll
$(OUT_DIR) :
@if not exist "$(OUT_DIR)/$(NULL)" mkdir "$(OUT_DIR)"
$(OUT_PATH)$(PLUGIN_NAME).rc :
-@sed -e s/@PLUGIN_NAME@/$(PLUGIN_NAME)/ \
-e s/@RC_MODULE_VERSION@/$(RC_MODULE_VERSION)/ \
-e s/@RC_VERSION@/$(RC_VERSION)/ \
-e s/@MODULE_VERSION@/$(MODULE_VERSION)/ \
-e s/@PACKAGE@/$(PACKAGE)/ \
-e s/@VERSION@/$(VERSION)/ \
-e s/@INTERNAL_NAME@/$(RC_INTERNAL_NAME)/ \
-e s/@MSVC_VARIANT@/$(MSVC_VARIANT)/ \
< $(WS_ROOT)\plugins\octasic\plugin.rc.in > $@
# @copy source\$(PLUGIN_NAME).rc $(OUT_DIR)\$(PLUGIN_NAME).rc
$(OUT_PATH)$(DLL_NAME).dll $(OUT_PATH)$(PLUGIN_NAME).exp $(OUT_PATH)$(DLL_NAME).lib : $(OUT_DIR) $(OBJECTS) $(LINK_PLUGIN_WITH) $(RESOURCE)
@link -dll /out:$(OUT_PATH)$(DLL_NAME).dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \
$(GLIB_LIBS) $(RESOURCE)
#
# Build plugin.c, which contains the plugin version[] string, a
# function plugin_register() that calls the register routines for all
# protocols, and a function plugin_reg_handoff() that calls the handoff
# registration routines for all protocols.
#
# We do this by scanning sources. If that turns out to be too slow,
# maybe we could just require every .o file to have an register routine
# of a given name (packet-aarp.o -> proto_register_aarp, etc.).
#
# Formatting conventions: The name of the proto_register_* routines an
# proto_reg_handoff_* routines must start in column zero, or must be
# preceded only by "void " starting in column zero, and must not be
# inside #if.
#
# DISSECTOR_SRC is assumed to have all the files that need to be scanned.
#
# For some unknown reason, having a big "for" loop in the Makefile
# to scan all the files doesn't work with some "make"s; they seem to
# pass only the first few names in the list to the shell, for some
# reason.
#
# Therefore, we have a script to generate the plugin.c file.
# The shell script runs slowly, as multiple greps and seds are run
# for each input file; this is especially slow on Windows. Therefore,
# if Python is present (as indicated by PYTHON being defined), we run
# a faster Python script to do that work instead.
#
# The first argument is the directory in which the source files live.
# The second argument is "plugin", to indicate that we should build
# a plugin.c file for a plugin.
# All subsequent arguments are the files to scan.
#
#!IFDEF PYTHON
#plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg.py
# @echo Making plugin.c (using python)
# @$(PYTHON) "../../tools/make-dissector-reg.py" . plugin $(DISSECTOR_SRC)
#!ELSE
#plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
# @echo Making plugin.c (using sh)
# @$(SH) ../../tools/make-dissector-reg . plugin $(DISSECTOR_SRC)
#!ENDIF
clean:
-@ erase /Q "$(OUT_PATH)\*.*"
install:
! IF $(WIRESHARK_PLUGING_DEST_EXIST)==0
! MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++++++++++
! MESSAGE Pluging path "$(WIRESHARK_PLUGING_DEST)" does not exist
! MESSAGE Please install WIRESHARK VERSION $(WIRESHARK_RELEASE)
! MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++++++++++
! ERROR
! ELSE
@del "$(WIRESHARK_PLUGING_DEST)\$(PLUGIN_NAME)*.dll"
@xcopy /Q $(OUT_DIR)\$(DLL_NAME).dll "$(WIRESHARK_PLUGING_DEST)" /Y
! ENDIF
package:
@cd ../packaging/nsis
@$(MAKENSIS) /DVER_MAJOR=$(MODULE_VERSION_MAJOR) /DVER_MINOR=$(MODULE_VERSION_MINOR) /DVER_REVISION=$(MODULE_VERSION_MICRO) /DVER_BUILD=$(MODULE_VERSION_EXTRA) /DTGT_VERSION=$(TGT_VERSION) /DTGT_WS_VERSION=$(TGT_WS_VERSION) octvoc_ws.nsi
@cd $(MAKEDIR)