2
# Copyright (c) 2004-2010 Mellanox Technologies LTD. All rights reserved.
4
# This software is available to you under a choice of one of two
5
# licenses. You may choose to be licensed under the terms of the GNU
6
# General Public License (GPL) Version 2, available from the file
7
# COPYING in the main directory of this source tree, or the
8
# OpenIB.org BSD license below:
10
# Redistribution and use in source and binary forms, with or
11
# without modification, are permitted provided that the following
14
# - Redistributions of source code must retain the above
15
# copyright notice, this list of conditions and the following
18
# - Redistributions in binary form must reproduce the above
19
# copyright notice, this list of conditions and the following
20
# disclaimer in the documentation and/or other materials
21
# provided with the distribution.
23
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27
# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33
# we would like to export these headers during install
34
pkginclude_HEADERS = git_version.h Fabric.h RouteSys.h Bipartite.h \
35
SubnMgt.h TraceRoute.h CredLoops.h Regexp.h \
36
TopoMatch.h SysDef.h Congestion.h ibnl_parser.h ibdm.i
38
# ibdm shared library version triplet is:
39
# API_ID:API_VER:NUM_PREV_API_SUP = x:y:z
40
# * change of API_ID means new API
41
# * change of AGE means how many API backward compt
42
# * change of API_VER is required every version
43
# Results with SO version: x-z:z:y
44
LIB_VER_TRIPLET="2:1:1"
45
LIB_FILE_TRIPLET=1.1.1
49
# we are going to have here 3 targets:
50
# libibdmcom - common convinient library of objects
51
# libibdm - the TCL shared lib to be used as a package
52
# ibdmsh - the TCL shell
54
common_SOURCES = Fabric.cpp RouteSys.cc Bipartite.cc \
55
SubnMgt.cpp TraceRoute.cpp CredLoops.cpp TopoMatch.cpp SysDef.cpp \
56
LinkCover.cpp Congestion.cpp ibnl_parser.cc ibnl_scanner.cc FatTree.cpp
58
# Support debug mode through config variable
65
# We have a special mode where we know the package will be eventually moved
66
# to $with_final_prefix
68
IBNL_PATH=-DIBDM_IBNL_DIR='"$(with_final_prefix)/lib/ibdm$(VERSION)"'
70
IBNL_PATH=-DIBDM_IBNL_DIR='"$(libdir)/ibdm$(VERSION)"'
73
AM_CXXFLAGS = $(DBG) $(IBNL_PATH) $(TCL_CPPFLAGS)
74
AM_CFLAGS = $(DBG) $(IBNL_PATH) $(TCL_CFLAGS)
76
lib_LTLIBRARIES = libibdmcom.la libibdm.la
77
libibdmcom_la_SOURCES = $(common_SOURCES)
78
libibdmcom_la_LIBADD =
79
libibdmcom_la_LDFLAGS = -version-info $(LIB_VER_TRIPLET)
81
libibdm_la_SOURCES = ibdm_wrap.cpp ibdm.i $(common_SOURCES)
82
libibdm_la_LIBADD = $(TCL_LIBS)
83
libibdm_la_LDFLAGS = -Wl,-rpath -Wl,$(TCL_PREFIX)/lib -version-info $(LIB_VER_TRIPLET) -no-undefined
86
ibdmsh_SOURCES = ibdmsh_wrap.cpp
87
ibdmsh_LDADD = -libdmcom $(TCL_LIBS)
88
ibdmsh_LDFLAGS = -static -Wl,-rpath -Wl,$(TCL_PREFIX)/lib
89
ibdmsh_DEPENDENCIES=$(lib_LTLIBRARIES)
91
$(srcdir)/Fabric.cpp: $(srcdir)/git_version.h
93
# track latest GIT version for this tree:
94
GIT=$(shell which git)
96
$(srcdir)/git_version.h: @MAINTAINER_MODE_TRUE@ FORCE
97
if test x$(GIT) != x ; then \
98
gitver=`cd $(srcdir) ; git rev-parse --verify HEAD`; \
99
changes=`cd $(srcdir) ; git diff . | grep ^diff | wc -l`; \
101
gitver=undefined; changes=0; \
103
if test $$changes != 0; then gitver="$$gitver with-local-mods"; fi; \
104
echo "#define IBDM_CODE_VERSION \"$$gitver\"" > .git_version.h ;\
105
if test -f $(srcdir)/git_version.h ; then \
106
if test `diff .git_version.h $(srcdir)/git_version.h | wc -l` != 0; then \
107
mv -f .git_version.h $(srcdir)/git_version.h; \
108
echo "Updated code version to: $$gitver"; \
111
mv -f .git_version.h $(srcdir)/git_version.h; \
112
echo "Creates code version to: $$gitver"; \
117
# Workaound for libtool to use g++ for linking (verified as un-needed but JIC)
118
# CXXLINK = $(LIBTOOL) --tag=CXX --mode=link \
119
# $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
121
# only generate the swig wrappers if they do not exist...
122
# so we avoid un-needed swig dependency
124
$(srcdir)/ibdm_wrap.cpp: @MAINTAINER_MODE_TRUE@ $(srcdir)/ibdm.i
125
swig -c++ -dhtml -tcl8 -o swig_wrap.c $(srcdir)/ibdm.i
126
$(srcdir)/fixSwigWrapper -g -s -p -o $@
129
$(srcdir)/ibdmsh_wrap.cpp: @MAINTAINER_MODE_TRUE@ $(srcdir)/ibdm.i
130
swig -c++ -dhtml -tcl8 -ltclsh.i -o swig_wrap.c $(srcdir)/ibdm.i
131
$(srcdir)/fixSwigWrapper -g -s -p -r ibdm -o $@
136
rm -f $(srcdir)/ibdm_wrap.cpp $(srcdir)/ibdmsh_wrap.cpp *wrap.o
138
ibnl_parser.cc: @MAINTAINER_MODE_TRUE@ $(srcdir)/ibnl_parser.yy
139
$(srcdir)/../config/ylwrap $(srcdir)/ibnl_parser.yy \
140
y.tab.c ibnl_parser.cc \
141
y.tab.h ibnl_parser.h \
142
y.output ibnl_parser.output -- bison -y -d
143
if test ! ibnl_parser.cc -ef $(srcdir)/ibnl_parser.cc ; then cp ibnl_parser.cc $(srcdir)/ibnl_parser.cc ; fi
144
if test ! ibnl_parser.h -ef $(srcdir)/ibnl_parser.h ; then cp ibnl_parser.h $(srcdir)/ibnl_parser.h; fi
146
ibnl_scanner.cc: @MAINTAINER_MODE_TRUE@ $(srcdir)/ibnl_scanner.ll
147
$(srcdir)/../config/ylwrap $(srcdir)/ibnl_scanner.ll \
148
lex.yy.c ibnl_scanner.cc -- flex
149
if test ! ibnl_scanner.cc -ef $(srcdir)/ibnl_scanner.cc ; then cp ibnl_scanner.cc $(srcdir)/ibnl_scanner.cc; fi
151
# Don't distribute common.h, since it is build host dependent!
152
dist-hook: git_version.h
153
rm -f $(distdir)/common.h
155
# we need there extra in the distribution as their dependency is not defined
156
EXTRA_DIST = swig_alternate_mangling.cpp fixSwigWrapper pkgIndex.tcl ibdm.i
158
# this actually over write the lib install
159
install-exec-am: install-binPROGRAMS
160
mkdir -p $(DESTDIR)$(libdir)/ibdm$(VERSION)
161
cp .libs/$(shell grep dlname libibdm.la | sed 's/.*=\(.*\)/\1/') \
162
$(DESTDIR)$(libdir)/ibdm$(VERSION)/libibdm.so.$(VERSION)
163
sed 's/%VERSION%/'$(VERSION)'/g' $(srcdir)/pkgIndex.tcl > $(DESTDIR)$(libdir)/ibdm$(VERSION)/pkgIndex.tcl