[95] | 1 | CXX = g++
|
---|
| 2 | CXXFLAGS=-DFROG_OPENGL -DFROG_ZLIB -DFROG_LIGHTING
|
---|
| 3 | CXXFLAGSOPTIM=-O3 -funroll-loops -s
|
---|
| 4 | CXXFLAGS+=$(CXXFLAGSOPTIM)
|
---|
| 5 | LDFLAGS=
|
---|
| 6 | SOTYPE=
|
---|
| 7 | SRCDIR = ../src
|
---|
| 8 | INCDIR = Includes
|
---|
| 9 | LIBDIR = $(shell if [ -n "$(FROGDIR)" ];then echo $(FROGDIR)/soft/Lib;else echo Lib;fi)
|
---|
| 10 | RM = rm -f
|
---|
| 11 |
|
---|
| 12 | SHELL = /bin/sh
|
---|
| 13 |
|
---|
| 14 | ARCH=$(shell uname -a)
|
---|
| 15 |
|
---|
| 16 | OS=$(shell uname)
|
---|
| 17 |
|
---|
| 18 | ifeq (Darwin,$(findstring Darwin,$(OS)))
|
---|
| 19 | OSDEPENDENT=-Dmacos
|
---|
| 20 | FRAMEWORKS=-framework GLUT -lGL -lGLU -framework System
|
---|
| 21 | SOTYPE=.dylib
|
---|
| 22 | LDFLAGS=-g -prebind -dynamiclib
|
---|
| 23 |
|
---|
| 24 | ifeq (x86_64,$(findstring x86_64,$(ARCH)))
|
---|
| 25 | ARCHDEPENDENT=-L$(LIBDIR) -L/usr/X11R6/lib64 -Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib
|
---|
| 26 | else
|
---|
| 27 | ARCHDEPENDENT=-L$(LIBDIR) -L/usr/X11R6/lib -Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib
|
---|
| 28 | endif
|
---|
| 29 |
|
---|
| 30 | else
|
---|
| 31 | OSDEPENDENT=-Dlinux
|
---|
| 32 | SOTYPE=.so
|
---|
| 33 | LDFLAGS=-shared -Wl,-soname,
|
---|
| 34 |
|
---|
| 35 | ifeq (x86_64,$(findstring x86_64,$(ARCH)))
|
---|
| 36 | LIB=lib64
|
---|
| 37 | ARCHDEPENDENT=-L$(LIBDIR) -lglut -L/usr/lib -L/usr/X11/lib64 -L/usr/X11R6/lib64 -lGLU -lGL
|
---|
| 38 | else
|
---|
| 39 | LIB=lib32
|
---|
| 40 | ARCHDEPENDENT=-L$(LIBDIR) -lglut -L/usr/lib -lglut -L/usr/X11/lib -L/usr/X11R6/lib -lGLU -lGL
|
---|
| 41 | endif
|
---|
| 42 |
|
---|
| 43 | endif
|
---|
| 44 |
|
---|
| 45 |
|
---|
| 46 | OBJS = $(LIBDIR)/FROG_Light.o $(LIBDIR)/FROG_Primitives.o $(LIBDIR)/FROG_Geometry.o $(LIBDIR)/FROG_Events.o $(LIBDIR)/FROG_Texture.o $(LIBDIR)/FROG_ReadCards.o $(LIBDIR)/FROG_Camera.o $(LIBDIR)/FROG_Element_Tools.o $(LIBDIR)/FROG_Coord.o $(LIBDIR)/FROG_ZLib.o $(LIBDIR)/GL2PS.o $(LIBDIR)/GLEW.o
|
---|
| 47 |
|
---|
| 48 | all : main.cpp $(LIB) libfrog$(SOTYPE)
|
---|
| 49 | $(CXX) -Wall -o frog main.cpp $(CXXFLAGS) $(OSDEPENDENT) $(FRAMEWORKS) $(ARCHDEPENDENT) -lm -lX11 -lfrog -lpng -lz -lcurl -pthread
|
---|
| 50 |
|
---|
| 51 | $(LIBDIR)/%.o : $(SRCDIR)/%.cpp
|
---|
| 52 | $(CXX) -c $(CXXFLAGS) $(OSDEPENDENT) $< -fPIC -o $@
|
---|
| 53 |
|
---|
| 54 | $(LIBDIR)/%.o : $(INCDIR)/FROG/%.cpp
|
---|
| 55 | $(CXX) -c $(CXXFLAGS) $(OSDEPENDENT) $< -fPIC -o $@
|
---|
| 56 |
|
---|
| 57 | $(LIBDIR)/GL2PS.o : Includes/GL2PS/gl2ps.c
|
---|
| 58 | $(CXX) -c $(CXXFLAGS) $(OSDEPENDENT) $< -fPIC -o $@
|
---|
| 59 |
|
---|
| 60 | $(LIBDIR)/GLEW.o : Includes/GL/glew.c
|
---|
| 61 | $(CXX) -c $(CXXFLAGS) $(OSDEPENDENT) $< -fPIC -o $@
|
---|
| 62 |
|
---|
| 63 | lib64 :
|
---|
| 64 | @echo 'if [ ! -f $(LIBDIR)/libglut.so ];then ln -s /usr/lib64/libglut.so.3 $(LIBDIR)/libglut.so;fi'
|
---|
| 65 | @if [ ! -f $(LIBDIR)/libglut.so ];then ln -s /usr/lib64/libglut.so.3 $(LIBDIR)/libglut.so;fi
|
---|
| 66 | @echo 'if [ ! -f $(LIBDIR)/libpng.so ];then ln -s /usr/lib64/libpng.so.3 $(LIBDIR)/libpng.so;fi'
|
---|
| 67 | @if [ ! -f $(LIBDIR)/libpng.so ];then ln -s /usr/lib64/libpng.so.3 $(LIBDIR)/libpng.so;fi
|
---|
| 68 | lib32 :
|
---|
| 69 | @echo 'if [ ! -f $(LIBDIR)/libglut.so ];then ln -s /usr/lib/libglut.so.3 $(LIBDIR)/libglut.so;fi'
|
---|
| 70 | @if [ ! -f $(LIBDIR)/libglut.so ];then ln -s /usr/lib/libglut.so.3 $(LIBDIR)/libglut.so;fi
|
---|
| 71 | @echo 'if [ ! -f $(LIBDIR)/libpng.so ];then ln -s /usr/lib/libpng.so.3 $(LIBDIR)/libpng.so;fi'
|
---|
| 72 | @if [ ! -f $(LIBDIR)/libpng.so ];then ln -s /usr/lib/libpng.so.3 $(LIBDIR)/libpng.so;fi
|
---|
| 73 |
|
---|
| 74 | libfrog.dylib : $(OBJS)
|
---|
| 75 | $(CXX) $(LDFLAGS) $(OBJS) $(CXXFLAGS) $(OSDEPENDENT) $(FRAMEWORKS) $(ARCHDEPENDENT) -lX11 -lz -lpng -o $(LIBDIR)/$@
|
---|
| 76 |
|
---|
| 77 | libfrog.so : $(OBJS)
|
---|
| 78 | $(CXX) $(LDFLAGS)$(LIBDIR)/$@ -o $(LIBDIR)/$@ $(OBJS) -lc
|
---|
| 79 |
|
---|
| 80 | clean :
|
---|
| 81 | $(RM) $(LIBDIR)/*.o $(LIBDIR)/*$(SOTYPE)
|
---|