summaryrefslogtreecommitdiffstats
path: root/LibOVR/Projects/Linux/Makefile
blob: 008a158e7ebe62a6c0c70f58079d05b638856ef4 (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
#############################################################################
#
# Filename    : Makefile
# Content     : Makefile for building linux version of: libovr
# Created     : 2013
# Authors     : Simon Hallam and Peter Giokaris
# Copyright   : Copyright 2013 OculusVR, Inc. All Rights Reserved
# Instruction : The g++ compiler and stdndard 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 architechture
#               make clean          delete intermediate release object files 
#                                   and the library file
#               make DEBUG=1        builds the debug version for the current
#                                   architechture
#               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
#               architechture 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
#
#############################################################################

##### Build flags

DEBUG         = 0
OVR_ROOT      = ../../..

include $(OVR_ROOT)/LibOVR/Projects/Linux/Makefile.common

LINK          = $(LINK_ARCHIVE)
INCPATH       = $(LIBOVRINCPATH)
SRCPATH       = $(LIBOVRPATH)/Src
OBJPATH       = $(LIBOVRPATH)/Obj/Linux/$(CUSTOM_PATH)
TARGETPATH    = $(LIBOVRPATH)/Lib/Linux/$(CUSTOM_PATH)

CXXBUILD      = $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJPATH)/

####### Files

TARGET        = $(TARGETPATH)/libovr.a

# Filter out Windows and OSX files
CPP_SRCS = $(filter-out \
       $(SRCPATH)/OVR_Win32%.cpp \
       ${SRCPATH}/OVR_OSX%.cpp \
       ${SRCPATH}/OVR_Posix%.cpp \
       ${SRCPATH}/Kernel/OVR_ThreadsWinAPI.cpp \
       , $(shell find ${SRCPATH} -name *.cpp)) \


OBJECTS = $(patsubst ${SRCPATH}/%.cpp, ${OBJPATH}/%.o, ${CPP_SRCS}) $(OBJPATH)/tinyxml2.o

DIRS = $(subst /,/,$(sort $(dir $(OBJECTS))))  $(TARGETPATH)

####### Rules

all:    $(TARGET)

$(TARGET):  $(TARGET_PATH) $(OBJECTS) $(LIBOVRTARGET_PATH)
	$(MD) -p $(DIRS)
	$(LINK) $(TARGET) $(OBJECTS)

$(OBJPATH):
	$(MD) -p $(DIRS)

$(OBJPATH)/%.o: $(SRCPATH)/%.cpp
	$(MD) -p $(DIRS)
	$(CXXBUILD) -o "$@" "$<"

$(OBJPATH)/tinyxml2.o: $(3RDPARTYPATH)/TinyXml/tinyxml2.cpp 
	$(CXXBUILD) -o "$@" "$<" 

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