-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile.common
89 lines (72 loc) · 1.53 KB
/
Makefile.common
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
86
87
88
89
# (C) 2002-2009 - CHAI 3D
# All Rights Reserved.
#
# $Author: seb $
# $Date: 2009-05-21 14:51:52 +1200 (Thu, 21 May 2009) $
# $Rev: 204 $
# default build configuration
ifneq ($(CFG),debug)
CFG=release
endif
# platform
SYSTEM = $(shell echo `uname -s`)
ifeq ($(SYSTEM), Linux)
OS = lin
endif
ifeq ($(SYSTEM), Darwin)
OS = mac
endif
ifeq ($(SYSTEM), QNX)
OS = qnx
endif
ifeq ($(SYSTEM), MINGW32_NT-5.1)
OS = mingw
endif
# architecture
ARCH = $(shell echo `uname -m`)
# common folders
LIB_DIR = $(TOP_DIR)/lib/$(OS)-$(ARCH)
INC_DIR = $(TOP_DIR)/src
# static library target
ifneq ($(CFG),debug)
LIB_TARGET = $(LIB_DIR)/libchai3d.a
else
LIB_TARGET = $(LIB_DIR)/libchai3d-dbg.a
endif
# external libraries
DHD_EXT = $(TOP_DIR)/external/DHD
ODE_EXT = $(TOP_DIR)/external/ODE
# modules
GEL_DIR = $(TOP_DIR)/modules/GEL
ODE_DIR = $(TOP_DIR)/modules/ODE
# common compiler flags
CXX = g++
CXXFLAGS = -I$(INC_DIR)
# build configuration specific
ifeq ($(CFG),debug)
CXXFLAGS += -O0 -g
else
CXXFLAGS += -O3
endif
# module specific compiler flags
CXXFLAGS += -I$(GEL_DIR)
CXXFLAGS += -I$(ODE_DIR) -I$(ODE_EXT)/include -DdDOUBLE
# common librarian flags
ARFLAGS = rvs
# common linker flags
LDFLAGS = -L$(LIB_DIR)
ifneq ($(CFG),debug)
LDLIBS = -lchai3d
else
LDLIBS = -lchai3d-dbg
endif
# if DHD is enabled
ifneq ($(DHD_EXT),)
LDFLAGS += -L$(DHD_EXT)/lib/$(OS)-$(ARCH)
LDLIBS += -ldhd
endif
# module specific linker flags
LDFLAGS += -L$(ODE_EXT)/lib/$(OS)-$(ARCH)
LDLIBS += -lode
# platform-specific macros
include $(TOP_DIR)/Makefile.common.$(OS)