How to compile SGI OpenGL Implementation

Suhaib M. Siddiqi siddiqis@ipass.net
Sat Mar 11 19:38:00 GMT 2000


Kendall and others
Who asked how to compile SGI OpenGL Implementation under Cygwin.

1)  Down download patched XFRee86 4.0 source tree from Cygwin/XFree URL

2) Retrieve SGI OpenGL code from SGI CVS at http://oss.sgi.com/projects

3) Follow the Instructions in the README file of OpenGL code
to merge the code into XFree86 source tree.

4) change the include/make/commondefs file with the attached file.  Since it
is only 12 K I am posting here
I hope other who are not interested in SGI OpenGL will not mind.

5) Compile using make World.  Go get a cup of coffee!!! compiling whole
XFRee86 Source tree
with OpenGL will take time.


-------------- next part --------------
# License Applicability. Except to the extent portions of this file are
# made subject to an alternative license as permitted in the SGI Free
# Software License B, Version 1.0 (the "License"), the contents of this
# file are subject only to the provisions of the License. You may not use
# this file except in compliance with the License. You may obtain a copy
# of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
# Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
# 
# http://oss.sgi.com/projects/FreeB
# 
# Note that, as provided in the License, the Software is distributed on an
# "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
# DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
# CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
# PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
# 
# Original Code. The Original Code is: OpenGL Sample Implementation,
# Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
# Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
# Copyright in any portions created by third parties is as indicated
# elsewhere herein. All Rights Reserved.
# 
# Additional Notice Provisions: The application programming interfaces
# established by SGI in conjunction with the Original Code are The
# OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
# April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
# 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
# Window System(R) (Version 1.3), released October 19, 1998. This software
# was created using the OpenGL(R) version 1.2.1 Sample Implementation
# published by SGI, but has not been independently verified as being
# compliant with the OpenGL(R) version 1.2.1 Specification.
#
# $Date$ $Revision$
# $Header: //depot/main/tools/include/commondefs#39 $

COMMONRULES=$(ROOT)/usr/include/make/commonrules

# what OS are we running on
OS=$(shell uname)
ifeq ($(subst 64,,$(OS)), IRIX)
OS=IRIX
endif

# various source-level directories
TOOLSSRC = $(TOPDIR)/tools
GFXINCLUDESRC = $(TOPDIR)/gfx/include
OGLLIBSRC = $(TOPDIR)/gfx/lib/opengl
GLXLIBSRC = $(TOPDIR)/glx

# shell-related defs
SHELL	= /bin/sh
AWK	= awk
ECHO	= /bin/echo
RM	= rm -f
MV	= mv
PERL	= perl
SED	= sed
UNIQ	= uniq

# M4 options - run GNU M4 in compatibility mode
# rdist options - Red Hat 5.2 must have daemon location specified
ifeq ($(OS),IRIX)
M4OPTS	=
endif
ifeq ($(OS),Linux)
M4OPTS	= -G
RDIST_OPTS = -p /usr/sbin/rdistd
endif

ifeq ($(OS),CYGWIN*)
M4OPTS	= -G
RDIST_OPTS =
endif


# override default gmake CXX with what we have
ifeq ($(OS),IRIX)
CXX	= CC
endif

# what language are we using?  Default to ansi with extended defines
ifeq ($(OS),IRIX)
CVERSION = -xansi
endif
ifeq ($(OS),Linux)
CVERSION= -ansi -include $(ROOT)/usr/include/make/linuxdefs
endif

ifeq ($(OS),CYGWIN*)
CXX = g++
CVERSION= -ansi -include $(ROOT)/usr/include/make/linuxdefs
endif


# WARN is the warning option
ifeq ($(OS),IRIX)
#
# Turn of explicitly some warnings on IRIX.  Specifically:
#	1155:	unrecognized #pragma
#	1174:	parameter/variable "???" was declared but never referenced
#	1201:	trailing comma is nonstandard (last element in struct assnment)
#	1209:	controlling expression is constant
#	1506:	implicit conversion from "???" to "???": rounding, sign 
#		extension, or loss of accuracy may result
#	3170:	"???" not marked as intrinsic because it is not declared 
#		as a function
#
WARN = -fullwarn \
	-woff 1155,1174,1506,1201,1209,3170
endif
ifeq ($(OS),Linux)
WARN = -Wimplicit \
	-Wreturn-type \
	-Wswitch \
	-Wcomment \
	-Wformat \
	-Wchar-subscripts \
	-Wparentheses \
	-Wpointer-arith \
	-Wcast-qual \
	-Wmissing-prototypes \
	-Wmissing-declarations \
	$(NULL)
endif

