blob: 4577b6016106e66a5653e5bbb4c0a312686f3991 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
#############################################################################
#
# 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
####### 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
OVR_ROOT = ../../..
LIBOVRPATH = $(OVR_ROOT)/LibOVR
3RDPARTYPATH = $(OVR_ROOT)/3rdParty
INCPATH = -I$(LIBOVRPATH)/Include -I$(LIBOVRPATH)/Src
SRCPATH = $(LIBOVRPATH)/Src
OBJPATH = $(LIBOVRPATH)/Obj/Linux/$(CUSTOM_PATH)
CXXBUILD = $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJPATH)/
TARGET_PATH = $(LIBOVRPATH)/Lib/Linux/$(CUSTOM_PATH)
# 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)) \
####### Files
TARGET = $(TARGET_PATH)/libovr.a
OBJECTS = $(patsubst ${SRCPATH}/%.cpp, ${OBJPATH}/%.o, ${CPP_SRCS}) $(OBJPATH)/tinyxml2.o
DIRS = $(subst /,/,$(sort $(dir $(OBJECTS))))
####### Rules
all: $(TARGET)
$(TARGET): $(TARGET_PATH) $(OBJECTS) $(LIBOVRTARGET_PATH)
$(LINK) $(TARGET) $(OBJECTS)
$(TARGET_PATH): $(OBJPATH)
$(MD) -p $(TARGET_PATH)
$(OBJPATH):
$(MD) -p $(DIRS)
$(OBJPATH)/%.o: $(SRCPATH)/%.cpp
$(CXXBUILD) -o "$@" "$<"
$(OBJPATH)/tinyxml2.o: $(3RDPARTYPATH)/TinyXml/tinyxml2.cpp
$(CXXBUILD) -o "$@" "$<"
clean:
-$(DELETEFILE) $(OBJECTS)
-$(DELETEFILE) $(TARGET)
|