ovr_sdk

view LibOVR/Makefile @ 3:f12a8f74fe1f

added the Xcode project
author John Tsiombikas <nuclear@member.fsf.org>
date Wed, 21 Jan 2015 11:37:50 +0200
parents 1b39a1b46319
children
line source
1 #############################################################################
2 #
3 # Filename : Makefile
4 # Content : Makefile for building Linux version of: libovr
5 # Created : 2014
6 # Authors : Simon Hallam, Peter Giokaris, Chris Taylor
7 # Copyright : Copyright 2014 OculusVR, Inc. All Rights Reserved
8 # Instruction : The g++ compiler and standard lib packages need to be
9 # installed on the system. Navigate in a shell to the
10 # directory where this Makefile is located and enter:
11 #
12 # make builds the release version for the
13 # current architecture
14 # make clean delete intermediate release object files
15 # and the library file
16 # make DEBUG=1 builds the debug version for the current
17 # architecture
18 # make clean DEBUG=1 deletes intermediate debug object files
19 # and the library file
20 #
21 # Output : Relative to the directory this Makefile lives in, libraries
22 # are built at the following locations depending upon the
23 # architecture of the system you are running:
24 #
25 # ./Lib/Linux/Debug/i386/libovr.a
26 # ./Lib/Linux/Debug/x86_64/libovr.a
27 # ./Lib/Linux/Release/i386/libovr.a
28 # ./Lib/Linux/Release/x86_64/libovr.a
29 #
30 #############################################################################
32 ####### Include auxiliary makefiles in current directory
33 -include Makefile.*[^~]
35 ####### Detect system architecture
37 SYSARCH = i386
38 ifeq ($(shell uname -m),x86_64)
39 SYSARCH = x86_64
40 endif
42 ####### Compiler, tools and options
44 CXX = g++
45 LINK =
46 DELETEFILE = rm -f
48 ####### Detect debug or release
50 COMMONFLAGS = -Wall -Wextra -Werror -pipe -fPIC -msse2
52 DEBUG ?= 0
53 CXXFLAGS ?=
54 ifeq ($(DEBUG), 1)
55 CXXFLAGS += $(COMMONFLAGS) -DDEBUG -DOVR_BUILD_DEBUG -g
56 RELEASETYPE ?= Debug
57 else
58 CXXFLAGS += $(COMMONFLAGS) -O2 -fno-strict-aliasing
59 RELEASETYPE ?= Release
60 endif
62 ####### Paths
64 LIBOVRPATH = .
65 3RDPARTYPATH = ../3rdParty
66 INCPATH = -I. -I.. -I$(LIBOVRPATH)/Include -I$(LIBOVRPATH)/Src
67 OBJPATH = ./Obj/Linux/$(RELEASETYPE)/$(SYSARCH)
68 PREFIX = /usr/local
70 ####### Files
72 TARGET_DIR = ./Lib/Linux/$(RELEASETYPE)/$(SYSARCH)
73 STATIC_NAME = libovr.a
74 STATIC_TARGET = $(TARGET_DIR)/$(STATIC_NAME)
75 LIBOVR_INST_HDR = Src/OVR_CAPI.h Src/OVR_CAPI_Keys.h Src/OVR_CAPI_GL.h
77 SHARED_BASE = libovr.so
78 SHARED_SONAME = $(SHARED_BASE).$(SHARED_MAJOR)
79 SHARED_NAME = $(SHARED_BASE).$(SHARED_MAJOR).$(SHARED_MINOR).$(SHARED_RELEASE)
80 SHARED_TARGET = $(TARGET_DIR)/$(SHARED_NAME)
81 SHARED_MAJOR = 0
82 SHARED_MINOR = 2
83 SHARED_RELEASE = 1
85 LIBOVR_INST_HDR = Src/OVR_CAPI.h Src/OVR_CAPI_Keys.h Src/OVR_CAPI_GL.h
87 ####### Rules
89 all: $(STATIC_TARGET) $(SHARED_TARGET)
91 OTHER_SOURCE = $(3RDPARTYPATH)/EDID/edid.cpp \
92 $(3RDPARTYPATH)/TinyXml/tinyxml2.cpp
94 OTHER_OBJECTS = $(OTHER_SOURCE:.cpp=.o)
96 LIBOVR_SOURCE = $(LIBOVRPATH)/Src/Net/OVR_BitStream.cpp \
97 $(LIBOVRPATH)/Src/Net/OVR_Unix_Socket.cpp \
98 $(LIBOVRPATH)/Src/Net/OVR_NetworkPlugin.cpp \
99 $(LIBOVRPATH)/Src/Net/OVR_PacketizedTCPSocket.cpp \
100 $(LIBOVRPATH)/Src/Net/OVR_RPC1.cpp \
101 $(LIBOVRPATH)/Src/Net/OVR_Session.cpp \
102 $(LIBOVRPATH)/Src/Net/OVR_Socket.cpp \
103 $(LIBOVRPATH)/Src/Service/Service_NetClient.cpp \
104 $(LIBOVRPATH)/Src/Service/Service_NetSessionCommon.cpp \
105 $(LIBOVRPATH)/Src/Tracking/Tracking_SensorStateReader.cpp \
106 $(LIBOVRPATH)/Src/Displays/OVR_Display.cpp \
107 $(LIBOVRPATH)/Src/Displays/OVR_Linux_Display.cpp \
108 $(LIBOVRPATH)/Src/Displays/OVR_Linux_SDKWindow.cpp \
109 $(LIBOVRPATH)/Src/CAPI/CAPI_DistortionRenderer.cpp \
110 $(LIBOVRPATH)/Src/CAPI/CAPI_HSWDisplay.cpp \
111 $(LIBOVRPATH)/Src/CAPI/CAPI_FrameTimeManager.cpp \
112 $(LIBOVRPATH)/Src/CAPI/CAPI_HMDRenderState.cpp \
113 $(LIBOVRPATH)/Src/CAPI/CAPI_HMDState.cpp \
114 $(LIBOVRPATH)/Src/CAPI/CAPI_LatencyStatistics.cpp \
115 $(LIBOVRPATH)/Src/CAPI/GL/CAPI_GL_DistortionRenderer.cpp \
116 $(LIBOVRPATH)/Src/CAPI/GL/CAPI_GL_HSWDisplay.cpp \
117 $(LIBOVRPATH)/Src/CAPI/GL/CAPI_GL_Util.cpp \
118 $(LIBOVRPATH)/Src/CAPI/GL/CAPI_GLE.cpp \
119 $(LIBOVRPATH)/Src/Kernel/OVR_Alg.cpp \
120 $(LIBOVRPATH)/Src/Kernel/OVR_Allocator.cpp \
121 $(LIBOVRPATH)/Src/Kernel/OVR_Atomic.cpp \
122 $(LIBOVRPATH)/Src/Kernel/OVR_CRC32.cpp \
123 $(LIBOVRPATH)/Src/Kernel/OVR_DebugHelp.cpp \
124 $(LIBOVRPATH)/Src/Kernel/OVR_File.cpp \
125 $(LIBOVRPATH)/Src/Kernel/OVR_FileFILE.cpp \
126 $(LIBOVRPATH)/Src/Kernel/OVR_Lockless.cpp \
127 $(LIBOVRPATH)/Src/Kernel/OVR_Log.cpp \
128 $(LIBOVRPATH)/Src/Kernel/OVR_Math.cpp \
129 $(LIBOVRPATH)/Src/Kernel/OVR_RefCount.cpp \
130 $(LIBOVRPATH)/Src/Kernel/OVR_SharedMemory.cpp \
131 $(LIBOVRPATH)/Src/Kernel/OVR_Std.cpp \
132 $(LIBOVRPATH)/Src/Kernel/OVR_String.cpp \
133 $(LIBOVRPATH)/Src/Kernel/OVR_String_FormatUtil.cpp \
134 $(LIBOVRPATH)/Src/Kernel/OVR_String_PathUtil.cpp \
135 $(LIBOVRPATH)/Src/Kernel/OVR_SysFile.cpp \
136 $(LIBOVRPATH)/Src/Kernel/OVR_System.cpp \
137 $(LIBOVRPATH)/Src/Kernel/OVR_ThreadsPthread.cpp \
138 $(LIBOVRPATH)/Src/Kernel/OVR_ThreadCommandQueue.cpp \
139 $(LIBOVRPATH)/Src/Kernel/OVR_Timer.cpp \
140 $(LIBOVRPATH)/Src/Kernel/OVR_UTF8Util.cpp \
141 $(LIBOVRPATH)/Src/Util/Util_Interface.cpp \
142 $(LIBOVRPATH)/Src/Util/Util_LatencyTest2Reader.cpp \
143 $(LIBOVRPATH)/Src/Util/Util_Render_Stereo.cpp \
144 $(LIBOVRPATH)/Src/Util/Util_SystemInfo.cpp \
145 $(LIBOVRPATH)/Src/Util/Util_SystemGUI.cpp \
146 $(LIBOVRPATH)/Src/OVR_CAPI.cpp \
147 $(LIBOVRPATH)/Src/OVR_SerialFormat.cpp \
148 $(LIBOVRPATH)/Src/OVR_JSON.cpp \
149 $(LIBOVRPATH)/Src/OVR_Profile.cpp \
150 $(LIBOVRPATH)/Src/OVR_Stereo.cpp
152 LIBOVR_OBJECTS = $(patsubst $(LIBOVRPATH)%.cpp,$(OBJPATH)%.o,$(LIBOVR_SOURCE))
154 OBJECTS = $(OTHER_OBJECTS) $(LIBOVR_OBJECTS)
156 $(OBJPATH)/%.o: %.cpp
157 @mkdir -p $(dir $@)
158 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
160 $(STATIC_TARGET): $(OBJECTS)
161 @mkdir -p $(@D)
162 ar rvs $(STATIC_TARGET) $(OBJECTS)
164 $(SHARED_TARGET): $(OBJECTS)
165 @mkdir -p $(@D)
166 $(CXX) -shared -Wl,-soname,$(SHARED_SONAME) -o $@ $(OBJECTS) $(LDFLAGS)
168 clean:
169 -$(DELETEFILE) $(OBJECTS)
170 -$(DELETEFILE) $(STATIC_TARGET)
171 -$(DELETEFILE) $(SHARED_TARGET)
174 install: $(SHARED_TARGET) $(STATIC_TARGET)
175 mkdir -p $(DESTDIR)$(PREFIX)/include $(DESTDIR)$(PREFIX)/lib
176 cp $(LIBOVR_INST_HDR) $(DESTDIR)$(PREFIX)/include
177 cp $(STATIC_TARGET) $(SHARED_TARGET) $(DESTDIR)$(PREFIX)/lib
178 cd $(DESTDIR)$(PREFIX)/lib && \
179 rm -f $(SHARED_BASE) $(SHARED_SONAME) && \
180 ln -s $(SHARED_NAME) $(SHARED_SONAME) && \
181 ln -s $(SHARED_SONAME) $(SHARED_BASE)
183 uninstall:
184 -cd $(DESTDIR)$(PREFIX)/include && rm -f $(LIBOVR_INST_HDR)
185 -cd $(DESTDIR)$(PREFIX)/lib && rm -f $(SHARED_BASE) $(SHARED_SONAME) $(SHARED_NAME)