function install_cpp_make {
# $1: dir to install
+
+ # find makefile
+ if [ -f /usr/share/mbuild/cpp.make ]
+ then
+ makefile=/usr/share/mbuild/cpp.make
+ elif [ -f $cwd/projects/tools/make/cpp.make ]
+ then
+ makefile=$cwd/projects/tools/make/cpp.make
+ else
+ echo "cannot find cpp makefile." >&2
+ exit 1
+ fi
src=$(pwd);
pushd $1
if [ -f makefile ]; then rm makefile; fi
if [ -L makefile ]; then rm makefile; fi
if [ -f make.post ]; then rm make.post; fi
- ln -s $cwd/projects/tools/make/cpp.make makefile
+ ln -s $makefile makefile
echo "SOURCE = \\" > make.pre
for file in $(ls *.cpp)
do
echo "$3:" >> $1/make.post
echo " cd $src/$2 && make TARGET=$3" >> $1/make.post
echo "" >> $1/make.post
+
+ # check for shared library
+ if [ "${3##*.}" == "so" ]
+ then
+ echo "CXXFLAGS += -fPIC" >> $2/make.pre
+ fi
}
function add_include {
echo " cd $src/$2 && make TARGET=$3" >> $1/make.post
echo " ln -sf $src/$2/$3 ." >> $1/make.post
echo "" >> $1/make.post
+
+ # check for shared library
+ if [ "${3##*.}" == "so" ]
+ then
+ echo "CXXFLAGS += -fPIC" >> $2/make.pre
+ fi
+
}