CXX = g++ CXXFLAGS=-DFROG_OPENGL -DFROG_ZLIB -DFROG_LIGHTING -DFROG_CURL CXXFLAGSOPTIM=-O3 -funroll-loops -s CXXFLAGS+=$(CXXFLAGSOPTIM) LDFLAGS= SOTYPE= SRCDIR = ../src INCDIR = Includes #LIBDIR = $(shell if [ -n "$(FROGDIR)" ];then echo $(FROGDIR)/soft/Lib;else echo Lib;fi) PWD = $(shell pwd) LIBDIR = $(PWD)/Lib RM = rm -f SHELL = /bin/sh ARCH=$(shell uname -a) OS=$(shell uname) ifeq (Darwin,$(findstring Darwin,$(OS))) OSDEPENDENT=-Dmacos FRAMEWORKS=-framework GLUT -lGL -lGLU -framework System SOTYPE=.dylib LDFLAGS=-g -prebind -dynamiclib ifeq (x86_64,$(findstring x86_64,$(ARCH))) 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 else 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 endif else OSDEPENDENT=-Dlinux SOTYPE=.so LDFLAGS=-shared -Wl,-soname, ifeq (x86_64,$(findstring x86_64,$(ARCH))) LIB=lib64 ARCHDEPENDENT=-L$(LIBDIR) -lglut -L/usr/lib -L/usr/X11/lib64 -L/usr/X11R6/lib64 -lGLU -lGL else LIB=lib32 ARCHDEPENDENT=-L$(LIBDIR) -lglut -L/usr/lib -lglut -L/usr/X11/lib -L/usr/X11R6/lib -lGLU -lGL endif endif OBJS = $(LIBDIR)/FROG_Path.o $(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 $(LIBDIR)/FROG_Net_Tools.o all : main.cpp $(LIB) libfrog$(SOTYPE) $(CXX) -Wall -o frog main.cpp $(CXXFLAGS) $(OSDEPENDENT) $(FRAMEWORKS) $(ARCHDEPENDENT) -lm -lX11 -lfrog -lpng -lz -lcurl -pthread $(LIBDIR)/%.o : $(SRCDIR)/%.cpp $(CXX) -c $(CXXFLAGS) $(OSDEPENDENT) $< -fPIC -o $@ $(LIBDIR)/%.o : $(INCDIR)/FROG/%.cpp $(CXX) -c $(CXXFLAGS) $(OSDEPENDENT) $< -fPIC -o $@ $(LIBDIR)/GL2PS.o : Includes/GL2PS/gl2ps.c $(CXX) -c $(CXXFLAGS) $(OSDEPENDENT) $< -fPIC -o $@ $(LIBDIR)/GLEW.o : Includes/GL/glew.c $(CXX) -c $(CXXFLAGS) $(OSDEPENDENT) $< -fPIC -o $@ lib64 : @echo 'if [ ! -f $(LIBDIR)/libglut.so ];then ln -s /usr/lib64/libglut.so.3 $(LIBDIR)/libglut.so;fi' @if [ ! -f $(LIBDIR)/libglut.so ];then ln -s /usr/lib64/libglut.so.3 $(LIBDIR)/libglut.so;fi @echo 'if [ ! -f $(LIBDIR)/libpng.so ];then ln -s /usr/lib64/libpng.so.3 $(LIBDIR)/libpng.so;fi' @if [ ! -f $(LIBDIR)/libpng.so ];then ln -s /usr/lib64/libpng.so.3 $(LIBDIR)/libpng.so;fi lib32 : @echo 'if [ ! -f $(LIBDIR)/libglut.so ];then ln -s /usr/lib/libglut.so.3 $(LIBDIR)/libglut.so;fi' @if [ ! -f $(LIBDIR)/libglut.so ];then ln -s /usr/lib/libglut.so.3 $(LIBDIR)/libglut.so;fi @echo 'if [ ! -f $(LIBDIR)/libpng.so ];then ln -s /usr/lib/libpng.so.3 $(LIBDIR)/libpng.so;fi' @if [ ! -f $(LIBDIR)/libpng.so ];then ln -s /usr/lib/libpng.so.3 $(LIBDIR)/libpng.so;fi libfrog.dylib : $(OBJS) $(CXX) $(LDFLAGS) $(OBJS) $(CXXFLAGS) $(OSDEPENDENT) $(FRAMEWORKS) $(ARCHDEPENDENT) -lX11 -lz -lpng -o $(LIBDIR)/$@ libfrog.so : $(OBJS) $(CXX) $(LDFLAGS)$(LIBDIR)/$@ -o $(LIBDIR)/$@ $(OBJS) -lc clean : $(RM) $(LIBDIR)/*.o $(RM) $(LIBDIR)/*$(SOTYPE)