nuclear@0: ############################################################################# nuclear@0: # nuclear@0: # Filename : Makefile nuclear@0: # Content : Makefile for building linux libovr and OculusWorldDemo nuclear@0: # Created : 2013 nuclear@0: # Authors : Simon Hallam and Peter Giokaris nuclear@0: # Copyright : Copyright 2013 OculusVR, Inc. All Rights Reserved nuclear@0: # Instruction : See 'make help' nuclear@0: # nuclear@0: # make builds the release versions for the nuclear@0: # current architechture nuclear@0: # make clean delete intermediate release object files nuclear@0: # and library and executable nuclear@0: # make DEBUG=1 builds the debug version for the current nuclear@0: # architechture nuclear@0: # make clean DEBUG=1 deletes intermediate debug object files nuclear@0: # and the library and executable nuclear@0: # nuclear@0: # Output : Relative to the directory this Makefile lives in, libraries nuclear@0: # and executables are built at the following locations nuclear@0: # depending upon the architechture of the system you are nuclear@0: # running: nuclear@0: # nuclear@0: # ./LibOVR/Lib/Linux/Debug/i386/libovr.a nuclear@0: # ./LibOVR/Lib/Linux/Debug/x86_64/libovr.a nuclear@0: # ./LibOVR/Lib/Linux/Release/i386/libovr.a nuclear@0: # ./LibOVR/Lib/Linux/Release/x86_64/libovr.a nuclear@0: # ./Samples/OculusWorldDemo/Release/OculusWorldDemo_i386_Release nuclear@0: # ./Samples/OculusWorldDemo/Release/OculusWorldDemo_x86_64_Release nuclear@0: # ./Samples/OculusWorldDemo/Release/OculusWorldDemo_i386_Debug nuclear@0: # ./Samples/OculusWorldDemo/Release/OculusWorldDemo_x86_64_Debug nuclear@0: # nuclear@0: ############################################################################# nuclear@0: nuclear@0: ####### Include makefiles in current directory nuclear@0: RELEASESUFFIX = 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 = ar rvs nuclear@0: DELETEFILE = rm -f nuclear@0: nuclear@0: ####### Detect debug or release nuclear@0: nuclear@0: DEBUG = 0 nuclear@0: ifeq ($(DEBUG), 1) nuclear@0: RELEASETYPE = Debug$(RELEASESUFFIX) nuclear@0: else nuclear@0: RELEASETYPE = Release$(RELEASESUFFIX) nuclear@0: endif nuclear@0: nuclear@0: # Override release types and DEBUG settings in child makefiles. nuclear@0: export RELEASETYPE nuclear@0: export DEBUG nuclear@0: nuclear@0: ####### Target settings nuclear@2: PREFIX = /usr/local nuclear@0: LIBOVRPATH = ./LibOVR nuclear@0: OWDPATH = ./Samples/OculusWorldDemo nuclear@0: nuclear@0: LIBOVRTARGET = $(LIBOVRPATH)/Lib/Linux/$(RELEASETYPE)/$(SYSARCH)/libovr.a nuclear@0: OWDTARGET = $(OWDPATH)/Release/OculusWorldDemo_$(SYSARCH)_$(RELEASETYPE) nuclear@0: nuclear@0: ####### Targets nuclear@0: nuclear@0: all: $(LIBOVRTARGET) $(OWDTARGET) nuclear@0: nuclear@0: $(OWDTARGET): force_look $(LIBOVRTARGET) nuclear@0: $(MAKE) -C $(OWDPATH) nuclear@0: nuclear@0: $(LIBOVRTARGET): force_look nuclear@0: $(MAKE) -C $(LIBOVRPATH) nuclear@0: nuclear@0: run: $(OWDTARGET) nuclear@0: $(MAKE) -C $(OWDPATH) run nuclear@0: nuclear@0: clean: nuclear@0: $(MAKE) -C $(LIBOVRPATH) clean nuclear@0: $(MAKE) -C $(OWDPATH) clean nuclear@0: nuclear@2: install: oculusd nuclear@2: mkdir -p $(DESTDIR)$(PREFIX)/bin nuclear@2: cp oculusd $(DESTDIR)$(PREFIX)/bin/oculusd nuclear@2: $(MAKE) -C $(LIBOVRPATH) install nuclear@2: nuclear@2: uninstall: nuclear@2: rm $(DESTDIR)$(PREFIX)/bin/oculusd nuclear@2: $(MAKE) -C $(LIBOVRPATH) uninstall nuclear@2: nuclear@0: force_look: nuclear@0: true nuclear@0: nuclear@0: # Generate help based on descriptions of targets given in this Makefile. nuclear@0: help: ##- Show this help nuclear@0: @echo "Targets:" nuclear@0: @echo " all : Build LibOVR and Oculus World Demo" nuclear@0: @echo " run : Run Oculus World Demo" nuclear@0: @echo " clean : Clean selected release (DEBUG=[0,1])" nuclear@0: @echo " cleanall : Clean all possible release targets" nuclear@0: @echo "" nuclear@0: @echo "Options:" nuclear@0: @echo " DEBUG : 'make DEBUG=1' will build the current target in DEBUG mode" nuclear@0: nuclear@0: # Experimental method of automatically generating help from target names. nuclear@0: #@grep -h "##-" $(MAKEFILE_LIST) | grep -v grep | sed -e 's/^/ /' | sed -e 's/\:\s*##-/:/' | awk '{printf "%+6s\n", $$0}'