diff options
-rw-r--r-- | LibOVR/Makefile | 215 | ||||
-rw-r--r-- | LibOVR/Projects/Linux/Makefile | 85 | ||||
-rw-r--r-- | LibOVR/Projects/Linux/Makefile.common | 37 | ||||
-rw-r--r-- | LibOVR/Src/Kernel/OVR_Types.h | 14 | ||||
-rw-r--r-- | Makefile | 27 | ||||
-rw-r--r-- | Samples/CommonSrc/Makefile | 7 | ||||
-rw-r--r-- | Samples/OculusWorldDemo/Makefile | 77 |
7 files changed, 186 insertions, 276 deletions
diff --git a/LibOVR/Makefile b/LibOVR/Makefile deleted file mode 100644 index 174e8a5..0000000 --- a/LibOVR/Makefile +++ /dev/null @@ -1,215 +0,0 @@ -############################################################################# -# -# Filename : Makefile -# Content : Makefile for building linux version of: libovr -# Created : 2013 -# Authors : Simon Hallam and Peter Giokaris -# Copyright : Copyright 2013 OculusVR, Inc. All Rights Reserved -# Instruction : The g++ compiler and stdndard lib packages need to be -# installed on the system. Navigate in a shell to the -# directory where this Makefile is located and enter: -# -# make builds the release version for the -# current architechture -# make clean delete intermediate release object files -# and the library file -# make DEBUG=1 builds the debug version for the current -# architechture -# make clean DEBUG=1 deletes intermediate debug object files -# and the library file -# -# Output : Relative to the directory this Makefile lives in, libraries -# are built at the following locations depending upon the -# architechture of the system you are running: -# -# ./Lib/Linux/Debug/i386/libovr.a -# ./Lib/Linux/Debug/x86_64/libovr.a -# ./Lib/Linux/Release/i386/libovr.a -# ./Lib/Linux/Release/x86_64/libovr.a -# -############################################################################# - -####### Detect system architecture - -SYSARCH = i386 -ifeq ($(shell uname -m),x86_64) -SYSARCH = x86_64 -endif - -####### Compiler, tools and options - -CXX = g++ -LINK = ar rvs -DELETEFILE = rm -f - -####### Detect debug or release - -DEBUG = 0 -ifeq ($(DEBUG), 1) - CXXFLAGS = -pipe -fPIC -DDEBUG -g - RELEASETYPE = Debug -else - CXXFLAGS = -pipe -fPIC -O2 - RELEASETYPE = Release -endif - -####### Paths - -LIBOVRPATH = . -3RDPARTYPATH = ../3rdParty -INCPATH = -I. -I.. -I$(LIBOVRPATH)/Include -I$(LIBOVRPATH)/Src -OBJPATH = ./Obj/Linux/$(RELEASETYPE)/$(SYSARCH) -CXXBUILD = $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJPATH)/ - -####### Files - -TARGET = ./Lib/Linux/$(RELEASETYPE)/$(SYSARCH)/libovr.a - -OBJECTS = $(OBJPATH)/OVR_DeviceHandle.o \ - $(OBJPATH)/OVR_DeviceImpl.o \ - $(OBJPATH)/OVR_JSON.o \ - $(OBJPATH)/OVR_LatencyTestImpl.o \ - $(OBJPATH)/OVR_Profile.o \ - $(OBJPATH)/OVR_SensorFilter.o\ - $(OBJPATH)/OVR_SensorFusion.o\ - $(OBJPATH)/OVR_SensorImpl.o \ - $(OBJPATH)/OVR_ThreadCommandQueue.o \ - $(OBJPATH)/OVR_Alg.o \ - $(OBJPATH)/OVR_Allocator.o \ - $(OBJPATH)/OVR_Atomic.o \ - $(OBJPATH)/OVR_File.o \ - $(OBJPATH)/OVR_FileFILE.o \ - $(OBJPATH)/OVR_Log.o \ - $(OBJPATH)/OVR_Math.o \ - $(OBJPATH)/OVR_RefCount.o \ - $(OBJPATH)/OVR_Std.o \ - $(OBJPATH)/OVR_String.o \ - $(OBJPATH)/OVR_String_FormatUtil.o \ - $(OBJPATH)/OVR_String_PathUtil.o \ - $(OBJPATH)/OVR_SysFile.o \ - $(OBJPATH)/OVR_System.o \ - $(OBJPATH)/OVR_Timer.o \ - $(OBJPATH)/OVR_UTF8Util.o \ - $(OBJPATH)/Util_LatencyTest.o \ - $(OBJPATH)/Util_MagCalibration.o \ - $(OBJPATH)/Util_Render_Stereo.o \ - $(OBJPATH)/OVR_ThreadsPthread.o \ - $(OBJPATH)/OVR_Linux_HIDDevice.o \ - $(OBJPATH)/OVR_Linux_SensorDevice.o \ - $(OBJPATH)/OVR_Linux_DeviceManager.o \ - $(OBJPATH)/OVR_Linux_HMDDevice.o \ - $(OBJPATH)/tinyxml2.o - -####### Rules - -all: $(TARGET) - -$(TARGET): $(OBJECTS) - $(LINK) $(TARGET) $(OBJECTS) - -$(OBJPATH)/OVR_DeviceHandle.o: $(LIBOVRPATH)/Src/OVR_DeviceHandle.cpp - $(CXXBUILD)OVR_DeviceHandle.o $(LIBOVRPATH)/Src/OVR_DeviceHandle.cpp - -$(OBJPATH)/OVR_DeviceImpl.o: $(LIBOVRPATH)/Src/OVR_DeviceImpl.cpp - $(CXXBUILD)OVR_DeviceImpl.o $(LIBOVRPATH)/Src/OVR_DeviceImpl.cpp - -$(OBJPATH)/OVR_JSON.o: $(LIBOVRPATH)/Src/OVR_JSON.cpp - $(CXXBUILD)OVR_JSON.o $(LIBOVRPATH)/Src/OVR_JSON.cpp - -$(OBJPATH)/OVR_LatencyTestImpl.o: $(LIBOVRPATH)/Src/OVR_LatencyTestImpl.cpp - $(CXXBUILD)OVR_LatencyTestImpl.o $(LIBOVRPATH)/Src/OVR_LatencyTestImpl.cpp - -$(OBJPATH)/OVR_Profile.o: $(LIBOVRPATH)/Src/OVR_Profile.cpp - $(CXXBUILD)OVR_Profile.o $(LIBOVRPATH)/Src/OVR_Profile.cpp - -$(OBJPATH)/OVR_SensorFilter.o: $(LIBOVRPATH)/Src/OVR_SensorFilter.cpp - $(CXXBUILD)OVR_SensorFilter.o $(LIBOVRPATH)/Src/OVR_SensorFilter.cpp - -$(OBJPATH)/OVR_SensorFusion.o: $(LIBOVRPATH)/Src/OVR_SensorFusion.cpp - $(CXXBUILD)OVR_SensorFusion.o $(LIBOVRPATH)/Src/OVR_SensorFusion.cpp - -$(OBJPATH)/OVR_SensorImpl.o: $(LIBOVRPATH)/Src/OVR_SensorImpl.cpp - $(CXXBUILD)OVR_SensorImpl.o $(LIBOVRPATH)/Src/OVR_SensorImpl.cpp - -$(OBJPATH)/OVR_ThreadCommandQueue.o: $(LIBOVRPATH)/Src/OVR_ThreadCommandQueue.cpp - $(CXXBUILD)OVR_ThreadCommandQueue.o $(LIBOVRPATH)/Src/OVR_ThreadCommandQueue.cpp - -$(OBJPATH)/OVR_Alg.o: $(LIBOVRPATH)/Src/Kernel/OVR_Alg.cpp - $(CXXBUILD)OVR_Alg.o $(LIBOVRPATH)/Src/Kernel/OVR_Alg.cpp - -$(OBJPATH)/OVR_Allocator.o: $(LIBOVRPATH)/Src/Kernel/OVR_Allocator.cpp - $(CXXBUILD)OVR_Allocator.o $(LIBOVRPATH)/Src/Kernel/OVR_Allocator.cpp - -$(OBJPATH)/OVR_Atomic.o: $(LIBOVRPATH)/Src/Kernel/OVR_Atomic.cpp - $(CXXBUILD)OVR_Atomic.o $(LIBOVRPATH)/Src/Kernel/OVR_Atomic.cpp - -$(OBJPATH)/OVR_File.o: $(LIBOVRPATH)/Src/Kernel/OVR_File.cpp - $(CXXBUILD)OVR_File.o $(LIBOVRPATH)/Src/Kernel/OVR_File.cpp - -$(OBJPATH)/OVR_FileFILE.o: $(LIBOVRPATH)/Src/Kernel/OVR_FileFILE.cpp - $(CXXBUILD)OVR_FileFILE.o $(LIBOVRPATH)/Src/Kernel/OVR_FileFILE.cpp - -$(OBJPATH)/OVR_Log.o: $(LIBOVRPATH)/Src/Kernel/OVR_Log.cpp - $(CXXBUILD)OVR_Log.o $(LIBOVRPATH)/Src/Kernel/OVR_Log.cpp - -$(OBJPATH)/OVR_Math.o: $(LIBOVRPATH)/Src/Kernel/OVR_Math.cpp - $(CXXBUILD)OVR_Math.o $(LIBOVRPATH)/Src/Kernel/OVR_Math.cpp - -$(OBJPATH)/OVR_RefCount.o: $(LIBOVRPATH)/Src/Kernel/OVR_RefCount.cpp - $(CXXBUILD)OVR_RefCount.o $(LIBOVRPATH)/Src/Kernel/OVR_RefCount.cpp - -$(OBJPATH)/OVR_Std.o: $(LIBOVRPATH)/Src/Kernel/OVR_Std.cpp - $(CXXBUILD)OVR_Std.o $(LIBOVRPATH)/Src/Kernel/OVR_Std.cpp - -$(OBJPATH)/OVR_String.o: $(LIBOVRPATH)/Src/Kernel/OVR_String.cpp - $(CXXBUILD)OVR_String.o $(LIBOVRPATH)/Src/Kernel/OVR_String.cpp - -$(OBJPATH)/OVR_String_FormatUtil.o: $(LIBOVRPATH)/Src/Kernel/OVR_String_FormatUtil.cpp - $(CXXBUILD)OVR_String_FormatUtil.o $(LIBOVRPATH)/Src/Kernel/OVR_String_FormatUtil.cpp - -$(OBJPATH)/OVR_String_PathUtil.o: $(LIBOVRPATH)/Src/Kernel/OVR_String_PathUtil.cpp - $(CXXBUILD)OVR_String_PathUtil.o $(LIBOVRPATH)/Src/Kernel/OVR_String_PathUtil.cpp - -$(OBJPATH)/OVR_SysFile.o: $(LIBOVRPATH)/Src/Kernel/OVR_SysFile.cpp - $(CXXBUILD)OVR_SysFile.o $(LIBOVRPATH)/Src/Kernel/OVR_SysFile.cpp - -$(OBJPATH)/OVR_System.o: $(LIBOVRPATH)/Src/Kernel/OVR_System.cpp - $(CXXBUILD)OVR_System.o $(LIBOVRPATH)/Src/Kernel/OVR_System.cpp - -$(OBJPATH)/OVR_Timer.o: $(LIBOVRPATH)/Src/Kernel/OVR_Timer.cpp - $(CXXBUILD)OVR_Timer.o $(LIBOVRPATH)/Src/Kernel/OVR_Timer.cpp - -$(OBJPATH)/OVR_UTF8Util.o: $(LIBOVRPATH)/Src/Kernel/OVR_UTF8Util.cpp - $(CXXBUILD)OVR_UTF8Util.o $(LIBOVRPATH)/Src/Kernel/OVR_UTF8Util.cpp - -$(OBJPATH)/Util_LatencyTest.o: $(LIBOVRPATH)/Src/Util/Util_LatencyTest.cpp - $(CXXBUILD)Util_LatencyTest.o $(LIBOVRPATH)/Src/Util/Util_LatencyTest.cpp - -$(OBJPATH)/Util_MagCalibration.o: $(LIBOVRPATH)/Src/Util/Util_MagCalibration.cpp - $(CXXBUILD)Util_MagCalibration.o $(LIBOVRPATH)/Src/Util/Util_MagCalibration.cpp - -$(OBJPATH)/Util_Render_Stereo.o: $(LIBOVRPATH)/Src/Util/Util_Render_Stereo.cpp - $(CXXBUILD)Util_Render_Stereo.o $(LIBOVRPATH)/Src/Util/Util_Render_Stereo.cpp - -$(OBJPATH)/OVR_ThreadsPthread.o: $(LIBOVRPATH)/Src/Kernel/OVR_ThreadsPthread.cpp - $(CXXBUILD)OVR_ThreadsPthread.o $(LIBOVRPATH)/Src/Kernel/OVR_ThreadsPthread.cpp - -$(OBJPATH)/OVR_Linux_HIDDevice.o: $(LIBOVRPATH)/Src/OVR_Linux_HIDDevice.cpp - $(CXXBUILD)OVR_Linux_HIDDevice.o $(LIBOVRPATH)/Src/OVR_Linux_HIDDevice.cpp - -$(OBJPATH)/OVR_Linux_SensorDevice.o: $(LIBOVRPATH)/Src/OVR_Linux_SensorDevice.cpp - $(CXXBUILD)OVR_Linux_SensorDevice.o $(LIBOVRPATH)/Src/OVR_Linux_SensorDevice.cpp - -$(OBJPATH)/OVR_Linux_DeviceManager.o: $(LIBOVRPATH)/Src/OVR_Linux_DeviceManager.cpp - $(CXXBUILD)OVR_Linux_DeviceManager.o $(LIBOVRPATH)/Src/OVR_Linux_DeviceManager.cpp - -$(OBJPATH)/OVR_Linux_HMDDevice.o: $(LIBOVRPATH)/Src/OVR_Linux_HMDDevice.cpp - $(CXXBUILD)OVR_Linux_HMDDevice.o $(LIBOVRPATH)/Src/OVR_Linux_HMDDevice.cpp - -$(OBJPATH)/tinyxml2.o: $(3RDPARTYPATH)/TinyXml/tinyxml2.cpp - $(CXXBUILD)tinyxml2.o $(3RDPARTYPATH)/TinyXml/tinyxml2.cpp - -clean: - -$(DELETEFILE) $(OBJECTS) - -$(DELETEFILE) $(TARGET) - diff --git a/LibOVR/Projects/Linux/Makefile b/LibOVR/Projects/Linux/Makefile new file mode 100644 index 0000000..008a158 --- /dev/null +++ b/LibOVR/Projects/Linux/Makefile @@ -0,0 +1,85 @@ +############################################################################# +# +# Filename : Makefile +# Content : Makefile for building linux version of: libovr +# Created : 2013 +# Authors : Simon Hallam and Peter Giokaris +# Copyright : Copyright 2013 OculusVR, Inc. All Rights Reserved +# Instruction : The g++ compiler and stdndard lib packages need to be +# installed on the system. Navigate in a shell to the +# directory where this Makefile is located and enter: +# +# make builds the release version for the +# current architechture +# make clean delete intermediate release object files +# and the library file +# make DEBUG=1 builds the debug version for the current +# architechture +# make clean DEBUG=1 deletes intermediate debug object files +# and the library file +# +# Output : Relative to the directory this Makefile lives in, libraries +# are built at the following locations depending upon the +# architechture of the system you are running: +# +# ./Lib/Linux/Debug/i386/libovr.a +# ./Lib/Linux/Debug/x86_64/libovr.a +# ./Lib/Linux/Release/i386/libovr.a +# ./Lib/Linux/Release/x86_64/libovr.a +# +############################################################################# + +##### Build flags + +DEBUG = 0 +OVR_ROOT = ../../.. + +include $(OVR_ROOT)/LibOVR/Projects/Linux/Makefile.common + +LINK = $(LINK_ARCHIVE) +INCPATH = $(LIBOVRINCPATH) +SRCPATH = $(LIBOVRPATH)/Src +OBJPATH = $(LIBOVRPATH)/Obj/Linux/$(CUSTOM_PATH) +TARGETPATH = $(LIBOVRPATH)/Lib/Linux/$(CUSTOM_PATH) + +CXXBUILD = $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJPATH)/ + +####### Files + +TARGET = $(TARGETPATH)/libovr.a + +# Filter out Windows and OSX files +CPP_SRCS = $(filter-out \ + $(SRCPATH)/OVR_Win32%.cpp \ + ${SRCPATH}/OVR_OSX%.cpp \ + ${SRCPATH}/OVR_Posix%.cpp \ + ${SRCPATH}/Kernel/OVR_ThreadsWinAPI.cpp \ + , $(shell find ${SRCPATH} -name *.cpp)) \ + + +OBJECTS = $(patsubst ${SRCPATH}/%.cpp, ${OBJPATH}/%.o, ${CPP_SRCS}) $(OBJPATH)/tinyxml2.o + +DIRS = $(subst /,/,$(sort $(dir $(OBJECTS)))) $(TARGETPATH) + +####### Rules + +all: $(TARGET) + +$(TARGET): $(TARGET_PATH) $(OBJECTS) $(LIBOVRTARGET_PATH) + $(MD) -p $(DIRS) + $(LINK) $(TARGET) $(OBJECTS) + +$(OBJPATH): + $(MD) -p $(DIRS) + +$(OBJPATH)/%.o: $(SRCPATH)/%.cpp + $(MD) -p $(DIRS) + $(CXXBUILD) -o "$@" "$<" + +$(OBJPATH)/tinyxml2.o: $(3RDPARTYPATH)/TinyXml/tinyxml2.cpp + $(CXXBUILD) -o "$@" "$<" + +clean: + -$(DELETEFILE) $(OBJECTS) + -$(DELETEFILE) $(TARGET) + diff --git a/LibOVR/Projects/Linux/Makefile.common b/LibOVR/Projects/Linux/Makefile.common new file mode 100644 index 0000000..1335b87 --- /dev/null +++ b/LibOVR/Projects/Linux/Makefile.common @@ -0,0 +1,37 @@ +############################################################################# +# +# Filename : Makefile.common +# Content : Common values for all makefiles in the Oculus SDK +# +# You must define OVR_ROOT before including this file +# +############################################################################# + +CXX = g++ +CXXFLAGS = -fPIC -pipe $(DEFINES) +MD = mkdir +DELETEFILE = rm -f +LINK_ARCHIVE = ar rvs +LINK_LIBRARY = +LINK_EXE = g++ +SYSARCH = $(shell uname -m) + +####### Detect debug or release + +ifeq ($(DEBUG), 1) + CXXFLAGS += -DDEBUG -g + RELEASETYPE = Debug +else + CXXFLAGS += -O2 + RELEASETYPE = Release +endif + +CUSTOM_PATH = $(RELEASETYPE)/$(SYSARCH) + +####### Paths +LIBOVRPATH = $(OVR_ROOT)/LibOVR +3RDPARTYPATH = $(OVR_ROOT)/3rdParty +LIBOVRINCPATH = -I$(LIBOVRPATH)/Include -I$(LIBOVRPATH)/Src +LIBOVRLIBPATH = $(LIBOVRPATH)/Lib/Linux/$(CUSTOM_PATH) +LIBOVRARCHIVE = $(LIBOVRLIBPATH)/libovr.a + diff --git a/LibOVR/Src/Kernel/OVR_Types.h b/LibOVR/Src/Kernel/OVR_Types.h index db024f1..adf678a 100644 --- a/LibOVR/Src/Kernel/OVR_Types.h +++ b/LibOVR/Src/Kernel/OVR_Types.h @@ -4,7 +4,7 @@ PublicHeader: OVR.h Filename : OVR_Types.h Content : Standard library defines and simple types Created : September 19, 2012 -Notes : +Notes : Copyright : Copyright 2012 Oculus VR, Inc. All Rights reserved. @@ -215,7 +215,7 @@ typedef unsigned long UInt32; typedef __int64 SInt64; // 64 bit Integer (QWord) typedef unsigned __int64 UInt64; - + #elif defined(OVR_OS_MAC) || defined(OVR_OS_IPHONE) || defined(OVR_CC_GNU) typedef int SByte __attribute__((__mode__ (__QI__))); @@ -276,7 +276,7 @@ namespace BaseTypes // OVR_FORCE_INLINE - Forces inline expansion of function // OVR_ASM - Assembly language prefix // OVR_STR - Prefixes string with L"" if building unicode -// +// // OVR_STDCALL - Use stdcall calling convention (Pascal arg order) // OVR_CDECL - Use cdecl calling convention (C argument order) // OVR_FASTCALL - Use fastcall calling convention (registers) @@ -298,7 +298,7 @@ namespace BaseTypes #if defined(OVR_OS_WIN32) - + // ***** Win32 // Byte order @@ -340,12 +340,12 @@ namespace BaseTypes #else # define OVR_BYTE_ORDER OVR_LITTLE_ENDIAN #endif - + // Assembly macros #define OVR_ASM __asm__ #define OVR_ASM_PROC(procname) OVR_ASM #define OVR_ASM_END OVR_ASM - + // Calling convention - goes after function return type but before function name #define OVR_FASTCALL #define OVR_STDCALL @@ -364,7 +364,7 @@ namespace BaseTypes # define OVR_DEBUG_BREAK ((void)0) # define OVR_ASSERT(p) ((void)0) -#else +#else // Microsoft Win32 specific debugging support #if defined(OVR_OS_WIN32) @@ -34,6 +34,8 @@ # ############################################################################# +DEBUG=0 + ####### Detect system architecture SYSARCH = i386 @@ -41,15 +43,8 @@ ifeq ($(shell uname -m),x86_64) SYSARCH = x86_64 endif -####### Compiler, tools and options - -CXX = g++ -LINK = ar rvs -DELETEFILE = rm -f - ####### Detect debug or release -DEBUG = 0 ifeq ($(DEBUG), 1) RELEASETYPE = Debug else @@ -58,25 +53,29 @@ endif ####### Paths +CUSTOM_PATH = $(RELEASETYPE)/$(SYSARCH) + +####### Paths + LIBOVRPATH = ./LibOVR DEMOPATH = ./Samples/OculusWorldDemo ####### Files -LIBOVRTARGET = $(LIBOVRPATH)/Lib/Linux/$(RELEASETYPE)/$(SYSARCH)/libovr.a -DEMOTARGET = $(DEMOPATH)/Release/OculusWorldDemo_$(RELEASETYPE)/$(SYSARCH) +LIBOVRTARGET = $(LIBOVRPATH)/Lib/Linux/$(CUSTOM_PATH)/libovr.a +DEMOTARGET = $(DEMOPATH)/Release/OculusWorldDemo_$(SYSARCH)_$(RELEASETYPE) ####### Rules all: $(LIBOVRTARGET) $(DEMOTARGET) $(DEMOTARGET): $(DEMOPATH)/Makefile - $(MAKE) -C $(DEMOPATH) DEBUG=$(DEBUG) + $(MAKE) -C $(DEMOPATH) -$(LIBOVRTARGET): $(LIBOVRPATH)/Makefile - $(MAKE) -C $(LIBOVRPATH) DEBUG=$(DEBUG) +$(LIBOVRTARGET): $(LIBOVRPATH)/Projects/Linux/Makefile + $(MAKE) -C $(LIBOVRPATH)/Projects/Linux clean: - $(MAKE) -C $(LIBOVRPATH) clean DEBUG=$(DEBUG) - $(MAKE) -C $(DEMOPATH) clean DEBUG=$(DEBUG) + $(MAKE) -C $(LIBOVRPATH)/Projects/Linux clean + $(MAKE) -C $(DEMOPATH) clean diff --git a/Samples/CommonSrc/Makefile b/Samples/CommonSrc/Makefile deleted file mode 100644 index 8c07a2a..0000000 --- a/Samples/CommonSrc/Makefile +++ /dev/null @@ -1,7 +0,0 @@ - -PLATFORM_SRCS := Samples/CommonSrc/Platform/Platform.cpp Samples/CommonSrc/Platform/X11_Platform.cpp - -RENDER_SRCS := Samples/CommonSrc/Render/Render_Device.cpp Samples/CommonSrc/Render/Render_Stereo.cpp \ - Samples/CommonSrc/Render/Render_GL_Device.cpp \ - Samples/CommonSrc/Render/Render_LoadTextureTGA.cpp - 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) |