aboutsummaryrefslogtreecommitdiffstats
path: root/LibOVR/Makefile
blob: fba0a67b85e7641e37c004cd40cc0f4b12069577 (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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
#############################################################################
#
# Filename    : Makefile
# Content     : Makefile for building Linux version of: libovr
# Created     : 2014
# Authors     : Simon Hallam, Peter Giokaris, Chris Taylor
# Copyright   : Copyright 2014 OculusVR, Inc. All Rights Reserved
# Instruction : The g++ compiler and standard 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 architecture
#               make clean          delete intermediate release object files
#                                   and the library file
#               make DEBUG=1        builds the debug version for the current
#                                   architecture
#               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
#               architecture 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
#
#############################################################################

####### Include auxiliary makefiles in current directory
-include Makefile.*[^~]

####### Detect system architecture

SYSARCH       = i386
ifeq ($(shell uname -m),x86_64)
SYSARCH       = x86_64
endif

####### Compiler, tools and options

CXX           = g++
LINK          = 
DELETEFILE    = rm -f

####### Detect debug or release

COMMONFLAGS   = -Wall -Wextra -Werror -pipe -fPIC -msse2

DEBUG         ?= 0
CXXFLAGS 			?=
ifeq ($(DEBUG), 1)
	CXXFLAGS      += $(COMMONFLAGS) -DDEBUG -DOVR_BUILD_DEBUG -g
	RELEASETYPE   ?= Debug
else
	CXXFLAGS      += $(COMMONFLAGS) -O2 -fno-strict-aliasing
	RELEASETYPE   ?= Release
endif

####### Paths

LIBOVRPATH    = .
3RDPARTYPATH  = ../3rdParty
INCPATH       = -I. -I.. -I$(LIBOVRPATH)/Include -I$(LIBOVRPATH)/Src
OBJPATH       = ./Obj/Linux/$(RELEASETYPE)/$(SYSARCH)
PREFIX        = /usr/local

####### Files

TARGET_DIR      = ./Lib/Linux/$(RELEASETYPE)/$(SYSARCH)
STATIC_NAME     = libovr.a
STATIC_TARGET   = $(TARGET_DIR)/$(STATIC_NAME)
LIBOVR_INST_HDR = Src/OVR_CAPI.h Src/OVR_CAPI_Keys.h Src/OVR_CAPI_GL.h

####### Rules

all:    $(STATIC_TARGET)

OTHER_SOURCE =	$(3RDPARTYPATH)/EDID/edid.cpp \
				$(3RDPARTYPATH)/TinyXml/tinyxml2.cpp

OTHER_OBJECTS = $(OTHER_SOURCE:.cpp=.o)

LIBOVR_SOURCE = 	$(LIBOVRPATH)/Src/Net/OVR_BitStream.cpp \
				$(LIBOVRPATH)/Src/Net/OVR_Unix_Socket.cpp \
				$(LIBOVRPATH)/Src/Net/OVR_NetworkPlugin.cpp \
				$(LIBOVRPATH)/Src/Net/OVR_PacketizedTCPSocket.cpp \
				$(LIBOVRPATH)/Src/Net/OVR_RPC1.cpp \
				$(LIBOVRPATH)/Src/Net/OVR_Session.cpp \
				$(LIBOVRPATH)/Src/Net/OVR_Socket.cpp \
				$(LIBOVRPATH)/Src/Service/Service_NetClient.cpp \
				$(LIBOVRPATH)/Src/Service/Service_NetSessionCommon.cpp \
				$(LIBOVRPATH)/Src/Tracking/Tracking_SensorStateReader.cpp \
				$(LIBOVRPATH)/Src/Displays/OVR_Display.cpp \
				$(LIBOVRPATH)/Src/Displays/OVR_Linux_Display.cpp \
				$(LIBOVRPATH)/Src/Displays/OVR_Linux_SDKWindow.cpp \
				$(LIBOVRPATH)/Src/CAPI/CAPI_DistortionRenderer.cpp \
				$(LIBOVRPATH)/Src/CAPI/CAPI_HSWDisplay.cpp \
				$(LIBOVRPATH)/Src/CAPI/CAPI_FrameTimeManager.cpp \
				$(LIBOVRPATH)/Src/CAPI/CAPI_HMDRenderState.cpp \
				$(LIBOVRPATH)/Src/CAPI/CAPI_HMDState.cpp \
				$(LIBOVRPATH)/Src/CAPI/CAPI_LatencyStatistics.cpp \
				$(LIBOVRPATH)/Src/CAPI/GL/CAPI_GL_DistortionRenderer.cpp \
				$(LIBOVRPATH)/Src/CAPI/GL/CAPI_GL_HSWDisplay.cpp \
				$(LIBOVRPATH)/Src/CAPI/GL/CAPI_GL_Util.cpp \
				$(LIBOVRPATH)/Src/CAPI/GL/CAPI_GLE.cpp \
				$(LIBOVRPATH)/Src/Kernel/OVR_Alg.cpp \
				$(LIBOVRPATH)/Src/Kernel/OVR_Allocator.cpp \
				$(LIBOVRPATH)/Src/Kernel/OVR_Atomic.cpp \
				$(LIBOVRPATH)/Src/Kernel/OVR_CRC32.cpp \
				$(LIBOVRPATH)/Src/Kernel/OVR_DebugHelp.cpp \
				$(LIBOVRPATH)/Src/Kernel/OVR_File.cpp \
				$(LIBOVRPATH)/Src/Kernel/OVR_FileFILE.cpp \
				$(LIBOVRPATH)/Src/Kernel/OVR_Lockless.cpp \
				$(LIBOVRPATH)/Src/Kernel/OVR_Log.cpp \
				$(LIBOVRPATH)/Src/Kernel/OVR_Math.cpp \
				$(LIBOVRPATH)/Src/Kernel/OVR_RefCount.cpp \
				$(LIBOVRPATH)/Src/Kernel/OVR_SharedMemory.cpp \
				$(LIBOVRPATH)/Src/Kernel/OVR_Std.cpp \
				$(LIBOVRPATH)/Src/Kernel/OVR_String.cpp \
				$(LIBOVRPATH)/Src/Kernel/OVR_String_FormatUtil.cpp \
				$(LIBOVRPATH)/Src/Kernel/OVR_String_PathUtil.cpp \
				$(LIBOVRPATH)/Src/Kernel/OVR_SysFile.cpp \
				$(LIBOVRPATH)/Src/Kernel/OVR_System.cpp \
				$(LIBOVRPATH)/Src/Kernel/OVR_ThreadsPthread.cpp \
				$(LIBOVRPATH)/Src/Kernel/OVR_ThreadCommandQueue.cpp \
				$(LIBOVRPATH)/Src/Kernel/OVR_Timer.cpp \
				$(LIBOVRPATH)/Src/Kernel/OVR_UTF8Util.cpp \
				$(LIBOVRPATH)/Src/Util/Util_Interface.cpp \
				$(LIBOVRPATH)/Src/Util/Util_LatencyTest2Reader.cpp \
				$(LIBOVRPATH)/Src/Util/Util_Render_Stereo.cpp \
				$(LIBOVRPATH)/Src/Util/Util_SystemInfo.cpp \
				$(LIBOVRPATH)/Src/Util/Util_SystemGUI.cpp \
				$(LIBOVRPATH)/Src/OVR_CAPI.cpp \
				$(LIBOVRPATH)/Src/OVR_SerialFormat.cpp \
				$(LIBOVRPATH)/Src/OVR_JSON.cpp \
				$(LIBOVRPATH)/Src/OVR_Profile.cpp \
				$(LIBOVRPATH)/Src/OVR_Stereo.cpp

LIBOVR_OBJECTS = $(patsubst $(LIBOVRPATH)%.cpp,$(OBJPATH)%.o,$(LIBOVR_SOURCE))

OBJECTS = $(OTHER_OBJECTS) $(LIBOVR_OBJECTS)

$(OBJPATH)/%.o: %.cpp
	@mkdir -p $(dir $@)
	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<

$(STATIC_TARGET): $(OBJECTS)
	@mkdir -p $(@D)
	ar rvs $(STATIC_TARGET) $(OBJECTS)

clean:
	-$(DELETEFILE) $(OBJECTS)
	-$(DELETEFILE) $(STATIC_TARGET)