ifeq ($(OS),CYGWIN*)
WARN = -Wimplicit \
	-Wreturn-type \
	-Wswitch \
	-Wcomment \
	-Wformat \
	-Wchar-subscripts \
	-Wparentheses \
	-Wpointer-arith \
	-Wcast-qual \
	-Wmissing-prototypes \
	-Wmissing-declarations \
	$(NULL)
endif


# default optimization
ifeq ($(subst y,1,$(GLDEBUG)),1)
OPTIMIZER=-g
else
OPTIMIZER=-O2
ifeq ($(OS),Linux)
WARN += -Wuninitialized
ifeq ($(OS),CYGWIN*)
WARN += -Wuninitialized
endif
endif
endif

# how to make dependencies
ifeq ($(OS),IRIX)
MKDEPOPT = -MDupdate Makedepend
endif
ifeq ($(OS),Linux)
MKDEPOPT = -MD
endif

ifeq ($(OS),CYGWIN*)
MKDEPOPT = -MD
endif


override GCOPTS = $(OPTIMIZER) $(MKDEPOPT) $(WARN)
override GCXXOPTS = $(OPTIMIZER) $(MKDEPOPT) $(WARN)

# where is the default include directory?
#  (we don't grab it off $ROOT, to avoid populating $ROOT with system
#  includes.  Yes, I know...  You don't like the idea.
INCLDIR = /usr/include

# where to install include files?
INCLUDE_LOCATION = $(ROOT)/usr/include

# we would like to use nostdinc on Linux, but unfortunately, it also
# removes include directories with no well-known fixed path (ie. the
# gcc install directory).
ifeq ($(OS),IRIX)
override GCINCS = -nostdinc -I$(ROOT)$(INCLDIR) -I$(INCLDIR)
override GCXXINCS = -nostdinc -I$(ROOT)$(INCLDIR) -I$(INCLDIR)
endif
ifeq ($(OS),Linux)
override GCINCS = -I$(ROOT)$(INCLDIR)
override GCXXINCS = -I$(ROOT)$(INCLDIR) -I$(INCLDIR)
endif

ifeq ($(GLDEBUG),1)
override GCDEFS = -DDEBUG -UNDEBUG
override GCXXDEFS = -DDEBUG -UNDEBUG
else
override GCDEFS = -UDEBUG -DNDEBUG
override GCXXDEFS = -UDEBUG -DNDEBUG
endif

#
# Cc flags, composed of:
#	variable (V*) (set on the command line)
#	local (L*) (set in the makefile)
#	global (G*) (defined in this file, not overrideable)
# in that order.  This is done so that the locally defined includes
# are searched before the globally defined ones.
#
CFLAGS	= $(CVERSION) $(VCFLAGS) $(LCFLAGS) $(GCFLAGS)

#
# Each of these three components is divided into defines (-D's and -U's),
# includes (-I's), and other options.  By segregating the different
# classes of flag to cc, the defines (CDEFS) and includes (CINCS) can be
# easily given to other programs, e.g., lint.
#
# Notes:
#   - The local assignments should be to LCOPTS, LCDEFS, and LCINCS, not to
#     LCFLAGS, although CFLAGS will be correctly set if this is done.
#   - If a program cannot be optimized, it should override the setting of
#     OPTIMIZER with a line such as "OPTIMIZER=" in its make file.
#   - If a program cannot be compiled with ANSI C, its makefile
#     should set CVERSION=-cckr
#
VCFLAGS = $(VCDEFS) $(VCINCS) $(VCOPTS)
LCFLAGS = $(LCDEFS) $(LCINCS) $(LCOPTS)
GCFLAGS = $(GCDEFS) $(GCINCS) $(GCOPTS)

COPTS   = $(VCOPTS) $(LCOPTS) $(GCOPTS)
CDEFS   = $(VCDEFS) $(LCDEFS) $(GCDEFS)
CINCS   = $(VCINCS) $(LCINCS) $(GCINCS)

#
# CXX flags are decomposed using the same hierarchy as C flags.
#
CXXFLAGS  = $(CVERSION) $(VCXXFLAGS) $(LCXXFLAGS) $(GCXXFLAGS)

VCXXFLAGS = $(VCXXDEFS) $(VCXXINCS) $(VCXXOPTS)
LCXXFLAGS = $(LCXXDEFS) $(LCXXINCS) $(LCXXOPTS)
GCXXFLAGS = $(GCXXDEFS) $(GCXXINCS) $(GCXXOPTS)

CXXOPTS   = $(VCXXOPTS) $(LCXXOPTS) $(GCXXOPTS)
CXXDEFS   = $(VCXXDEFS) $(LCXXDEFS) $(GCXXDEFS)
CXXINCS   = $(VCXXINCS) $(LCXXINCS) $(GCXXINCS)

