summaryrefslogtreecommitdiffstats
path: root/Samples/OculusWorldDemo/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Samples/OculusWorldDemo/Makefile')
-rw-r--r--Samples/OculusWorldDemo/Makefile77
1 files changed, 44 insertions, 33 deletions
diff --git a/Samples/OculusWorldDemo/Makefile b/Samples/OculusWorldDemo/Makefile
index 6015560..9791233 100644
--- a/Samples/OculusWorldDemo/Makefile
+++ b/Samples/OculusWorldDemo/Makefile
@@ -29,12 +29,9 @@
#
#############################################################################
-####### Detect system architecture
+##### Build flags
-SYSARCH = i386
-ifeq ($(shell uname -m),x86_64)
-SYSARCH = x86_64
-endif
+DEBUG = 0
####### Compiler, tools and options
@@ -43,10 +40,22 @@ LINK = g++
MAKE = make
DELETEFILE = rm -f
DEFINES = -DQT_WEBKIT -DGL_GLEXT_PROTOTYPES
+MD = mkdir
+
+####### Detect system architecture
+
+SYSARCH = i386
+ifeq ($(shell uname -m),x86_64)
+SYSARCH = x86_64
+endif
+
+####### Paths
+
+CUSTOM_PATH = $(RELEASETYPE)/$(SYSARCH)
+
####### Detect debug or release
-DEBUG = 0
ifeq ($(DEBUG), 1)
CXXFLAGS = -pipe -DDEBUG -g $(DEFINES)
LFLAGS =
@@ -60,6 +69,7 @@ endif
####### Paths
LIBOVRPATH = ../../LibOVR
+SRCPATH = .
COMMONSRCPATH = ../CommonSrc
3RDPARTYPATH = ../../3rdParty
INCPATH = -I. -I.. -I$(COMMONSRCPATH) -I$(LIBOVRPATH)/Include -I$(LIBOVRPATH)/Src
@@ -91,43 +101,44 @@ TARGET = ./Release/OculusWorldDemo_$(SYSARCH)_$(RELEASETYPE)
####### Rules
-all: $(TARGET)
+ALL_SRCS := $(shell find ${COMMONSRCPATH} -name "*.cpp")
+ALL_SRCS += $(shell find . -name "*.cpp")
-$(TARGET): $(LIBOVRPATH)/Lib/Linux/$(RELEASETYPE)/$(SYSARCH)/libovr.a
- $(MAKE) -C $(LIBOVRPATH) DEBUG=$(DEBUG)
-
-$(TARGET): $(OBJECTS)
- $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS)
+CPP_SRCS = $(filter-out \
+ $(COMMONSRCPATH)/Render/Render_D3D%.cpp \
+ $(COMMONSRCPATH)/Render/Render_GL_GLUT%.cpp \
+ $(COMMONSRCPATH)/Render/Render_GL_Win32%.cpp \
+ $(COMMONSRCPATH)/Render/Render_SDL%.cpp \
+ $(COMMONSRCPATH)/Platform/OSX_%.cpp \
+ $(COMMONSRCPATH)/Platform/Win32_%.cpp \
+ $(COMMONSRCPATH)/Platform/SDL_%.cpp \
+ $(COMMONSRCPATH)/Platform/GLUT_%.cpp \
+ , $(ALL_SRCS))
-$(OBJPATH)/OculusWorldDemo.o: OculusWorldDemo.cpp
- $(CXX_BUILD)OculusWorldDemo.o OculusWorldDemo.cpp
+OBJECTS_1 = $(patsubst ${SRCPATH}/%.cpp, ${OBJPATH}/%.o, ${CPP_SRCS})
+OBJECTS = $(patsubst ${COMMONSRCPATH}/%.cpp, ${OBJPATH}/%.o, ${OBJECTS_1})
-$(OBJPATH)/Player.o: Player.cpp
- $(CXX_BUILD)Player.o Player.cpp
+DIRS = $(subst /,/,$(sort $(dir $(OBJECTS)))) ./Release
-$(OBJPATH)/Platform.o: ../../Samples/CommonSrc/Platform/Platform.cpp
- $(CXX_BUILD)Platform.o ../../Samples/CommonSrc/Platform/Platform.cpp
-
-$(OBJPATH)/Linux_Platform.o: ../../Samples/CommonSrc/Platform/Linux_Platform.cpp
- $(CXX_BUILD)Linux_Platform.o ../../Samples/CommonSrc/Platform/Linux_Platform.cpp
+####### Files
-$(OBJPATH)/Linux_Gamepad.o: ../../Samples/CommonSrc/Platform/Linux_Gamepad.cpp
- $(CXX_BUILD)Linux_Gamepad.o ../../Samples/CommonSrc/Platform/Linux_Gamepad.cpp
+TARGET = ./Release/OculusWorldDemo_$(SYSARCH)_$(RELEASETYPE)
-$(OBJPATH)/Render_Device.o: ../../Samples/CommonSrc/Render/Render_Device.cpp $
- $(CXX_BUILD)Render_Device.o ../../Samples/CommonSrc/Render/Render_Device.cpp
+####### Rules
-$(OBJPATH)/Render_GL_Device.o: ../../Samples/CommonSrc/Render/Render_GL_Device.cpp
- $(CXX_BUILD)Render_GL_Device.o ../../Samples/CommonSrc/Render/Render_GL_Device.cpp
+all: $(TARGET)
-$(OBJPATH)/Render_LoadTextureDDS.o: ../../Samples/CommonSrc/Render/Render_LoadTextureDDS.cpp
- $(CXX_BUILD)Render_LoadTextureDDS.o ../../Samples/CommonSrc/Render/Render_LoadTextureDDS.cpp
+$(TARGET): $(OBJECTS)
+ mkdir -p $(DIRS)
+ $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS)
-$(OBJPATH)/Render_LoadTextureTGA.o: ../../Samples/CommonSrc/Render/Render_LoadTextureTGA.cpp
- $(CXX_BUILD)Render_LoadTextureTGA.o ../../Samples/CommonSrc/Render/Render_LoadTextureTGA.cpp
+$(OBJPATH)/%.o: $(COMMONSRCPATH)/%.cpp
+ mkdir -p $(DIRS)
+ $(CXX_BUILD) -o "$@" "$<"
-$(OBJPATH)/Render_XmlSceneLoader.o: ../../Samples/CommonSrc/Render/Render_XmlSceneLoader.cpp
- $(CXX_BUILD)Render_XmlSceneLoader.o ../../Samples/CommonSrc/Render/Render_XmlSceneLoader.cpp
+$(OBJPATH)/%.o: $(SRCPATH)/%.cpp
+ mkdir -p $(DIRS)
+ $(CXX_BUILD) -o "$@" "$<"
clean:
-$(DELETEFILE) $(OBJECTS)