Commit e770d34a authored by mem's avatar mem
Browse files

Makefile is getting out of hand. Use GNU tools' config.guess to obtain

the canonical system name and include the corresponding Makefile snippet
from config/.  config.guess has been written with portability in mind,
so it should work properly on all supported systems.  Should its licence
(GPL) become a problem, it can be replaced with a simpler script that
supports only the systems we know something about.

Adding support for a new system is just a matter of running
config/config.guess and writing the matching config/Makefile.$system
file.


git-svn-id: https://glew.svn.sourceforge.net/svnroot/glew/trunk/glew@315 783a27ee-832a-0410-bc00-9f386506c6dd
parent aac5eed6
......@@ -39,195 +39,14 @@ TARDIR = ../glew-$(GLEW_VERSION)
TARBALL = ../glew_$(GLEW_VERSION).tar.gz
SHELL = /bin/sh
SYSTEM = $(strip $(shell uname -s))
SYSTEM = $(shell config/config.guess | cut -d - -f 3)
SYSTEM.SUPPORTED = $(shell test -f config/Makefile.$(SYSTEM) && echo 1)
# ----------------------------------------------------------------------------
# Cygwin
# ----------------------------------------------------------------------------
ifeq ($(patsubst CYGWIN%,CYGWIN,$(SYSTEM)), CYGWIN)
NAME = glew32
CC = gcc -mno-cygwin
LD = ld
CFLAGS.EXTRA = -DGLEW_STATIC
ifneq (undefined, $(origin GLEW_MX))
CFLAGS.EXTRA += -DGLEW_MX
endif
LDFLAGS.SO = -shared -soname $(LIB.SONAME)
LDFLAGS.GL = -lglu32 -lopengl32 -lgdi32 -luser32 -lkernel32
LDFLAGS.EXTRA =
WARN = -Wall -W
POPT = -O2
BIN.SUFFIX = .exe
LIB.SONAME = lib$(NAME).so.$(GLEW_MAJOR)
LIB.DEVLNK = lib$(NAME).so
LIB.SHARED = lib$(NAME).so.$(GLEW_VERSION)
LIB.STATIC = lib$(NAME).a
else
# ----------------------------------------------------------------------------
# Mingw32
# ----------------------------------------------------------------------------
ifeq ($(patsubst MINGW32%,MINGW32,$(SYSTEM)), MINGW32)
NAME = glew32
CC = gcc
# use gcc for linking, with ld it does not work
LD = gcc
ifneq (undefined, $(origin GLEW_MX))
CFLAGS.EXTRA = -DGLEW_MX
endif
CFLAGS.SO = -DGLEW_BUILD
#LDFLAGS.SO = -shared -soname $(LIB.SONAME) --out-implib lib/$(LIB.DEVLNK)
LDFLAGS.SO = -shared -Wl,-soname,$(LIB.SONAME) -Wl,--out-implib,lib/$(LIB.DEVLNK)
LDFLAGS.GL = -lglu32 -lopengl32 -lgdi32 -luser32 -lkernel32
LDFLAGS.EXTRA = -L/mingw/lib
WARN = -Wall -W
POPT = -O2
BIN.SUFFIX = .exe
LIB.SONAME = $(NAME).dll
LIB.DEVLNK = lib$(NAME).dll.a # for mingw this is the dll import lib
LIB.SHARED = $(NAME).dll
LIB.STATIC = lib$(NAME).a # the static lib will be broken (see CFLAGS.SO)
else
# ----------------------------------------------------------------------------
# Linux
# ----------------------------------------------------------------------------
ifeq ($(patsubst Linux%,Linux,$(SYSTEM)), Linux)
NAME = GLEW
CC = cc
LD = ld
ifneq (undefined, $(origin GLEW_MX))
CFLAGS.EXTRA = -DGLEW_MX
endif
PICFLAG = -fPIC
LDFLAGS.SO = -shared -soname $(LIB.SONAME)
LDFLAGS.EXTRA = -L/usr/X11R6/lib
LDFLAGS.GL = -lXmu -lXi -lGLU -lGL -lXext -lX11
LDFLAGS.STATIC = -Wl,-Bstatic
LDFLAGS.DYNAMIC = -Wl,-Bdynamic
NAME = GLEW
WARN = -Wall -W
POPT = -O2
BIN.SUFFIX =
LIB.SONAME = lib$(NAME).so.$(GLEW_MAJOR)
LIB.DEVLNK = lib$(NAME).so
LIB.SHARED = lib$(NAME).so.$(GLEW_VERSION)
LIB.STATIC = lib$(NAME).a
SHARED_OBJ_EXT = pic_o
else
# ----------------------------------------------------------------------------
# FreeBSD
# ----------------------------------------------------------------------------
ifeq ($(patsubst FreeBSD%,FreeBSD,$(SYSTEM)), FreeBSD)
NAME = GLEW
CC = cc
LD = ld
ifneq (undefined, $(origin GLEW_MX))
CFLAGS.EXTRA = -DGLEW_MX
endif
LDFLAGS.SO = -shared -soname $(LIB.SONAME)
LDFLAGS.EXTRA = -L/usr/X11R6/lib
LDFLAGS.GL = -lXmu -lXi -lGLU -lGL -lXext -lX11
LDFLAGS.STATIC = -Wl,-Bstatic
LDFLAGS.DYNAMIC = -Wl,-Bdynamic
CFLAGS.EXTRA += -I/usr/X11R6/include
NAME = GLEW
WARN = -Wall -W
POPT = -O2
BIN.SUFFIX =
LIB.SONAME = lib$(NAME).so.$(GLEW_MAJOR)
LIB.DEVLNK = lib$(NAME).so
LIB.SHARED = lib$(NAME).so.$(GLEW_VERSION)
LIB.STATIC = lib$(NAME).a
else
# ----------------------------------------------------------------------------
# Irix
# ----------------------------------------------------------------------------
ifeq ($(patsubst IRIX%,IRIX,$(SYSTEM)), IRIX)
NAME = GLEW
CC = cc
LD = ld
ABI = -64# -n32
CC += $(ABI)
LD += $(ABI)
ifneq (undefined, $(origin GLEW_MX))
CFLAGS.EXTRA = -DGLEW_MX
endif
LDFLAGS.SO = -shared -soname $(LIB.SONAME)
LDFLAGS.EXTRA =
LDFLAGS.GL = -lGLU -lGL -lXext -lX11
NAME = GLEW
WARN = -fullwarn -woff 1110,1498
POPT = -O2
BIN.SUFFIX =
LIB.SONAME = lib$(NAME).so.$(GLEW_MAJOR)
LIB.DEVLNK = lib$(NAME).so
LIB.SHARED = lib$(NAME).so.$(GLEW_VERSION)
LIB.STATIC = lib$(NAME).a
else
# ----------------------------------------------------------------------------
# Darwin
# ----------------------------------------------------------------------------
ifeq ($(patsubst Darwin%,Darwin,$(SYSTEM)), Darwin)
NAME = GLEW
CC = cc
LD = cc
CFLAGS.EXTRA = -no-cpp-precomp -dynamic -fno-common
ifneq (undefined, $(origin GLEW_MX))
CFLAGS.EXTRA += -DGLEW_MX
endif
LDFLAGS.SO = -dynamiclib -install_name $(GLEW_DEST)/lib/$(LIB.SHARED)
LDFLAGS.EXTRA =
ifneq (undefined, $(origin GLEW_APPLE_GLX))
CFLAGS.EXTRA += -I/usr/X11R6/include -D'GLEW_APPLE_GLX'
LDFLAGS.GL = -L/usr/X11R6/lib -lXmu -lXi -lGLU -lGL -lXext -lX11
else
LDFLAGS.GL = -framework AGL -framework OpenGL
endif
NAME = GLEW
BIN.SUFFIX =
WARN = -Wall -W
POPT = -O2
LIB.SONAME = lib$(NAME).$(GLEW_MAJOR).dylib
LIB.DEVLNK = lib$(NAME).dylib
LIB.SHARED = lib$(NAME).$(GLEW_VERSION).dylib
LIB.STATIC = lib$(NAME).a
else
# ----------------------------------------------------------------------------
# Solaris
# ----------------------------------------------------------------------------
ifeq ($(patsubst SunOS%,SunOS,$(SYSTEM)), SunOS)
NAME = GLEW
CC = cc
LD = ld
CFLAGS.EXTRA = -I/usr/openwin/include
ifneq (undefined, $(origin GLEW_MX))
CFLAGS.EXTRA += -DGLEW_MX
endif
LDFLAGS.SO = -G
LDFLAGS.EXTRA = -L/usr/openwin/lib
LDFLAGS.GL = -lXmu -lXi -lGLU -lGL -lXext -lX11
NAME = GLEW
BIN.SUFFIX =
POPT = -xO2
LIB.SONAME = lib$(NAME).so.$(GLEW_MAJOR)
LIB.DEVLNK = lib$(NAME).so
LIB.SHARED = lib$(NAME).so.$(GLEW_VERSION)
LIB.STATIC = lib$(NAME).a
ifeq ($(SYSTEM.SUPPORTED), 1)
include config/Makefile.$(SYSTEM)
else
# ----------------------------------------------------------------------------
$(error "Platform '$(SYSTEM)' not supported")
endif
endif
endif
endif
endif
endif
endif
ifeq (undefined, $(origin SHARED_OBJ_EXT))
SHARED_OBJ_EXT = o
......
NAME = glew32
CC = gcc
# use gcc for linking, with ld it does not work
LD = gcc
ifneq (undefined, $(origin GLEW_MX))
CFLAGS.EXTRA = -DGLEW_MX
endif
CFLAGS.SO = -DGLEW_BUILD
#LDFLAGS.SO = -shared -soname $(LIB.SONAME) --out-implib lib/$(LIB.DEVLNK)
LDFLAGS.SO = -shared -Wl,-soname,$(LIB.SONAME) -Wl,--out-implib,lib/$(LIB.DEVLNK)
LDFLAGS.GL = -lglu32 -lopengl32 -lgdi32 -luser32 -lkernel32
LDFLAGS.EXTRA = -L/mingw/lib
WARN = -Wall -W
POPT = -O2
BIN.SUFFIX = .exe
LIB.SONAME = $(NAME).dll
LIB.DEVLNK = lib$(NAME).dll.a # for mingw this is the dll import lib
LIB.SHARED = $(NAME).dll
LIB.STATIC = lib$(NAME).a # the static lib will be broken (see CFLAGS.SO)
NAME = GLEW
CC = cc
LD = ld
ifneq (undefined, $(origin GLEW_MX))
CFLAGS.EXTRA = -DGLEW_MX
endif
LDFLAGS.SO = -shared -soname $(LIB.SONAME)
LDFLAGS.EXTRA = -L/usr/X11R6/lib
LDFLAGS.GL = -lXmu -lXi -lGLU -lGL -lXext -lX11
LDFLAGS.STATIC = -Wl,-Bstatic
LDFLAGS.DYNAMIC = -Wl,-Bdynamic
CFLAGS.EXTRA += -I/usr/X11R6/include
NAME = GLEW
WARN = -Wall -W
POPT = -O2
BIN.SUFFIX =
LIB.SONAME = lib$(NAME).so.$(GLEW_MAJOR)
LIB.DEVLNK = lib$(NAME).so
LIB.SHARED = lib$(NAME).so.$(GLEW_VERSION)
LIB.STATIC = lib$(NAME).a
NAME = GLEW
CC = cc
LD = ld
ABI = -64# -n32
CC += $(ABI)
LD += $(ABI)
ifneq (undefined, $(origin GLEW_MX))
CFLAGS.EXTRA = -DGLEW_MX
endif
LDFLAGS.SO = -shared -soname $(LIB.SONAME)
LDFLAGS.EXTRA =
LDFLAGS.GL = -lGLU -lGL -lXext -lX11
NAME = GLEW
WARN = -fullwarn -woff 1110,1498
POPT = -O2
BIN.SUFFIX =
LIB.SONAME = lib$(NAME).so.$(GLEW_MAJOR)
LIB.DEVLNK = lib$(NAME).so
LIB.SHARED = lib$(NAME).so.$(GLEW_VERSION)
LIB.STATIC = lib$(NAME).a
NAME = GLEW
CC = cc
LD = ld
ifneq (undefined, $(origin GLEW_MX))
CFLAGS.EXTRA = -DGLEW_MX
endif
PICFLAG = -fPIC
LDFLAGS.SO = -shared -soname $(LIB.SONAME)
LDFLAGS.EXTRA = -L/usr/X11R6/lib
LDFLAGS.GL = -lXmu -lXi -lGLU -lGL -lXext -lX11
LDFLAGS.STATIC = -Wl,-Bstatic
LDFLAGS.DYNAMIC = -Wl,-Bdynamic
NAME = GLEW
WARN = -Wall -W
POPT = -O2
BIN.SUFFIX =
LIB.SONAME = lib$(NAME).so.$(GLEW_MAJOR)
LIB.DEVLNK = lib$(NAME).so
LIB.SHARED = lib$(NAME).so.$(GLEW_VERSION)
LIB.STATIC = lib$(NAME).a
SHARED_OBJ_EXT = pic_o
NAME = glew32
CC = gcc
# use gcc for linking, with ld it does not work
LD = gcc
ifneq (undefined, $(origin GLEW_MX))
CFLAGS.EXTRA = -DGLEW_MX
endif
CFLAGS.SO = -DGLEW_BUILD
#LDFLAGS.SO = -shared -soname $(LIB.SONAME) --out-implib lib/$(LIB.DEVLNK)
LDFLAGS.SO = -shared -Wl,-soname,$(LIB.SONAME) -Wl,--out-implib,lib/$(LIB.DEVLNK)
LDFLAGS.GL = -lglu32 -lopengl32 -lgdi32 -luser32 -lkernel32
LDFLAGS.EXTRA = -L/mingw/lib
WARN = -Wall -W
POPT = -O2
BIN.SUFFIX = .exe
LIB.SONAME = $(NAME).dll
LIB.DEVLNK = lib$(NAME).dll.a # for mingw this is the dll import lib
LIB.SHARED = $(NAME).dll
LIB.STATIC = lib$(NAME).a # the static lib will be broken (see CFLAGS.SO)
NAME = GLEW
CC = cc
LD = ld
CFLAGS.EXTRA = -I/usr/openwin/include
ifneq (undefined, $(origin GLEW_MX))
CFLAGS.EXTRA += -DGLEW_MX
endif
LDFLAGS.SO = -G
LDFLAGS.EXTRA = -L/usr/openwin/lib
LDFLAGS.GL = -lXmu -lXi -lGLU -lGL -lXext -lX11
NAME = GLEW
BIN.SUFFIX =
POPT = -xO2
LIB.SONAME = lib$(NAME).so.$(GLEW_MAJOR)
LIB.DEVLNK = lib$(NAME).so
LIB.SHARED = lib$(NAME).so.$(GLEW_VERSION)
LIB.STATIC = lib$(NAME).a
This diff is collapsed.
......@@ -546,7 +546,8 @@ GLEW is originally derived from the EXTGL project by Lev Povalahev. The
source code is licensed under the modified BSD license, the <a
href="sgi.txt">SGI Free Software License B</a>, and the <a
href="glx.txt">GLX Public License</a>. The automatic code
generation scripts are released under the <a href="gpl.txt">GPL</a>.
generation scripts and the config.guess script (from the GNU config tools) are
released under the <a href="gpl.txt">GPL</a>.
<blockquote><pre></pre></blockquote>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment