summaryrefslogtreecommitdiff
path: root/libs/ode-0.16.1/ou/build/make/makefile
blob: bf8a8d61b2f15d5551ab350590086803b32af0a0 (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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
PRODUCTNAME = ou
MODE ?= DEVELOP
BITS ?= 32

include makefile.os

CXX = gcc
AR = ar
LD = gcc

CXXFLAGS = -fno-exceptions -fno-rtti -Wall -g
ARFLAGS = -r
LDFLAGS = -fno-exceptions -fno-rtti -g

ifeq ($(OS_PLATFORM), i386)
ifneq ($(BITS), 64)

CXXFLAGS += -malign-double 

endif
endif

ifeq ($(MODE), DEBUG)

CXXFLAGS += -D_DEBUG
CXXFLAGS += -O0

else
ifeq ($(MODE), RELEASE)

CXXFLAGS += -DNDEBUG
CXXFLAGS += -O3 -funroll-loops

else

CXXFLAGS += -O2

endif
endif

ifeq ($(BITS), 64)

CXXFLAGS += -m64
LDFLAGS += -m64
 
else

CXXFLAGS += -m32
LDFLAGS += -m32

endif


SRCEXT=.cpp
OBJEXT=$(OS_OBJ_EXT)

OUTNAME := $(PRODUCTNAME)
OUTDIR = ../../lib/
OUTEXT=$(OS_LIB_EXT)

TESTNAME := $(PRODUCTNAME)test
TESTDIR = ../../bin/
TESTEXT=$(OS_EXE_EXT)

REFINEDCXX = $(notdir $(CXX))
OUTINTDIR := ../../intermediate/$(REFINEDCXX)/
TESTINTDIR := ../../intermediate/$(REFINEDCXX)_$(TESTNAME)/


ifeq ($(MODE), DEBUG)

OUTINTDIR := $(OUTINTDIR)debug
TESTINTDIR := $(TESTINTDIR)debug

else
ifeq ($(MODE), RELEASE)

OUTINTDIR := $(OUTINTDIR)release
TESTINTDIR := $(TESTINTDIR)release

else

OUTINTDIR := $(OUTINTDIR)develop
TESTINTDIR := $(TESTINTDIR)develop

endif
endif

ifeq ($(BITS), 64)

OUTINTDIR := $(OUTINTDIR)64
TESTINTDIR := $(TESTINTDIR)64


OUTNAME := $(OUTNAME)64
TESTNAME := $(TESTNAME)64

endif

ifeq ($(MODE), DEBUG)

OUTNAME := $(OUTNAME)_debug
TESTNAME := $(TESTNAME)_debug

endif

ifeq ($(MODE), RELEASE)

OUTNAME := $(OUTNAME)_release
TESTNAME := $(TESTNAME)_release

endif

OUTINTDIR := $(OUTINTDIR)/
TESTINTDIR := $(TESTINTDIR)/

OUTPATH = $(OUTDIR)$(OS_LIB_PRE)$(OUTNAME)$(OUTEXT)
TESTPATH = $(TESTDIR)$(TESTNAME)$(TESTEXT)

ININCDIR = ../../include
INDIR = ../../src/ou/

INFILES = \
	atomic \
	customization \
	malloc \
	threadlocalstorage

INOBJS = $(addprefix $(OUTINTDIR), $(addsuffix $(OBJEXT), $(INFILES)))


TESTINCDIR = $(ININCDIR)
TESTLIBDIR = $(OUTDIR)
TESTLIBS = $(OUTNAME)
TESTSRCDIR = ../../test/

ifeq ($(OS_TYPE), Linux)
TESTLIBS += pthread
endif

ifeq ($(OS_TYPE), SUN)
TESTLIBS += pthread c
endif


TESTFILES = outest

TESTOBJS = $(addprefix $(TESTINTDIR), $(addsuffix $(OBJEXT), $(TESTFILES)))


.PHONY: develop debug release develop64 debug64 release64 all ou

all: develop

develop:
	$(MAKE) ou MODE=DEVELOP BITS=32

debug: 
	$(MAKE) ou MODE=DEBUG BITS=32
	
release: 
	$(MAKE) ou MODE=RELEASE BITS=32
	
develop64:
	$(MAKE) ou MODE=DEVELOP BITS=64

debug64: 
	$(MAKE) ou MODE=DEBUG BITS=64
	
release64: 
	$(MAKE) ou MODE=RELEASE BITS=64
	
ou: $(OUTPATH) $(TESTPATH)


.PHONY: mkoutintpath mkoutpath mktestintpath mktestpath

$(OUTPATH): mkoutintpath mkoutpath $(INOBJS)
	$(OS_VP)echo BUILDING $(notdir $(OUTPATH))...
	$(OS_VP)$(AR) $(ARFLAGS) $(OUTPATH) $(INOBJS)

$(TESTPATH): mktestintpath mktestpath $(OUTPATH) $(TESTOBJS)
	$(OS_VP)echo LINKING $(notdir $(TESTPATH))...
	$(OS_VP)$(LD) $(LDFLAGS) $(LDADDFLAGS) -o $(TESTPATH) \
		$(addprefix -I, $(TESTINCDIR) $(OS_INCLUDE_PATH)) \
		$(addprefix -L, $(TESTLIBDIR) $(OS_LIB_PATH)) \
		$(TESTOBJS) \
		$(addprefix -l, $(TESTLIBS))

$(OUTINTDIR)%$(OBJEXT): $(INDIR)%$(SRCEXT)
	$(OS_VP)echo Compiling $(notdir $@)...
	$(OS_VP)$(CXX) $(CXXFLAGS) $(CXXADDFLAGS) -c -o $@ \
		$(addprefix -I, $(ININCDIR) $(OS_INCLUDE_PATH)) \
		$< 

$(TESTINTDIR)%$(OBJEXT): $(TESTSRCDIR)%$(SRCEXT)
	$(OS_VP)echo Compiling $(notdir $@)...
	$(OS_VP)$(CXX) $(CXXFLAGS) $(CXXADDFLAGS) -c -o $@ \
		$(addprefix -I, $(TESTINCDIR) $(OS_INCLUDE_PATH)) \
		$< 


mkoutintpath:
	$(call FN_MKDIR, $(OUTINTDIR))

mktestintpath:
	$(call FN_MKDIR, $(TESTINTDIR))

mkoutpath:
	$(call FN_MKDIR, $(OUTDIR))

mktestpath:
	$(call FN_MKDIR, $(TESTDIR))


.PHONY: runtest

runtest: $(TESTPATH)
	$(TESTPATH)