#
# Do something for the linker
#
#
# Library paths (-L's) are part of LDOPTS.
# Libraries (-l's) are part of LDLIBS.
# This is done so that there is a guarantee that all library paths are
# included before the libraries.
#
override GLDOPTS=
override GLDDSOOPTS=
ifeq ($(OS),IRIX)
override GLDOPTS += -L$(ROOT)/usr/lib32
override GLDDSOOPTS += -L$(ROOT)/usr/lib32
endif
ifeq ($(OS),Linux)
override GLDOPTS += -L$(ROOT)/usr/lib -L$(XTOPDIR)/xc/exports/lib
override GLDDSOOPTS += -L$(ROOT)/usr/lib -L$(XTOPDIR)/xc/exports/lib
endif
ifeq ($(OS),CYGWIN)
override GLDOPTS += -L$(ROOT)/usr/lib -L$(XTOPDIR)/xc/exports/lib
override GLDDSOOPTS += -L$(ROOT)/usr/lib -L$(XTOPDIR)/xc/exports/lib
endif


# options used for DSO's.
ifeq ($(OS),IRIX)
DSONAMEOPT = -soname $(DSONAME)
ifneq ($(DSOEXPORTS),)
DSOEXPORTSOPT = -exports_file $(DSOEXPORTS)
endif
override GLDDSOOPTS += -elf -shared -all $(DSOEXPORTSOPT) $(DSONAMEOPT)
endif

ifeq ($(OS),Linux)
DSONAMEOPT = -soname=$(DSONAME)
ifeq ($(OS),CYGWIN)
DSONAMEOPT = -soname=$(DSONAME)
ifneq ($(DSOEXPORTS),)
DSOEXPORTSOPT = $(addprefix -u ,$(shell cat $(DSOEXPORTS)))
else
DSOEXPORTSOPT = --whole-archive
endif
override GLDDSOOPTS += -shared $(DSOEXPORTSOPT) $(DSONAMEOPT)
endif
endif
LDDSOOPTS  = $(VLDDSOOPTS) $(LLDDSOOPTS) $(GLDDSOOPTS)
LDDSOLIBS  = $(VLDDSOLIBS) $(LLDDSOLIBS) $(GLDDSOLIBS)
LDDSOFLAGS = $(LDDSOOPTS) $(LDDSOLIBS) $(ENDIAN)

LDOPTS  = $(VLDOPTS) $(LLDOPTS) $(GLDOPTS)
LDLIBS  = $(VLDLIBS) $(LLDLIBS) $(GLDLIBS)
LDFLAGS = $(LDOPTS) $(LDLIBS) $(ENDIAN)

# where to install libraries
ifeq ($(OS),IRIX)
OBJECT_STYLE = N32
LIB_LOCATION = $(ROOT)/usr/lib32
endif
ifeq ($(OS),Linux)
LIB_LOCATION = $(ROOT)/usr/lib
endif

#
# as flags are just like cc flags.
# By default, ASTYLE is the same as CSTYLE, but some may need to make
# the asm more aggressive than 'C' and can set ASTYLE. Users of 'make'
# always get ASTYLE == CSTYLE
#
ASFLAGS = $(VASFLAGS) $(LASFLAGS) $(GASFLAGS)

VASFLAGS = $(VASDEFS) $(VASINCS) $(VASOPTS)
LASFLAGS = $(LASDEFS) $(LASINCS) $(LASOPTS)
GASFLAGS = $(GASDEFS) $(GASINCS) $(GASOPTS)

ASOPTS  = $(VASOPTS) $(LASOPTS) $(GASOPTS)
ASDEFS  = $(VASDEFS) $(LASDEFS) $(GASDEFS)
ASINCS  = $(VASINCS) $(LASINCS) $(GASINCS)

override GASOPTS = $(OPTIMIZER) $(MKDEPOPT)
override GASDEFS = $(GCDEFS)
override GASINCS = $(GCINCS)

#
# the install command to use
#
INSTALL	= $(ROOT)/usr/bin/gfxinstall
INSTALLFLAGS = -v -m 0444

#
# Convenient command macros that include the flags macros.
#
# You should always invoke make in makefiles via $(MAKE), as make passes
# all command-line variables through the environment to sub-makes.
#
# Never use just $(CCF), etc. in rules that link executables; LDFLAGS
# needs to be included after your objects in the command line.
#
ASF     = $(AS) $(ASFLAGS)
CXXF    = $(CXX) $(CXXFLAGS)
C++F    = $(CXXF)
CCF     = $(CC) $(CFLAGS)
LDF     = $(LD) $(LDFLAGS)
LEXF    = $(LEX) $(LFLAGS)
YACCF   = $(YACC) $(YFLAGS)

