summaryrefslogtreecommitdiffstats
path: root/LibOVR/Projects/Linux
diff options
context:
space:
mode:
Diffstat (limited to 'LibOVR/Projects/Linux')
-rw-r--r--LibOVR/Projects/Linux/Makefile58
-rw-r--r--LibOVR/Projects/Linux/Makefile.common37
2 files changed, 49 insertions, 46 deletions
diff --git a/LibOVR/Projects/Linux/Makefile b/LibOVR/Projects/Linux/Makefile
index 4577b60..008a158 100644
--- a/LibOVR/Projects/Linux/Makefile
+++ b/LibOVR/Projects/Linux/Makefile
@@ -32,52 +32,21 @@
##### Build flags
DEBUG = 0
+OVR_ROOT = ../../..
-####### Compiler, tools and options
-
-CXX = g++
-LINK = ar rvs
-DELETEFILE = rm -f
-MD = mkdir
-
-####### Detect system architecture
-
-SYSARCH = i386
-ifeq ($(shell uname -m),x86_64)
-SYSARCH = x86_64
-endif
-
-####### Detect debug or release
-
-ifeq ($(DEBUG), 1)
- RELEASETYPE = Debug
-else
- RELEASETYPE = Release
-endif
-
-####### Paths
-
-CUSTOM_PATH = $(RELEASETYPE)/$(SYSARCH)
-
-
-ifeq ($(DEBUG), 1)
- CXXFLAGS = -pipe -DDEBUG -g
-else
- CXXFLAGS = -pipe -O2
-endif
-
-####### Paths
+include $(OVR_ROOT)/LibOVR/Projects/Linux/Makefile.common
-OVR_ROOT = ../../..
-LIBOVRPATH = $(OVR_ROOT)/LibOVR
-3RDPARTYPATH = $(OVR_ROOT)/3rdParty
-INCPATH = -I$(LIBOVRPATH)/Include -I$(LIBOVRPATH)/Src
+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)/
-TARGET_PATH = $(LIBOVRPATH)/Lib/Linux/$(CUSTOM_PATH)
+####### Files
+TARGET = $(TARGETPATH)/libovr.a
# Filter out Windows and OSX files
CPP_SRCS = $(filter-out \
@@ -87,27 +56,24 @@ CPP_SRCS = $(filter-out \
${SRCPATH}/Kernel/OVR_ThreadsWinAPI.cpp \
, $(shell find ${SRCPATH} -name *.cpp)) \
-####### Files
-
-TARGET = $(TARGET_PATH)/libovr.a
OBJECTS = $(patsubst ${SRCPATH}/%.cpp, ${OBJPATH}/%.o, ${CPP_SRCS}) $(OBJPATH)/tinyxml2.o
-DIRS = $(subst /,/,$(sort $(dir $(OBJECTS))))
+
+DIRS = $(subst /,/,$(sort $(dir $(OBJECTS)))) $(TARGETPATH)
####### Rules
all: $(TARGET)
$(TARGET): $(TARGET_PATH) $(OBJECTS) $(LIBOVRTARGET_PATH)
+ $(MD) -p $(DIRS)
$(LINK) $(TARGET) $(OBJECTS)
-$(TARGET_PATH): $(OBJPATH)
- $(MD) -p $(TARGET_PATH)
-
$(OBJPATH):
$(MD) -p $(DIRS)
$(OBJPATH)/%.o: $(SRCPATH)/%.cpp
+ $(MD) -p $(DIRS)
$(CXXBUILD) -o "$@" "$<"
$(OBJPATH)/tinyxml2.o: $(3RDPARTYPATH)/TinyXml/tinyxml2.cpp
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
+