diff options
-rwxr-xr-x | bin/mklib | 100 | ||||
-rw-r--r-- | src/glu/mesa/Makefile | 4 | ||||
-rw-r--r-- | src/glu/sgi/Makefile | 4 | ||||
-rw-r--r-- | src/glut/ggi/Makefile | 2 | ||||
-rw-r--r-- | src/glut/glx/Makefile | 6 | ||||
-rw-r--r-- | src/glut/mini/Makefile | 6 | ||||
-rw-r--r-- | src/glw/Makefile | 5 | ||||
-rw-r--r-- | src/glx/mini/Makefile | 3 | ||||
-rw-r--r-- | src/glx/x11/Makefile | 3 | ||||
-rw-r--r-- | src/mesa/Makefile | 8 |
10 files changed, 61 insertions, 80 deletions
@@ -15,12 +15,14 @@ # -patch N specifies patch version number (default is 0) # -lLIBRARY specifies a dependency on LIBRARY # -LDIR search in DIR for library dependencies +# -linker L explicity specify the linker program to use (ex: gcc, g++) +# Not observed on all systems at this time. # -cplusplus link with C++ runtime # -static make a static library (default is dynamic/shared) -# -install DIR move resulting library file(s) to DIR +# -install DIR pu resulting library file(s) in DIR # -arch ARCH override using `uname` to determine architecture # -archopt OPT specify an extra achitecture-specific option OPT -# -noprefix don't prefix library name with "lib" or any suffix +# -noprefix don't prefix library name with "lib" nor add any suffix # -exports FILE only export the symbols listed in FILE # # The library name should just be "GL" or "GLU", etc. The 'lib' prefix @@ -29,10 +31,6 @@ # # objects should be: foo.o bar.o etc.o # -# Environment variables recognized: -# CC C compiler command -# CXX C++ compiler command -# # @@ -43,6 +41,7 @@ MAJOR=1 MINOR=0 PATCH="" DEPS="" +LINK="" CPLUSPLUS=0 STATIC=0 INSTALLDIR="." @@ -62,6 +61,7 @@ do '-major') shift 1; MAJOR=$1;; '-minor') shift 1; MINOR=$1;; '-patch') shift 1; PATCH=$1;; + '-linker') shift 1; LINK=$1;; -l*) DEPS="$DEPS $1";; -L*) DEPS="$DEPS $1";; '-cplusplus') CPLUSPLUS=1;; @@ -120,12 +120,13 @@ case $ARCH in 'Linux' | 'OpenBSD') # we assume gcc - # Set default compilers if env vars not set - if [ "x$CXX" = "x" ] ; then - CXX=g++ - fi - if [ "x$CC" = "x" ] ; then - CC=gcc + if [ "x$LINK" = "x" ] ; then + # -linker was not specified so set default link command now + if [ $CPLUSPLUS = 1 ] ; then + LINK=g++ + else + LINK=gcc + fi fi if [ $NOPREFIX = 1 ] ; then @@ -133,13 +134,7 @@ case $ARCH in echo "mklib: Making" $ARCH "shared library: " ${LIBNAME} #OPTS="-shared -Wl,-soname,${LIBNAME}" # soname??? OPTS="-shared" - if [ $CPLUSPLUS = 1 ] ; then - LINK=$CXX - else - LINK=$CC - fi rm -f ${LIBNAME} - # make lib ${LINK} ${OPTS} -o ${LIBNAME} ${OBJECTS} ${DEPS} # finish up @@ -190,12 +185,6 @@ case $ARCH in echo "mklib: Making" $ARCH "shared library: " ${LIBNAME}.so.${VERSION} - if [ $CPLUSPLUS = 1 ] ; then - LINK=$CXX - else - LINK=$CC - fi - # rm any old libs rm -f ${LIBNAME}.so.${VERSION} rm -f ${LIBNAME}.so.${MAJOR} @@ -224,41 +213,25 @@ case $ARCH in echo "mklib: Making SunOS shared library: " ${LIBNAME} # XXX OPTS for gcc should be -shared, but that doesn't work. # Using -G does work though. - if [ $CPLUSPLUS = 1 ] ; then - # determine linker and options for C++ code - if [ "x${CXX}" = "xg++" ] ; then - # use g++ - LINK="g++" - OPTS="-G" - elif [ "x${CXX}" = "xCC" ] ; then - # use Sun CC - LINK="CC" - OPTS="-G" - elif [ "x${CXX}" = "xc++" ] ; then - # use Sun c++ - LINK="c++" - OPTS="-G" - elif [ `which c++` ] ; then - # use Sun c++ - LINK="c++" - OPTS="-G" - elif [ `type g++` ] ; then - # use g++ - LINK="g++" - OPTS="-G" + OPTS="-G" + if [ "x$LINK" = "x" ] ; then + # -linker was not specified, choose default linker now + if [ $CPLUSPLUS = 1 ] ; then + # determine linker and options for C++ code + if [ `which c++` ] ; then + # use Sun c++ + LINK="c++" + elif [ `type g++` ] ; then + # use g++ + LINK="g++" + else + echo "mklib: warning: can't find C++ comiler, trying CC." + LINK="CC" + fi else - echo "mklib: warning: can't find C++ comiler, trying CC." - LINK="CC" - OPTS="-G" + # use native Sun linker for C code + LINK="ld" fi - elif [ "x${CC}" = "xgcc" ] ; then - # use gcc for linking - LINK="gcc" - OPTS="-G" - else - # use native Sun linker - LINK="ld" - OPTS="-G" fi echo "mklib: linker is" ${LINK} ${OPTS} rm -f ${LIBNAME}.${MAJOR} ${LIBNAME} @@ -317,6 +290,8 @@ case $ARCH in FINAL_LIBS=${LIBNAME} else LIBNAME="lib${LIBNAME}.so" # prefix with "lib", suffix with ".so" + # XXX we should run 'file' on the first object file to determine + # if it's o32, n32 or 64 format, as we do for Linux above. if [ $ARCHOPT = "64" ] ; then # 64-bit ABI OPTS="-64 -shared -all" @@ -425,10 +400,12 @@ case $ARCH in VERSION="${MAJOR}.${MINOR}" LIBNAME="lib${LIBNAME}.so" echo "mklib: Making OSF/1 shared library: " ${LIBNAME} - if [ $CPLUSPLUS = 1 ] ; then - LINK=$CXX - else - LINK=$CC + if [ "x$LINK" = "x" ] ; then + if [ $CPLUSPLUS = 1 ] ; then + LINK=cxx + else + LINK=cc + fi fi rm -f ${LIBNAME}.${VERSION} ${LINK} -o ${LIBNAME}.${VERSION} -shared -set_version ${VERSION} -soname ${LIBNAME}.${VERSION} -expect_unresolved \* -all ${OBJECTS} ${DEPS} @@ -477,6 +454,7 @@ case $ARCH in echo "mklib: Making BeOS shared library: " ${LIBNAME} gcc -nostart -Xlinker "-soname=${LIBNAME}" -L/Be/develop/lib/x86 -lbe ${DEPS} ${OBJECTS} -o "${LIBNAME}" mimeset -f "${LIBNAME}" + # XXX remove the Mesa3D stuff here since mklib isn't mesa-specific. setversion "${LIBNAME}" -app ${MAJOR} ${MINOR} ${PATCH} -short "Powered by Mesa3D!" -long "Powered by Mesa3D!" fi FINAL_LIBS=${LIBNAME} diff --git a/src/glu/mesa/Makefile b/src/glu/mesa/Makefile index 0924cf8940..de6c0282bb 100644 --- a/src/glu/mesa/Makefile +++ b/src/glu/mesa/Makefile @@ -45,8 +45,8 @@ $(LIB_DIR): # Make the library: $(LIB_DIR)/$(GLU_LIB_NAME): $(OBJECTS) - @CC="$(CC)" CXX="$(CXX)" $(TOP)/bin/mklib -o $(GLU_LIB) -major $(GLU_MAJOR) \ - -minor $(GLU_MINOR) -patch $(GLU_TINY) \ + @ $(TOP)/bin/mklib -o $(GLU_LIB) -linker $(CC) \ + -major $(GLU_MAJOR) -minor $(GLU_MINOR) -patch $(GLU_TINY) \ $(MKLIB_OPTIONS) -install $(LIB_DIR) \ $(GLU_LIB_DEPS) $(OBJECTS) diff --git a/src/glu/sgi/Makefile b/src/glu/sgi/Makefile index 19f5e280b7..30372c9592 100644 --- a/src/glu/sgi/Makefile +++ b/src/glu/sgi/Makefile @@ -136,8 +136,8 @@ $(LIB_DIR): # Make the library: $(LIB_DIR)/$(GLU_LIB_NAME): $(OBJECTS) - CC="$(CC)" CXX="$(CXX)" $(TOP)/bin/mklib -o $(GLU_LIB) -major $(GLU_MAJOR) \ - -minor $(GLU_MINOR) -patch $(GLU_TINY) \ + $(TOP)/bin/mklib -o $(GLU_LIB) -linker $(CXX) \ + -major $(GLU_MAJOR) -minor $(GLU_MINOR) -patch $(GLU_TINY) \ -cplusplus $(MKLIB_OPTIONS) -install $(LIB_DIR) \ $(GLU_LIB_DEPS) $(OBJECTS) diff --git a/src/glut/ggi/Makefile b/src/glut/ggi/Makefile index a5ffcecea8..f46da59ee9 100644 --- a/src/glut/ggi/Makefile +++ b/src/glut/ggi/Makefile @@ -32,7 +32,7 @@ default: $(LIB_DIR)/$(GLUT_LIB_NAME) # Make the library $(LIB_DIR)/$(GLUT_LIB_NAME): depend $(OBJECTS) - CC="$(CC)" CXX="$(CXX)" $(TOP)/bin/mklib -o $(GLUT_LIB) \ + $(TOP)/bin/mklib -o $(GLUT_LIB) -linker $(CC) \ -major $(GLUT_MAJOR) -minor $(GLUT_MINOR) \ -patch $(GLUT_TINY) $(MKLIB_OPTIONS) -install $(LIB_DIR) \ $(GLUT_LIB_DEPS) $(OBJECTS) diff --git a/src/glut/glx/Makefile b/src/glut/glx/Makefile index 2b7180493f..e345c8df40 100644 --- a/src/glut/glx/Makefile +++ b/src/glut/glx/Makefile @@ -90,9 +90,9 @@ default: $(LIB_DIR)/$(GLUT_LIB_NAME) # Make the library $(LIB_DIR)/$(GLUT_LIB_NAME): depend $(OBJECTS) - CC="$(CC)" CXX="$(CXX)" $(TOP)/bin/mklib -o $(GLUT_LIB) \ - -major $(GLUT_MAJOR) -minor $(GLUT_MINOR) \ - -patch $(GLUT_TINY) $(MKLIB_OPTIONS) -install $(LIB_DIR) \ + $(TOP)/bin/mklib -o $(GLUT_LIB) -linker $(CC) \ + -major $(GLUT_MAJOR) -minor $(GLUT_MINOR) -patch $(GLUT_TINY) \ + $(MKLIB_OPTIONS) -install $(LIB_DIR) \ $(GLUT_LIB_DEPS) $(OBJECTS) diff --git a/src/glut/mini/Makefile b/src/glut/mini/Makefile index c1dc5c5a05..ffd224e6f1 100644 --- a/src/glut/mini/Makefile +++ b/src/glut/mini/Makefile @@ -55,9 +55,9 @@ default: depend $(LIB_DIR)/$(GLUT_LIB_NAME) # Make the library $(LIB_DIR)/$(GLUT_LIB_NAME): depend $(OBJECTS) - CC="$(CC)" CXX="$(CXX)" $(TOP)/bin/mklib -o $(GLUT_LIB) \ - -major $(GLUT_MAJOR) -minor $(GLUT_MINOR) \ - -patch $(GLUT_TINY) $(GLUT_LIB_DEPS) -install $(LIB_DIR) \ + $(TOP)/bin/mklib -o $(GLUT_LIB) -linker $(CC) \ + -major $(GLUT_MAJOR) -minor $(GLUT_MINOR) -patch $(GLUT_TINY) \ + $(GLUT_LIB_DEPS) -install $(LIB_DIR) \ $(MKLIB_OPTIONS) $(OBJECTS) diff --git a/src/glw/Makefile b/src/glw/Makefile index 4f1abf5d31..12719f7c72 100644 --- a/src/glw/Makefile +++ b/src/glw/Makefile @@ -33,8 +33,9 @@ clean: # Make the library $(LIB_DIR)/$(GLW_LIB_NAME): $(OBJECTS) - CC="$(CC)" CXX="$(CXX)" $(TOP)/bin/mklib -o $(GLW_LIB) -major $(MAJOR) -minor $(MINOR) \ - -patch $(TINY) $(MKLIB_OPTIONS) -install $(LIB_DIR) \ + $(TOP)/bin/mklib -o $(GLW_LIB) -linker $(CC) \ + -major $(MAJOR) -minor $(MINOR) -patch $(TINY) \ + $(MKLIB_OPTIONS) -install $(LIB_DIR) \ $(GLW_LIB_DEPS) $(OBJECTS) diff --git a/src/glx/mini/Makefile b/src/glx/mini/Makefile index 612610526e..a9bced2508 100644 --- a/src/glx/mini/Makefile +++ b/src/glx/mini/Makefile @@ -55,7 +55,8 @@ default: depend $(LIB_DIR)/$(GL_LIB_NAME) # Make libGL $(LIB_DIR)/$(GL_LIB_NAME): $(OBJECTS) Makefile - CC="$(CC)" CXX="$(CXX)" $(TOP)/bin/mklib -o $(GL_LIB) -major 1 -minor 2 $(MKLIB_OPTIONS) \ + $(TOP)/bin/mklib -o $(GL_LIB) -linker $(CC) \ + -major 1 -minor 2 $(MKLIB_OPTIONS) \ -install $(LIB_DIR) $(GL_LIB_DEPS) $(OBJECTS) rm -f $(LIB_DIR)/miniglx.conf install example.miniglx.conf $(LIB_DIR)/miniglx.conf diff --git a/src/glx/x11/Makefile b/src/glx/x11/Makefile index bca2ee4ffa..3ffa4780d4 100644 --- a/src/glx/x11/Makefile +++ b/src/glx/x11/Makefile @@ -88,7 +88,8 @@ dispatch.c: # Make libGL $(LIB_DIR)/$(GL_LIB_NAME): $(OBJECTS) Makefile - CC="$(CC)" CXX="$(CXX)" $(TOP)/bin/mklib -o $(GL_LIB) -major 1 -minor 2 $(MKLIB_OPTIONS) \ + $(TOP)/bin/mklib -o $(GL_LIB) -linker $(CC) \ + -major 1 -minor 2 $(MKLIB_OPTIONS) \ -install $(LIB_DIR) $(GL_LIB_DEPS) $(OBJECTS) diff --git a/src/mesa/Makefile b/src/mesa/Makefile index 6e13f5289c..7a17bf5a61 100644 --- a/src/mesa/Makefile +++ b/src/mesa/Makefile @@ -96,7 +96,7 @@ LIBGL_CORE_OBJECTS = \ # Make libGL from core object files libgl-core: $(LIBGL_CORE_OBJECTS) - @ CC="$(CC)" CXX="$(CXX)" $(TOP)/bin/mklib -o $(GL_LIB) \ + @ $(TOP)/bin/mklib -o $(GL_LIB) -linker $(CC) \ -major $(MESA_MAJOR) -minor $(MESA_MINOR) -patch $(MESA_TINY) \ -install $(LIB_DIR) $(MKLIB_OPTIONS) $(LIBGL_CORE_OBJECTS) $(GL_LIB_DEPS) @@ -150,7 +150,7 @@ subdirs: # Make the GL library $(LIB_DIR)/$(GL_LIB_NAME): $(STAND_ALONE_OBJECTS) - @ CC="$(CC)" CXX="$(CXX)" $(TOP)/bin/mklib -o $(GL_LIB) \ + @ $(TOP)/bin/mklib -o $(GL_LIB) -linker $(CC) \ -major $(GL_MAJOR) -minor $(GL_MINOR) -patch $(GL_TINY) \ -install $(LIB_DIR) \ $(MKLIB_OPTIONS) $(GL_LIB_DEPS) $(STAND_ALONE_OBJECTS) @@ -158,13 +158,13 @@ $(LIB_DIR)/$(GL_LIB_NAME): $(STAND_ALONE_OBJECTS) # Make the OSMesa library $(LIB_DIR)/$(OSMESA_LIB_NAME): $(OSMESA_DRIVER_OBJECTS) $(OSMESA16_OBJECTS) @ if [ "${DRIVER_DIRS}" = "osmesa" ] ; then \ - CC="$(CC)" CXX="$(CXX)" $(TOP)/bin/mklib -o $(OSMESA_LIB) \ + $(TOP)/bin/mklib -o $(OSMESA_LIB) -linker $(CC) \ -major $(MESA_MAJOR) \ -minor $(MESA_MINOR) -patch $(MESA_TINY) \ -install $(LIB_DIR) $(MKLIB_OPTIONS) \ $(OSMESA_LIB_DEPS) $(OSMESA16_OBJECTS) ; \ else \ - CC="$(CC)" CXX="$(CXX)" $(TOP)/bin/mklib -o $(OSMESA_LIB) \ + $(TOP)/bin/mklib -o $(OSMESA_LIB) -linker $(CC) \ -major $(MESA_MAJOR) \ -minor $(MESA_MINOR) -patch $(GL_TINY) \ -install $(LIB_DIR) $(MKLIB_OPTIONS) \ |