# Targets

COMMONTARGS = clobber clean rmtargets

ALLTARGS = headers headers_install libs libs_install install apps distsi \
	   $(COMMONTARGS)

#
# Rule macros for nonterminal makefiles that iterate over subdirectories,
# making the current target.  Set *SUBDIRS to the relevant list of kids.
#
# Set NOSUBMESG to any value to suppress a warning that subdirectories
# are not present. This is useful with mandefs/rules
#
SUBDIR_MAKERULE= \
	if test ! -d $$d; then \
		if test "$(NOSUBMESG)" = "" ; then \
			echo "SKIPPING $$d: No such directory."; \
		fi \
	else \
		$(ECHO) "\t(cd $$d; $(MAKE) $${RULE:=$@})"; \
		(cd $$d; ${MAKE} $${RULE:=$@}); \
	fi

SUBDIRS_MAKERULE= \
	@for d in $(SUBDIRS); do $(SUBDIR_MAKERULE); done

#
# One problem with the above rules is that if a make fails, and -k is
# set, the entire for loop might stop. This is because make still can
# (and XPG requires it) exit with an error status if the -k option is set.
# This is an alternate rule for SUBDIRS when it is desired that -k keep
# working on the next SUBDIR if the previous one failed. Its not quite
# as compact a rule as the previous ones.
# A standard usage would be:
#       default install $(COMMONTARGS): $(_FORCE)
#               $(MAKE) __DORULE=$@ $(SUBDIRS)
#       $(SUBDIRS): $(_FORCE)
#               @$(NSUBDIR_MAKERULE)

NSUBDIR_MAKERULE= \
	if test ! -d $@; then \
		if test "$(NOSUBMESG)" = "" ; then \
			echo "SKIPPING $@: No such directory."; \
		fi \
	else \
		echo "\t(cd $@; $(MAKE) $(__DORULE))"; \
		(cd $@; ${MAKE} $(__DORULE)); \
	fi

#
# Convenience file list macros:
#       - Commondefs defines the following lists: SOURCES, enumerating all
#         source files; OBJECTS, the .o files derived from compilable source;
#         and DIRT, which lists intermediates and temporary files to be
#         removed by clean.
#       - The including (parent) makefile may define source file lists for
#         the standard suffixes: CFILES for .c, ASFILES for .s, YFILES for
#         .y, etc.  We combine all such lists into SOURCES.  The including
#         makefile need not define CFILES &c before including commondefs.
#
SOURCES=$(HFILES) $(ASFILES) $(CCFILES) $(C++FILES) $(CXXFILES) $(CFILES) \
	$(EFILES) $(FFILES) $(LFILES) $(PFILES) $(RFILES) $(SHFILES) $(YFILES)

CXXO1=$(CXXFILES:.c++=.o) $(C++FILES:.c++=.o) $(CCFILES:.c++=.o)
CXXO2=$(CXXO1:.cxx=.o)
CXXO3=$(CXXO2:.C=.o)
CXXO4=$(CXXO3:.cc=.o)
CXXOALL=$(CXXO4)
YO1=$(YFILES:.y=.o)
YO2=$(YO1:.yxx=.o)
YO3=$(YO2:.Y=.o)
YOALL=$(YO3)
LO1=$(LFILES:.l=.o)
LO2=$(LO1:.lxx=.o)
LO3=$(LO2:.L=.o)
LOALL=$(LO3)
OBJECTS=$(ASFILES:.s=.o) $(CXXOALL) $(CFILES:.c=.o) $(EFILES:.e=.o) \
        $(FFILES:.f=.o) $(LOALL) $(PFILES:.p=.o) $(RFILES:.r=.o) \
        $(YOALL)

#
# dependency file(s)
#
ifeq ($(OS),IRIX)
MKDEPFILE = Makedepend
endif
ifeq ($(OS),Linux)
MKDEPFILE = $(OBJECTS:.o=.d)
endif

ifeq ($(OS),CYGWIN*)
MKDEPFILE = $(OBJECTS:.o=.d)
endif

#
# distribution file
#
DISTFILE_EXT = Distfile
DISTFILE_INT = Distfile.int
DISTFILE = $(DISTFILE_EXT) $(DISTFILE_INT)


#
# dirt stuff
#
DIRT=$(GDIRT) $(VDIRT) $(LDIRT)
override GDIRT=*.o a.out core lex.yy.[co] y.tab.[cho] ar.tmp.* so_locations

LOCALDEFS	= ./localdefs
LOCALRULES	= ./localrules

-include $(LOCALDEFS)


More information about the Cygwin-xfree mailing list