-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.top
141 lines (119 loc) · 2.97 KB
/
Makefile.top
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
# Copyright 2012, Qualcomm Innovation Center, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Example command: make OS=linux CPU=x86 VARIANT=debug
.PHONY: all dist clean distclean
all: distclean dist
CC=gcc
CXX=g++
AR=ar
# build configuration
ifeq "$(CPU)" "x86"
CPU = x86
else
ifeq "$(CPU)" "x86-64"
CPU = x86-64
else
$(error CPU=$(CPU) is not supported.)
endif
endif
ifeq "$(OS)" "linux"
OS = linux
else
$(error OS=$(OS) is not supported.)
endif
ifeq "$(VARIANT)" "debug"
VARIANT = debug
else
ifeq "$(VARIANT)" "release"
VARIANT = release
else
$(error VARIANT=$(VARIANT) is not supported.)
endif
endif
ifeq "$(OS)" "linux"
# Linux specific flags
CPPDEFINES+=-DQCC_OS_LINUX
CPPDEFINES+=-DQCC_OS_GROUP_POSIX
OS_GROUP=posix
endif
CFLAGS=-Wall \
-Werror=non-virtual-dtor \
-pipe \
-std=c99 \
-fno-strict-aliasing \
-Wno-long-long
CXXFLAGS=-Wall \
-Werror=non-virtual-dtor \
-pipe \
-std=c++0x \
-fno-rtti \
-fno-exceptions \
-fno-strict-aliasing \
-Wno-long-long \
-Wno-deprecated
ifeq "$(CPU)" "x86"
# Force 32-bit builds
CXXFLAGS+=-m32
CFLAGS+=-m32
else
ifeq "$(CPU)" "x86-64"
CXXFLAGS+=-m64 -fPIC
CFLAGS+=-m64 -fPIC
endif
endif
# Debug/Release Variants
ifeq "$(VARIANT)" "debug"
CFLAGS+=-g
CXXFLAGS+=-g
JAVACFLAGS+=-g -Xlint -Xlint:-serial
else
CFLAGS+=-O3
CXXFLAGS+=-O3
LINKFLAGS=-s
CPPDEFINES+=-DNDEBUG
JAVACFLAGS=-Xlint -Xlint:-serial
endif
# Header/lib path include
INCLUDE = -I$(PWD)/common/inc -I$(PWD)/alljoyn_core/inc -I$(PWD)/alljoyn_core/src -I$(PWD)/alljoyn_core/daemon
LIBS = -lalljoyn
# Platform specifics system libs
ifeq "$(OS)" "linux"
LIBS += -lrt -lstdc++ -lpthread -lcrypto -lssl
endif
CRYPTO = openssl
INSTALLDIR = $(PWD)/build/$(OS)/$(CPU)/$(VARIANT)
ALLJOYNLIB = $(INSTALLDIR)/dist/lib/liballjoyn.a
COMMONDIR = $(PWD)/common
INCLUDE += -L$(INSTALLDIR)/dist/lib
JUNK=*.o *~
export
dist:
@mkdir -p $(INSTALLDIR)/dist/lib
@mkdir -p $(INSTALLDIR)/dist/bin
@mkdir -p $(INSTALLDIR)/dist/bin/samples
@mkdir -p $(INSTALLDIR)/dist/inc
@mkdir -p $(INSTALLDIR)/dist/samples
cd common; make;
cd alljoyn_core; make;
clean:
@rm -f $(JUNK)
cd common; make clean;
cd alljoyn_core; make clean;
distclean: clean
@rm -rf $(INSTALLDIR)/dist/lib
@rm -rf $(INSTALLDIR)/dist/bin
@rm -rf $(INSTALLDIR)/dist/inc
@rm -rf $(INSTALLDIR)/dist/samples