ovr_sdk

annotate LibOVR/Makefile @ 2:e01da1033ca5

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