1 | CXX = g++
|
---|
2 | CXXFLAGS=-DFROG_OPENGL -DFROG_ZLIB -DFROG_LIGHTING -DFROG_CURL
|
---|
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 | PWD = $(shell pwd)
|
---|
11 | LIBDIR = $(PWD)/Lib
|
---|
12 | RM = rm -f
|
---|
13 |
|
---|
14 | SHELL = /bin/sh
|
---|
15 |
|
---|
16 | ARCH=$(shell uname -a)
|
---|
17 |
|
---|
18 | OS=$(shell uname)
|
---|
19 |
|
---|
20 | ifeq (Darwin,$(findstring Darwin,$(OS)))
|
---|
21 | OSDEPENDENT=-Dmacos
|
---|
22 | FRAMEWORKS=-framework GLUT -lGL -lGLU -framework System
|
---|
23 | SOTYPE=.dylib
|
---|
24 | LDFLAGS=-g -prebind -dynamiclib
|
---|
25 |
|
---|
26 | ifeq (x86_64,$(findstring x86_64,$(ARCH)))
|
---|
27 | 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
|
---|
28 | else
|
---|
29 | 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
|
---|
30 | endif
|
---|
31 |
|
---|
32 | else
|
---|
33 | OSDEPENDENT=-Dlinux
|
---|
34 | SOTYPE=.so
|
---|
35 | LDFLAGS=-shared -Wl,-soname,
|
---|
36 |
|
---|
37 | ifeq (x86_64,$(findstring x86_64,$(ARCH)))
|
---|
38 | LIB=lib64
|
---|
39 | ARCHDEPENDENT=-L$(LIBDIR) -lglut -L/usr/lib -L/usr/X11/lib64 -L/usr/X11R6/lib64 -lGLU -lGL
|
---|
40 | else
|
---|
41 | LIB=lib32
|
---|
42 | ARCHDEPENDENT=-L$(LIBDIR) -lglut -L/usr/lib -lglut -L/usr/X11/lib -L/usr/X11R6/lib -lGLU -lGL
|
---|
43 | endif
|
---|
44 |
|
---|
45 | endif
|
---|
46 |
|
---|
47 |
|
---|
48 | 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
|
---|
49 |
|
---|
50 | all : main.cpp $(LIB) libfrog$(SOTYPE)
|
---|
51 | $(CXX) -Wall -o frog main.cpp $(CXXFLAGS) $(OSDEPENDENT) $(FRAMEWORKS) $(ARCHDEPENDENT) -lm -lX11 -lfrog -lpng -lz -lcurl -pthread
|
---|
52 |
|
---|
53 | $(LIBDIR)/%.o : $(SRCDIR)/%.cpp
|
---|
54 | $(CXX) -c $(CXXFLAGS) $(OSDEPENDENT) $< -fPIC -o $@
|
---|
55 |
|
---|
56 | $(LIBDIR)/%.o : $(INCDIR)/FROG/%.cpp
|
---|
57 | $(CXX) -c $(CXXFLAGS) $(OSDEPENDENT) $< -fPIC -o $@
|
---|
58 |
|
---|
59 | $(LIBDIR)/GL2PS.o : Includes/GL2PS/gl2ps.c
|
---|
60 | $(CXX) -c $(CXXFLAGS) $(OSDEPENDENT) $< -fPIC -o $@
|
---|
61 |
|
---|
62 | $(LIBDIR)/GLEW.o : Includes/GL/glew.c
|
---|
63 | $(CXX) -c $(CXXFLAGS) $(OSDEPENDENT) $< -fPIC -o $@
|
---|
64 |
|
---|
65 | lib64 :
|
---|
66 | @if [ ! -d $(LIBDIR) ];then mkdir $(LIBDIR); fi;
|
---|
67 | @echo 'if [ ! -f $(LIBDIR)/libglut.so ];then ln -s /usr/lib64/libglut.so.3 $(LIBDIR)/libglut.so;fi'
|
---|
68 | @if [ ! -f $(LIBDIR)/libglut.so ];then ln -s /usr/lib64/libglut.so.3 $(LIBDIR)/libglut.so;fi
|
---|
69 | @echo 'if [ ! -f $(LIBDIR)/libpng.so ];then ln -s /usr/lib64/libpng.so.3 $(LIBDIR)/libpng.so;fi'
|
---|
70 | @if [ ! -f $(LIBDIR)/libpng.so ];then ln -s /usr/lib64/libpng.so.3 $(LIBDIR)/libpng.so;fi
|
---|
71 | lib32 :
|
---|
72 | @if [ ! -d $(LIBDIR) ];then mkdir $(LIBDIR); fi;
|
---|
73 | @echo 'if [ ! -f $(LIBDIR)/libglut.so ];then ln -s /usr/lib/libglut.so.3 $(LIBDIR)/libglut.so;fi'
|
---|
74 | @if [ ! -f $(LIBDIR)/libglut.so ];then ln -s /usr/lib/libglut.so.3 $(LIBDIR)/libglut.so;fi
|
---|
75 | @echo 'if [ ! -f $(LIBDIR)/libpng.so ];then ln -s /usr/lib/libpng.so.3 $(LIBDIR)/libpng.so;fi'
|
---|
76 | @if [ ! -f $(LIBDIR)/libpng.so ];then ln -s /usr/lib/libpng.so.3 $(LIBDIR)/libpng.so;fi
|
---|
77 |
|
---|
78 | libfrog.dylib : $(OBJS)
|
---|
79 | @if [ ! -d $(LIBDIR) ];then mkdir $(LIBDIR); fi;
|
---|
80 | $(CXX) $(LDFLAGS) $(OBJS) $(CXXFLAGS) $(OSDEPENDENT) $(FRAMEWORKS) $(ARCHDEPENDENT) -lX11 -lz -lpng -o $(LIBDIR)/$@
|
---|
81 |
|
---|
82 | libfrog.so : $(OBJS)
|
---|
83 | @if [ ! -d $(LIBDIR) ];then mkdir $(LIBDIR); fi;
|
---|
84 | $(CXX) $(LDFLAGS)$(LIBDIR)/$@ -o $(LIBDIR)/$@ $(OBJS) -lc
|
---|
85 |
|
---|
86 | clean :
|
---|
87 | $(RM) $(LIBDIR)/*.o
|
---|
88 | $(RM) $(LIBDIR)/*$(SOTYPE)
|
---|