nuclear@0: ############################################################################# nuclear@0: # nuclear@0: # Filename : Makefile nuclear@0: # Content : Makefile for building Linux version of: libovr nuclear@0: # Created : 2014 nuclear@0: # Authors : Simon Hallam, Peter Giokaris, Chris Taylor nuclear@0: # Copyright : Copyright 2014 OculusVR, Inc. All Rights Reserved nuclear@0: # Instruction : The g++ compiler and standard lib packages need to be nuclear@0: # installed on the system. Navigate in a shell to the nuclear@0: # directory where this Makefile is located and enter: nuclear@0: # nuclear@0: # make builds the release version for the nuclear@0: # current architecture nuclear@0: # make clean delete intermediate release object files nuclear@0: # and the library file nuclear@0: # make DEBUG=1 builds the debug version for the current nuclear@0: # architecture nuclear@0: # make clean DEBUG=1 deletes intermediate debug object files nuclear@0: # and the library file nuclear@0: # nuclear@0: # Output : Relative to the directory this Makefile lives in, libraries nuclear@0: # are built at the following locations depending upon the nuclear@0: # architecture of the system you are running: nuclear@0: # nuclear@0: # ./Lib/Linux/Debug/i386/libovr.a nuclear@0: # ./Lib/Linux/Debug/x86_64/libovr.a nuclear@0: # ./Lib/Linux/Release/i386/libovr.a nuclear@0: # ./Lib/Linux/Release/x86_64/libovr.a nuclear@0: # nuclear@0: ############################################################################# nuclear@0: nuclear@0: ####### Include auxiliary makefiles in current directory nuclear@0: -include Makefile.*[^~] nuclear@0: nuclear@0: ####### Detect system architecture nuclear@0: nuclear@0: SYSARCH = i386 nuclear@0: ifeq ($(shell uname -m),x86_64) nuclear@0: SYSARCH = x86_64 nuclear@0: endif nuclear@0: nuclear@0: ####### Compiler, tools and options nuclear@0: nuclear@0: CXX = g++ nuclear@0: LINK = nuclear@0: DELETEFILE = rm -f nuclear@0: nuclear@0: ####### Detect debug or release nuclear@0: nuclear@0: COMMONFLAGS = -Wall -Wextra -Werror -pipe -fPIC -msse2 nuclear@0: nuclear@0: DEBUG ?= 0 nuclear@0: CXXFLAGS ?= nuclear@0: ifeq ($(DEBUG), 1) nuclear@0: CXXFLAGS += $(COMMONFLAGS) -DDEBUG -DOVR_BUILD_DEBUG -g nuclear@0: RELEASETYPE ?= Debug nuclear@0: else nuclear@0: CXXFLAGS += $(COMMONFLAGS) -O2 -fno-strict-aliasing nuclear@0: RELEASETYPE ?= Release nuclear@0: endif nuclear@0: nuclear@0: ####### Paths nuclear@0: nuclear@0: LIBOVRPATH = . nuclear@0: 3RDPARTYPATH = ../3rdParty nuclear@0: INCPATH = -I. -I.. -I$(LIBOVRPATH)/Include -I$(LIBOVRPATH)/Src nuclear@0: OBJPATH = ./Obj/Linux/$(RELEASETYPE)/$(SYSARCH) nuclear@0: PREFIX = /usr/local nuclear@0: nuclear@0: ####### Files nuclear@0: nuclear@0: TARGET_DIR = ./Lib/Linux/$(RELEASETYPE)/$(SYSARCH) nuclear@0: STATIC_NAME = libovr.a nuclear@0: STATIC_TARGET = $(TARGET_DIR)/$(STATIC_NAME) nuclear@0: LIBOVR_INST_HDR = Src/OVR_CAPI.h Src/OVR_CAPI_Keys.h Src/OVR_CAPI_GL.h nuclear@0: nuclear@2: SHARED_BASE = libovr.so nuclear@2: SHARED_SONAME = $(SHARED_BASE).$(SHARED_MAJOR) nuclear@2: SHARED_NAME = $(SHARED_BASE).$(SHARED_MAJOR).$(SHARED_MINOR).$(SHARED_RELEASE) nuclear@2: SHARED_TARGET = $(TARGET_DIR)/$(SHARED_NAME) nuclear@2: SHARED_MAJOR = 0 nuclear@2: SHARED_MINOR = 2 nuclear@2: SHARED_RELEASE = 1 nuclear@2: nuclear@2: LIBOVR_INST_HDR = Src/OVR_CAPI.h Src/OVR_CAPI_Keys.h Src/OVR_CAPI_GL.h nuclear@2: nuclear@0: ####### Rules nuclear@0: nuclear@2: all: $(STATIC_TARGET) $(SHARED_TARGET) nuclear@0: nuclear@0: OTHER_SOURCE = $(3RDPARTYPATH)/EDID/edid.cpp \ nuclear@0: $(3RDPARTYPATH)/TinyXml/tinyxml2.cpp nuclear@0: nuclear@0: OTHER_OBJECTS = $(OTHER_SOURCE:.cpp=.o) nuclear@0: nuclear@0: LIBOVR_SOURCE = $(LIBOVRPATH)/Src/Net/OVR_BitStream.cpp \ nuclear@0: $(LIBOVRPATH)/Src/Net/OVR_Unix_Socket.cpp \ nuclear@0: $(LIBOVRPATH)/Src/Net/OVR_NetworkPlugin.cpp \ nuclear@0: $(LIBOVRPATH)/Src/Net/OVR_PacketizedTCPSocket.cpp \ nuclear@0: $(LIBOVRPATH)/Src/Net/OVR_RPC1.cpp \ nuclear@0: $(LIBOVRPATH)/Src/Net/OVR_Session.cpp \ nuclear@0: $(LIBOVRPATH)/Src/Net/OVR_Socket.cpp \ nuclear@0: $(LIBOVRPATH)/Src/Service/Service_NetClient.cpp \ nuclear@0: $(LIBOVRPATH)/Src/Service/Service_NetSessionCommon.cpp \ nuclear@0: $(LIBOVRPATH)/Src/Tracking/Tracking_SensorStateReader.cpp \ nuclear@0: $(LIBOVRPATH)/Src/Displays/OVR_Display.cpp \ nuclear@0: $(LIBOVRPATH)/Src/Displays/OVR_Linux_Display.cpp \ nuclear@0: $(LIBOVRPATH)/Src/Displays/OVR_Linux_SDKWindow.cpp \ nuclear@0: $(LIBOVRPATH)/Src/CAPI/CAPI_DistortionRenderer.cpp \ nuclear@0: $(LIBOVRPATH)/Src/CAPI/CAPI_HSWDisplay.cpp \ nuclear@0: $(LIBOVRPATH)/Src/CAPI/CAPI_FrameTimeManager.cpp \ nuclear@0: $(LIBOVRPATH)/Src/CAPI/CAPI_HMDRenderState.cpp \ nuclear@0: $(LIBOVRPATH)/Src/CAPI/CAPI_HMDState.cpp \ nuclear@0: $(LIBOVRPATH)/Src/CAPI/CAPI_LatencyStatistics.cpp \ nuclear@0: $(LIBOVRPATH)/Src/CAPI/GL/CAPI_GL_DistortionRenderer.cpp \ nuclear@0: $(LIBOVRPATH)/Src/CAPI/GL/CAPI_GL_HSWDisplay.cpp \ nuclear@0: $(LIBOVRPATH)/Src/CAPI/GL/CAPI_GL_Util.cpp \ nuclear@0: $(LIBOVRPATH)/Src/CAPI/GL/CAPI_GLE.cpp \ nuclear@0: $(LIBOVRPATH)/Src/Kernel/OVR_Alg.cpp \ nuclear@0: $(LIBOVRPATH)/Src/Kernel/OVR_Allocator.cpp \ nuclear@0: $(LIBOVRPATH)/Src/Kernel/OVR_Atomic.cpp \ nuclear@0: $(LIBOVRPATH)/Src/Kernel/OVR_CRC32.cpp \ nuclear@0: $(LIBOVRPATH)/Src/Kernel/OVR_DebugHelp.cpp \ nuclear@0: $(LIBOVRPATH)/Src/Kernel/OVR_File.cpp \ nuclear@0: $(LIBOVRPATH)/Src/Kernel/OVR_FileFILE.cpp \ nuclear@0: $(LIBOVRPATH)/Src/Kernel/OVR_Lockless.cpp \ nuclear@0: $(LIBOVRPATH)/Src/Kernel/OVR_Log.cpp \ nuclear@0: $(LIBOVRPATH)/Src/Kernel/OVR_Math.cpp \ nuclear@0: $(LIBOVRPATH)/Src/Kernel/OVR_RefCount.cpp \ nuclear@0: $(LIBOVRPATH)/Src/Kernel/OVR_SharedMemory.cpp \ nuclear@0: $(LIBOVRPATH)/Src/Kernel/OVR_Std.cpp \ nuclear@0: $(LIBOVRPATH)/Src/Kernel/OVR_String.cpp \ nuclear@0: $(LIBOVRPATH)/Src/Kernel/OVR_String_FormatUtil.cpp \ nuclear@0: $(LIBOVRPATH)/Src/Kernel/OVR_String_PathUtil.cpp \ nuclear@0: $(LIBOVRPATH)/Src/Kernel/OVR_SysFile.cpp \ nuclear@0: $(LIBOVRPATH)/Src/Kernel/OVR_System.cpp \ nuclear@0: $(LIBOVRPATH)/Src/Kernel/OVR_ThreadsPthread.cpp \ nuclear@0: $(LIBOVRPATH)/Src/Kernel/OVR_ThreadCommandQueue.cpp \ nuclear@0: $(LIBOVRPATH)/Src/Kernel/OVR_Timer.cpp \ nuclear@0: $(LIBOVRPATH)/Src/Kernel/OVR_UTF8Util.cpp \ nuclear@0: $(LIBOVRPATH)/Src/Util/Util_Interface.cpp \ nuclear@0: $(LIBOVRPATH)/Src/Util/Util_LatencyTest2Reader.cpp \ nuclear@0: $(LIBOVRPATH)/Src/Util/Util_Render_Stereo.cpp \ nuclear@0: $(LIBOVRPATH)/Src/Util/Util_SystemInfo.cpp \ nuclear@0: $(LIBOVRPATH)/Src/Util/Util_SystemGUI.cpp \ nuclear@0: $(LIBOVRPATH)/Src/OVR_CAPI.cpp \ nuclear@0: $(LIBOVRPATH)/Src/OVR_SerialFormat.cpp \ nuclear@0: $(LIBOVRPATH)/Src/OVR_JSON.cpp \ nuclear@0: $(LIBOVRPATH)/Src/OVR_Profile.cpp \ nuclear@0: $(LIBOVRPATH)/Src/OVR_Stereo.cpp nuclear@0: nuclear@0: LIBOVR_OBJECTS = $(patsubst $(LIBOVRPATH)%.cpp,$(OBJPATH)%.o,$(LIBOVR_SOURCE)) nuclear@0: nuclear@0: OBJECTS = $(OTHER_OBJECTS) $(LIBOVR_OBJECTS) nuclear@0: nuclear@0: $(OBJPATH)/%.o: %.cpp nuclear@0: @mkdir -p $(dir $@) nuclear@0: $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< nuclear@0: nuclear@0: $(STATIC_TARGET): $(OBJECTS) nuclear@0: @mkdir -p $(@D) nuclear@0: ar rvs $(STATIC_TARGET) $(OBJECTS) nuclear@0: nuclear@2: $(SHARED_TARGET): $(OBJECTS) nuclear@2: @mkdir -p $(@D) nuclear@2: $(CXX) -shared -Wl,-soname,$(SHARED_SONAME) -o $@ $(OBJECTS) $(LDFLAGS) nuclear@2: nuclear@0: clean: nuclear@0: -$(DELETEFILE) $(OBJECTS) nuclear@0: -$(DELETEFILE) $(STATIC_TARGET) nuclear@2: -$(DELETEFILE) $(SHARED_TARGET) nuclear@2: nuclear@2: nuclear@2: install: $(SHARED_TARGET) $(STATIC_TARGET) nuclear@2: mkdir -p $(DESTDIR)$(PREFIX)/include $(DESTDIR)$(PREFIX)/lib nuclear@2: cp $(LIBOVR_INST_HDR) $(DESTDIR)$(PREFIX)/include nuclear@2: cp $(STATIC_TARGET) $(SHARED_TARGET) $(DESTDIR)$(PREFIX)/lib nuclear@2: cd $(DESTDIR)$(PREFIX)/lib && \ nuclear@2: rm -f $(SHARED_BASE) $(SHARED_SONAME) && \ nuclear@2: ln -s $(SHARED_NAME) $(SHARED_SONAME) && \ nuclear@2: ln -s $(SHARED_SONAME) $(SHARED_BASE) nuclear@2: nuclear@2: uninstall: nuclear@2: -cd $(DESTDIR)$(PREFIX)/include && rm -f $(LIBOVR_INST_HDR) nuclear@2: -cd $(DESTDIR)$(PREFIX)/lib && rm -f $(SHARED_BASE) $(SHARED_SONAME) $(SHARED_NAME)