forked from loentar/staff
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.env
239 lines (205 loc) · 5.28 KB
/
Makefile.env
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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
# environment file for make
ifeq ($(MAKEFILE_ENV_INCLUDED),)
define newline
endef
ifeq ($(shell uname -o 2>/dev/null),Msys)
OS := MINGW
else
OS := $(shell uname -s)
OSVERSION := $(shell uname -r)
ANDROID := $(findstring android,$(CC))
endif
ifneq ($(OS),Darwin)
CXX ?= g++
CC ?= gcc
else
CXX = g++
CC = gcc
endif
CROSSCOMPILE := $(shell $(CXX) -dumpspecs | sed -n '/cross_compile:/{n;p;}')
ifeq ($(CROSSCOMPILE),1)
CXXHOST ?= g++
CCHOST ?= gcc
else
CXXHOST ?= $(CXX)
CCHOST ?= $(CC)
endif
# target platform
ifeq ($(PLATFORM),)
PLATFORM := $(shell $(CXX) -dumpmachine)
endif
# host platform
ifeq ($(HOSTPLATFORM),)
HOSTPLATFORM := $(shell $(CXXHOST) -dumpmachine)
endif
ifneq ($(findstring winsdk,$(PLATFORM)),)
HOSTOS := $(OS)
OS := WINSDK
EXEC_EXT = .exe
else
ifneq ($(findstring mingw,$(PLATFORM)),)
HOSTOS := $(OS)
OS := MINGW
EXEC_EXT = .exe
endif
endif
ifeq ($(CROSSCOMPILE),1)
HOSTMAKEFLAGS += OS=$(HOSTOS) CC=$(CCHOST) CXX=$(CXXHOST) PLATFORM=$(HOSTPLATFORM)-cross HOSTBUILD=1 MAKEFILE_ENV_INCLUDED=
HOSTMAKEFLAGS += STAFF_HOME=$(STAFF_HOME) AXIS2C_HOME=$(HOST_AXIS2C_HOME) EXEC_EXT=
else
HOSTBUILD = 1
endif
TOPDIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST))))/
STAFF_HOME ?= /usr/local/lib/staff
include $(TOPDIR)VERSION
VERSION = $(LIBRARY_VERSION)
VERSION_MAJOR := $(firstword $(subst .,$(empty) $(empty),$(VERSION)))
REVISION := $(shell LANG=C svn info --non-interactive 2>/dev/null | sed -n '/^Revision:/s/.*:[ \t]//p' 2>/dev/null)
ifneq ($(REVISION),)
VERSION_FULL := $(VERSION)-r$(REVISION)
else
VERSION_FULL := $(VERSION)
endif
SRCDIR = src/
OBJDIR = obj/$(PLATFORM)/
OUTDIR = out/$(PLATFORM)/
BINDIR = bin/
LIBDIR = lib/
COMPILER_FLAGS =
LINKER_FLAGS =
ifneq ($(DEBUG),)
COMPILER_FLAGS += -D_DEBUG -g -O0
LINKER_FLAGS += -g -O0
endif
COMPILER_WARNING_FLAGS = -Wall -W -pedantic -Wno-long-long
COMPILER_FLAGS += $(COMPILER_WARNING_FLAGS)
ifeq ($(OS),Linux)
LINUX_VERSION := $(shell find /etc/ -maxdepth 1 -regex '.*[-_]version' -printf '%f\n' | sed -n '1{s/\([^-_]*\).*/\1/g;s/[^a-zA-Z0-9_]/_/g;p}')
LINUX_RELEASE := $(shell find /etc/ -maxdepth 1 -regex '.*[-_]release' -printf '%f\n' | sed -n '1{s/\([^-_]*\).*/\1/g;s/[^a-zA-Z0-9_]/_/g;p}')
endif
VPATH = $(SRCDIR)
ifeq ($(OS),SunOS)
COMPILER_FLAGS += -fPIC
LINKER_FLAGS += -fPIC -lpthread -lposix4
HOSTMAKEFLAGS += HOSTLDFLAGS=-lpthread AXIS2C_HOME=$(HOST_AXIS2C_HOME)
COMPILER_FLAGS += -DAVOID_VERSION
AVOID_VERSION = 1
LN = @true
SUNVERSION := $(shell echo $(OSVERSION) |sed 's/[^\.]*\.//')
WHEREISCMD := $(shell if [ $(SUNVERSION) -gt 10 ] ; then echo whereis; else echo /usr/ucb/whereis; fi >sun )
else
WHEREISCMD=whereis
ifeq (,$(filter $(OS),MINGW WINSDK))
COMPILER_FLAGS += -fPIC -pthread
LINKER_FLAGS += -fPIC
ifneq ($(OS),Darwin)
COMPILER_FLAGS += -rdynamic
endif
ifeq ($(ANDROID),)
LINKER_FLAGS += -pthread
LN = ln -nsf
else
AVOID_VERSION = 1
HOSTMAKEFLAGS += HOSTLDFLAGS=-pthread AXIS2C_HOME=$(HOST_AXIS2C_HOME)
COMPILER_FLAGS += -DAVOID_VERSION
LN = @true
endif
else
ifneq ($(CROSSCOMPILE),1)
COMPILER_FLAGS += -Wno-pedantic-ms-format
endif
COMPILER_FLAGS += -DAVOID_VERSION
LN = @true
AVOID_VERSION = 1
endif
endif
CFLAGS += $(COMPILER_FLAGS)
LFLAGS += $(LINKER_FLAGS)
CXXFLAGS += $(COMPILER_FLAGS)
LDFLAGS += $(LINKER_FLAGS)
ECHO := echo$(shell test -z "$$(echo -e)" && echo ' -e ')
ifneq ($(VERSION),)
DVERSION = .$(VERSION)
DVERSIONM = .$(VERSION_MAJOR)
endif
LIBRARY_PREV_PATH_ENV = :$${$(LIBRARY_PATH_ENV)}
ifeq ($(OS),Darwin)
LIBPREFIX = lib
LIBEXT = .dylib
LIBVEREXT = $(DVERSION)$(LIBEXT)
LIBVEMREXT = $(DVERSIONM)$(LIBEXT)
LDLIB = -dynamiclib -Wl,-dylib_install_name -Wl,
LIBRARY_PATH_ENV = DYLD_LIBRARY_PATH
else
ifneq (,$(filter $(OS),MINGW WINSDK))
LIBPREFIX =
LIBEXT = .dll
LIBVEREXT = $(LIBEXT)
LIBVERMEXT = $(LIBEXT)
LDLIB = -shared -Wl,-soname,
AXIS2C_HOME := $(subst :,,$(subst \,/,/$(AXIS2C_HOME)))
STAFF_HOME := $(subst :,,$(subst \,/,/$(STAFF_HOME)))
ifeq ($(OS),MINGW)
CFLAGS += -DAXIS2_SKIP_INT_TYPEDEFS
CXXFLAGS += -DAXIS2_SKIP_INT_TYPEDEFS
ifneq ($(CROSSCOMPILE),1)
LIBRARY_PATH_ENV = PATH
CC = gcc
else
LIBRARY_PATH_ENV = LD_LIBRARY_PATH
endif
else
LIBRARY_PATH_ENV = LD_LIBRARY_PATH
endif
else
ifeq ($(OS),SunOS)
LIBPREFIX = lib
LIBEXT = .so
LIBVEREXT = $(LIBEXT)
LIBVERMEXT = $(LIBEXT)
LDLIB = -shared -Wl,-h,
else
LIBPREFIX = lib
LIBEXT = .so
ifeq ($(ANDROID),)
LIBVEREXT = $(LIBEXT)$(DVERSION)
LIBVERMEXT = $(LIBEXT)$(DVERSIONM)
else
LIBVEREXT = $(LIBEXT)
LIBVERMEXT = $(LIBEXT)
endif
LDLIB = -shared -Wl,-soname,
endif
LIBRARY_PATH_ENV = LD_LIBRARY_PATH
endif
endif
ifeq ($(LINUX_RELEASE),MCBC)
APXS := $(shell which /www/bin/apxs 2>/dev/null)
else
ifeq ($(OS),SunOS)
APXS := $(shell bash type /usr/bin/apxs /usr/bin/apxs2 2>/dev/null)
ifeq ($?,1)
undefine APXS
endif
else
APXS := $(shell which apxs2 apxs 2>/dev/null | head -1)
endif
ifneq ($(APXS),)
ifeq ($(OS),SunOS)
APXSREAL := $(shell ls -la $(APXS)|awk '{ print $$11 }')
else
APXSREAL := $(shell readlink $(APXS))
endif
ifneq ($(APXSREAL),)
APXS := $(APXSREAL)
endif
endif
endif
INSTALLINCDIR = $(STAFF_HOME)/include/
INSTALLLIBDIR = $(STAFF_HOME)/lib/
DEPLOYDIR = $(TOPDIR)deploy/$(PLATFORM)/
DEPLOYINCDIR = $(DEPLOYDIR)$(INSTALLINCDIR)
DEPLOYLIBDIR = $(DEPLOYDIR)$(INSTALLLIBDIR)
MAKEFILE_ENV_INCLUDED = 1
endif
.EXPORT_ALL_VARIABLES: