diff mbox

[Branch,~glmark2-dev/glmark2/trunk] Rev 14: Improve Makefile.

Message ID 20110721123630.17019.79036.launchpad@loganberry.canonical.com
State Accepted
Headers show

Commit Message

Alexandros Frantzis July 21, 2011, 12:36 p.m. UTC
------------------------------------------------------------
revno: 14
committer: Alexandros Frantzis <alf82@freemail.gr>
timestamp: Thu 2010-07-08 13:29:59 +0300
message:
  Improve Makefile.
  Add support for installing the data files to arbitrary locations.
removed:
  makefile
added:
  Makefile
modified:
  scenebuild.cpp
  sceneshading.cpp
  scenetexture.cpp


--
lp:glmark2
https://code.launchpad.net/~glmark2-dev/glmark2/trunk

You are subscribed to branch lp:glmark2.
To unsubscribe from this branch go to https://code.launchpad.net/~glmark2-dev/glmark2/trunk/+edit-subscription
diff mbox

Patch

=== added file 'Makefile'
--- Makefile	1970-01-01 00:00:00 +0000
+++ Makefile	2010-07-08 10:29:59 +0000
@@ -0,0 +1,24 @@ 
+INSTALL = install -D
+INSTALL_DATA = $(INSTALL) -m644
+
+PKG_DEPS = sdl gl glu
+PKG_LIBS = $(shell pkg-config --libs $(PKG_DEPS))
+PKG_CFLAGS = $(shell pkg-config --cflags $(PKG_DEPS))
+
+ALL_CFLAGS = -Wall -g -O2 $(CFLAGS) $(PKG_CFLAGS) 
+ALL_DEFINES = -DGLMARK_DATA_PATH=\"$(GLMARK_DATA_PATH)\" $(DEFINES)
+
+SRCS = $(wildcard *.cpp)
+OBJS = $(SRCS:.cpp=.o)
+
+.cpp.o:
+	$(CXX) $(ALL_CFLAGS) $(ALL_DEFINES) -c $< -o $@
+
+glmark: $(OBJS)
+	$(CXX) -o glmark $(LDFLAGS) $(PKG_LIBS) $(OBJS)
+
+install: glmark
+	$(INSTALL) glmark $(DESTDIR)/usr/bin/glmark
+
+clean:
+	-rm glmark $(OBJS)

=== removed file 'makefile'
--- makefile	2010-07-07 12:33:49 +0000
+++ makefile	1970-01-01 00:00:00 +0000
@@ -1,2 +0,0 @@ 
-all:
-	g++ *.cpp -o glmark -Wall -lSDL -lGL -lGLU

=== modified file 'scenebuild.cpp'
--- scenebuild.cpp	2010-07-07 12:38:01 +0000
+++ scenebuild.cpp	2010-07-08 10:29:59 +0000
@@ -4,7 +4,7 @@ 
 {
     Model model;
     
-    if(!model.load_3ds("data/models/horse.3ds"))
+    if(!model.load_3ds(GLMARK_DATA_PATH"data/models/horse.3ds"))
         return 0;
         
     model.calculate_normals();

=== modified file 'sceneshading.cpp'
--- sceneshading.cpp	2010-07-08 09:13:59 +0000
+++ sceneshading.cpp	2010-07-08 10:29:59 +0000
@@ -8,7 +8,7 @@ 
 {
     Model model;
     
-    if(!model.load_3ds("data/models/cat.3ds"))
+    if(!model.load_3ds(GLMARK_DATA_PATH"data/models/cat.3ds"))
         return 0;
         
     model.calculate_normals();
@@ -16,8 +16,10 @@ 
     
     mMesh.build_vbo();
     
-    mShader[0].load("data/shaders/light-basic.vert", "data/shaders/light-basic.frag");
-    mShader[1].load("data/shaders/light-advanced.vert", "data/shaders/light-advanced.frag");
+    mShader[0].load(GLMARK_DATA_PATH"data/shaders/light-basic.vert",
+                    GLMARK_DATA_PATH"data/shaders/light-basic.frag");
+    mShader[1].load(GLMARK_DATA_PATH"data/shaders/light-advanced.vert",
+                    GLMARK_DATA_PATH"data/shaders/light-advanced.frag");
 
     mRotationSpeed = 36.0f;
     mRotation = 0.0f;

=== modified file 'scenetexture.cpp'
--- scenetexture.cpp	2010-07-08 08:18:12 +0000
+++ scenetexture.cpp	2010-07-08 10:29:59 +0000
@@ -10,10 +10,10 @@ 
 {
     Model model;
     
-    if(!model.load_3ds("data/models/cube.3ds"))
+    if(!model.load_3ds(GLMARK_DATA_PATH"data/models/cube.3ds"))
         return 0;
     
-    if(!load_texture("data/textures/crate-base.bmp", mTexture))
+    if(!load_texture(GLMARK_DATA_PATH"data/textures/crate-base.bmp", mTexture))
         return 0;
     
     model.calculate_normals();