regex makefile updates: better responce to environment variables, and correct linker options for gcc-shared.mak

[SVN r9393]
This commit is contained in:
John Maddock
2001-03-03 11:31:04 +00:00
parent ee8c9873bc
commit 833740c25b
10 changed files with 743 additions and 534 deletions

View File

@ -46,7 +46,7 @@ EOF
obj="$subdir/$libname/$obj"
all_obj="$all_obj $obj"
echo "$obj: $file \$(ALL_HEADER)" >> $tout
echo " cl $opts \$(XCFLAGS) -Fp$subdir/$libname/$libname.pch -Fo./$subdir/$libname/ -Fd$subdir/$libname.pdb $file" >> $tout
echo " cl \$(INCLUDES) $opts \$(CXXFLAGS) -Fp$subdir/$libname/$libname.pch -Fo./$subdir/$libname/ -Fd$subdir/$libname.pdb $file" >> $tout
echo "" >> $tout
done
#
@ -96,7 +96,7 @@ EOF
obj="$subdir/$libname/$obj"
all_obj="$all_obj $obj"
echo "$obj: $file \$(ALL_HEADER)" >> $tout
echo " cl $opts \$(XCFLAGS) -Fp$subdir/$libname/$libname.pch -Fo./$subdir/$libname/ -Fd$subdir/$libname.pdb $file" >> $tout
echo " cl \$(INCLUDES) $opts \$(CXXFLAGS) -Fp$subdir/$libname/$libname.pch -Fo./$subdir/$libname/ -Fd$subdir/$libname.pdb $file" >> $tout
echo "" >> $tout
done
#
@ -195,7 +195,11 @@ function vc6_gen()
#
# Add additional compiler options here:
#
XCFLAGS=
CXXFLAGS=
#
# Add additional include directories here:
#
INCLUDES=
#
# add additional linker flags here:
#
@ -240,10 +244,12 @@ gcc_shared="no"
function gcc_gen_lib()
{
if test "$gcc_shared" == "yes"; then
all_dep="$all_dep $subdir $subdir/$libname ./$subdir/lib$libname.so"
if test "$gcc_shared" == "yes"; then
obj_dir="$libname""_shared"
all_dep="$all_dep $subdir $subdir/$obj_dir ./$subdir/lib$libname.so"
else
all_dep="$all_dep $subdir $subdir/$libname ./$subdir/lib$libname.a"
obj_dir="$libname"
all_dep="$all_dep $subdir $subdir/$obj_dir ./$subdir/lib$libname.a"
fi
#
# set up section comments:
@ -260,31 +266,31 @@ EOF
for file in $src
do
obj=`echo "$file" | sed 's/.*src\/\(.*\)cpp/\1o/g'`
obj="$subdir/$libname/$obj"
obj="$subdir/$obj_dir/$obj"
all_obj="$all_obj $obj"
echo "$obj: $file \$(ALL_HEADER)" >> $tout
echo " g++ -o $obj $opts \$(XCFLAGS) $file" >> $tout
echo " \$(CXX) \$(INCLUDES) -o $obj $opts \$(CXXFLAGS) $file" >> $tout
echo "" >> $tout
done
#
# now for the directories for this library:
echo "$subdir/$libname : " >> $tout
echo " mkdir -p $subdir/$libname" >> $tout
echo "$subdir/$obj_dir : " >> $tout
echo " mkdir -p $subdir/$obj_dir" >> $tout
echo "" >> $tout
#
# now for the clean options for this library:
all_clean="$all_clean $libname""_clean"
echo "$libname"_clean : >> $tout
echo " rm -f $subdir/$libname/*.o" >> $tout
echo " rm -f $subdir/$obj_dir/*.o" >> $tout
echo "" >> $tout
#
# now for the main target for this library:
if test "$gcc_shared" == "yes"; then
echo ./$subdir/lib$libname.so : $all_obj >> $tout
echo " \$(LINKER) \$(LINK) -o $subdir/lib$libname.so $all_obj" >> $tout
echo " \$(LINKER) -o $subdir/lib$libname.so \$(LDFLAGS) $all_obj \$(LIBS)" >> $tout
else
echo ./$subdir/lib$libname.a : $all_obj >> $tout
echo " ar -r \$(LINK) $subdir/lib$libname.a $all_obj" >> $tout
echo " ar -r $subdir/lib$libname.a $all_obj" >> $tout
fi
echo "" >> $tout
}
@ -301,10 +307,10 @@ function gcc_gen()
echo > $tout
echo > $iout
libname="regex++"
libname="boost_regex"
opts="\$(C1)"
gcc_gen_lib
libname="regex++debug"
libname="boost_regex_debug"
opts="\$(C2)"
gcc_gen_lib
@ -320,6 +326,17 @@ function gcc_gen()
# deletes temporary object files (but not archives).
#
#
# the following environment variables are recognised:
# CXXFLAGS= extra compiler options - note applies to all build variants
# INCLUDES= additional include directories
# LDFLAGS= additional linker options
# LIBS= additional library files
# compiler:
CXX=g++
LINKER=g++ -shared
#
# compiler options for release build:
#
@ -328,9 +345,6 @@ C1=-c -O2 -I../../../
# compiler options for debug build:
#
C2=-c -g -I../../../
#
# compiler options for link:
LINK=
EOF
@ -362,10 +376,10 @@ function gcc_gen_shared()
echo > $tout
echo > $iout
libname="regex++"
libname="boost_regex"
opts="\$(C1)"
gcc_gen_lib
libname="regex++debug"
libname="boost_regex_debug"
opts="\$(C2)"
gcc_gen_lib
@ -381,6 +395,17 @@ function gcc_gen_shared()
# deletes temporary object files (but not archives).
#
#
# the following environment variables are recognised:
# CXXFLAGS= extra compiler options - note applies to all build variants
# INCLUDES= additional include directories
# LDFLAGS= additional linker options
# LIBS= additional library files
# compiler:
CXX=g++
LINKER=g++ -shared
#
# compiler options for release build:
#
@ -389,13 +414,6 @@ C1=-c -O2 -I../../../ -fPIC
# compiler options for debug build:
#
C2=-c -g -I../../../ -fPIC
#
# compiler options for link:
LINK=-shared
#
# Linker to use:
LINKER=ld
EOF
echo "" >> $out
@ -445,7 +463,7 @@ EOF
all_lib_obj="$all_lib_obj +$obj"
echo "$obj: $file \$(ALL_HEADER)" >> $tout
echo " bcc32 @&&|" >> $tout
echo "-c \$(XCFLAGS) $opts \$(XCFLAGS) -o$obj $file" >> $tout
echo "-c \$(INCLUDES) $opts \$(CXXFLAGS) -o$obj $file" >> $tout
echo "|" >> $tout
echo "" >> $tout
done
@ -496,7 +514,7 @@ EOF
all_obj="$all_obj $obj"
echo "$obj: $file \$(ALL_HEADER)" >> $tout
echo " bcc32 @&&|" >> $tout
echo "-c \$(XCFLAGS) $opts \$(XCFLAGS) -o$obj $file" >> $tout
echo "-c \$(INCLUDES) $opts \$(CXXFLAGS) -o$obj $file" >> $tout
echo "|" >> $tout
echo "" >> $tout
done
@ -519,7 +537,7 @@ EOF
# now for the main target for this library:
echo $subdir\\$libname.lib : $all_obj >> $tout
echo " bcc32 @&&|" >> $tout
echo "$opts -e$subdir\\$libname.dll $all_obj \$(XLFLAGS)" >> $tout
echo "$opts -e$subdir\\$libname.dll \$(XLFLAGS) $all_obj \$(LIBS)" >> $tout
echo "|" >> $tout
echo " implib -c $subdir\\$libname.lib $subdir\\$libname.dll" >> $tout
echo "" >> $tout
@ -581,12 +599,20 @@ function bcb_gen()
#
# Add additional compiler options here:
#
XCFLAGS=
CXXFLAGS=
#
# Add additional include directories here:
#
INCLUDES=
#
# add additional linker flags here:
#
XLFLAGS=
#
# add additional libraries to link to here:
#
LIBS=
#
# add additional static-library creation flags here:
#
XSFLAGS=
@ -614,6 +640,115 @@ EOF
}
#######################################################################
#
# section for generic compiler
#
#######################################################################
function gen_gen_lib()
{
all_dep="$all_dep $subdir $subdir/$libname ./$subdir/lib$libname.a"
#
# set up section comments:
cat >> $tout << EOF
########################################################
#
# section for lib$libname.a
#
########################################################
EOF
#
# process source files:
all_obj=""
for file in $src
do
obj=`echo "$file" | sed 's/.*src\/\(.*\)cpp/\1o/g'`
obj="$subdir/$libname/$obj"
all_obj="$all_obj $obj"
echo "$obj: $file \$(ALL_HEADER)" >> $tout
echo " \$(CXX) \$(INCLUDES) -o $obj $opts \$(CXXFLAGS) $file" >> $tout
echo "" >> $tout
done
#
# now for the directories for this library:
echo "$subdir/$libname : " >> $tout
echo " mkdir -p $subdir/$libname" >> $tout
echo "" >> $tout
#
# now for the clean options for this library:
all_clean="$all_clean $libname""_clean"
echo "$libname"_clean : >> $tout
echo " rm -f $subdir/$libname/*.o" >> $tout
echo "" >> $tout
#
# now for the main target for this library:
echo ./$subdir/lib$libname.so : $all_obj >> $tout
echo " \$(LINKER) \$(LDFLAGS) -o $subdir/lib$libname.so $all_obj \$(LIBS)" >> $tout
echo "" >> $tout
}
function gen_gen()
{
out="lib/generic.mak"
tout="temp"
iout="temp_install"
subdir="\$(DIRNAME)"
all_dep=""
all_clean=""
echo > $out
echo > $tout
echo > $iout
libname="boost_regex"
opts="\$(C1)"
gen_gen_lib
cat > $out << EOF
#
# auto generated makefile for generic compiler
#
# usage:
# make
# brings libraries up to date
# make clean
# deletes temporary object files (but not archives).
#
#
# the following environment variables are recognised:
# CXXFLAGS= extra compiler options - note applies to all build variants
# INCLUDES= additional include directories
# LDFLAGS= additional linker options
# LIBS= additional library files
# CXX= compiler to use
# LINKER= linker/archiver to use
# name of subdirectory to use for object/archive files:
DIRNAME=generic
#
# default compiler options for release build:
#
C1=-c -O2 -I../../../
EOF
echo "" >> $out
echo "ALL_HEADER=$header" >> $out
echo "" >> $out
echo "all : $subdir $all_dep" >> $out
echo >> $out
echo "$subdir :" >> $out
echo " mkdir -p $subdir" >> $out
echo >> $out
echo "clean : $all_clean" >> $out
echo >> $out
echo "install : all" >> $out
cat $iout >> $out
echo >> $out
cat $tout >> $out
}
#
@ -682,6 +817,9 @@ use_vcl="no"
out="lib/bc55.mak"
subdir="bcb5"
bcb_gen
#
# generate generic makefile:
gen_gen
#
@ -704,4 +842,7 @@ rm -f $tout $iout