aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 704ea8a7f3a07c14aca7b4ff78d5dfcb2f3731d6 (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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
 #############################################################################
 # Copyright (c) 2017 Cisco and/or its affiliates.
 # 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.
 ##############################################################################

DISTILLERY_VERSION=2.0

default.target: help

all: init_depend install-all init_qt

##############################################################
# Variables
#
# Set some variables
DISTILLERY_STAMP=.distillery.stamp
REBUILD_DEPENDS=

##############################################################
# Load the configuration
#
# For more information please see config.default.mk
#
DISTILLERY_CONFIG_DIR ?= config

##DISTILLERY_DEFAULT_CONFIG ?= ${DISTILLERY_CONFIG_DIR}/config.mk
##DISTILLERY_LOCAL_CONFIG   ?= ${DISTILLERY_CONFIG_DIR}/local/config.mk
DISTILLERY_USER_CONFIG    ?= ${DISTILLERY_CONFIG_DIR}/config.mk

ifneq (,$(wildcard ${DISTILLERY_USER_CONFIG}))
    include ${DISTILLERY_USER_CONFIG}
    REBUILD_DEPENDS+=${DISTILLERY_USER_CONFIG}
else
    DISTILLERY_USER_CONFIG+="[Not Found]"
endif

ifneq (,$(wildcard ${DISTILLERY_LOCAL_CONFIG}))
    include ${DISTILLERY_LOCAL_CONFIG}
    REBUILD_DEPENDS+=${DISTILLERY_LOCAL_CONFIG}
endif

include ${DISTILLERY_DEFAULT_CONFIG}


##############################################################
# Set the paths
#
# PATH: add our install dir, build dependencies and system dependencies
# LD_RUN_PATH: add our install dir

export PATH := $(DISTILLERY_INSTALL_DIR)/bin:$(DISTILLERY_TOOLS_DIR)/bin:$(PATH)
#export LD_RUN_PATH := $(DISTILLERY_INSTALL_DIR)/lib
#export LD_LIBRARY_PATH := $(DISTILLERY_INSTALL_DIR)/lib
export CCNX_HOME
export FOUNDATION_HOME


##############################################################
# Modules
#
# Load the modules config. Please refer to that file for more information
DISTILLERY_MODULES_DIR=${DISTILLERY_CONFIG_DIR}/modules

# The modules variable is a list of modules. It will be populated by the
# modules config files.
modules=
modules_dir=
    include config/modules/000-distillery-update.mk
	include config/modules/000-gitModule.mk
	include config/modules/001-modules.mk
	include config/modules/002-cmake-modules.mk
	include config/modules/002-make-modules.mk
	include config/modules/100-distillery.mk
	include config/modules/106-jsoncpp.mk
	include config/modules/107-libevent.mk
	include config/modules/108-libxml2.mk
	include config/modules/110-longbow.mk
	include config/modules/120-libparc.mk
	include config/modules/210-libccnx-common.mk
	include config/modules/220-libccnx-transport-rta.mk
	include config/modules/230-libccnx-portal.mk
	include config/modules/510-forwarder.mk
	include config/modules/610-libicnet.mk
	include config/modules/610-libdash.mk
	include config/modules/710-http-server.mk

# Load user defined modules
DISTILLERY_USER_MODULES_DIR=${DISTILLERY_USER_CONFIG_DIR}/modules
ifneq (,$(wildcard ${DISTILLERY_USER_MODULES_DIR}))
    include ${DISTILLERY_USER_MODULES_DIR}/*.mk
else
    DISTILLERY_USER_MODULES_DIR+="[Not Found]"
endif

ifdef ${DISTILLERY_LOCAL_MODULES_DIR}
    include ${DISTILLERY_LOCAL_MODULES_DIR}/*.mk
else
    DISTILLERY_LOCAL_MODULES_DIR="[Undefined]"
endif

install-all: install-directories ${modules}

init_depend:
	./scripts/init.sh ${ABI} ${DISTILLERY_INSTALL_DIR};
init_qt:
	./scripts/init_qt.sh
android_metisforwarder:
	./scripts/compile_metisforwarder.sh
android_metisforwarder_debug:
	./scripts/compile_metisforwarder.sh DEBUG
android_iget:
	./scripts/compile_iget.sh
android_iget_debug:
	./scripts/compile_iget.sh DEBUG
android_viper:
	./scripts/compile_androidviper.sh
android_viper_debug:
	./scripts/compile_androidviper.sh DEBUG
android_httpserver:
	./scripts/compile_httpserver.sh
android_httpserver_debug:
	./scripts/compile_httpserver.sh DEBUG

curl-clean:
	@rm -rf external/curl
	@rm -rf external/libcurl_android/obj
	@rm -rf external/libcurl_android/jni/libcurl/include
	@rm -rf external/libcurl_android/jni/libcurl/src
	@rm -rf external/libcurl_android/jni/libcurl/lib
	@rm -rf ${DISTILLERY_INSTALL_DIR}/lib/libcurl*
	@rm -rf ${DISTILLERY_INSTALL_DIR}/include/curl
	
openssl-clean:
	@rm -rf ${DISTILLERY_INSTALL_DIR}/lib/libssl.*
	@rm -rf ${DISTILLERY_INSTALL_DIR}/lib/libcrypto.*
	@rm -rf ${DISTILLERY_INSTALL_DIR}/include/openssl
	@rm -rf external/openssl-1.0.2k*
	@rm -rf ${NDK}/sources/openssl/1.0.2k
	
boost-clean:
	@rm -rf ${DISTILLERY_INSTALL_DIR}/lib/libboost*
	@rm -rf ${DISTILLERY_INSTALL_DIR}/include/boost
	@rm -rf external/boost_1_63_0
	@rm -rf external/boost_1_63_0.tar.gz
	
event-clean:
	@rm -rf external/libevent
	@rm -rf ${DISTILLERY_INSTALL_DIR}/lib/libevent*
	@rm -rf ${DISTILLERY_INSTALL_DIR}/include/event2
		
xml2-clean:
	@rm -rf external/libxml2
	@rm -rf external/libxml2_android/obj
	@rm -rf external/libxml2_android/jni/libxml2/*.c
	@rm -rf external/libxml2_android/jni/libxml2/*.h
	@rm -rf external/libxml2_android/jni/libxml2/include
	@rm -rf ${DISTILLERY_INSTALL_DIR}/lib/libxml2*
	@rm -rf ${DISTILLERY_INSTALL_DIR}/include/jsoncpp
	@rm -rf ${DISTILLERY_INSTALL_DIR}/include/win32config.h
	@rm -rf ${DISTILLERY_INSTALL_DIR}/include/wsockcompat.h

jsoncpp-clean:
	@rm -rf external/jsoncpp
	@rm -rf external/jsoncpp_android/obj
	@rm -rf ${DISTILLERY_INSTALL_DIR}/lib/libjsoncpp.*
	@rm -rf ${DISTILLERY_INSTALL_DIR}/include/libxml

dependencies-clean: event-clean openssl-clean boost-clean curl-clean xml2-clean jsoncpp-clean
	
sdk-clean:
	@rm -rf sdk/android-sdk_*
	@rm -rf sdk/sdk
	
ndk-clean:
	@rm -rf sdk/android-ndk-*
	@rm -rf sdk/ndk-bundle
	
cmake-clean:
	@rm -rf cmake-*
	@rm -rf cmake
	
androidsdk-clean: sdk-clean ndk-clean cmake-clean

cframework-clean:
	@rm -rf ${DISTILLERY_BUILD_DIR}/cframework
	@rm -rf ${DISTILLERY_INSTALL_DIR}/lib/liblongbow.*
	@rm -rf ${DISTILLERY_INSTALL_DIR}/include/LongBow
	@rm -rf ${DISTILLERY_INSTALL_DIR}/lib/libparc.*
	@rm -rf ${DISTILLERY_INSTALL_DIR}/include/parc
	
ccnxlibs-clean:
	@rm -rf src/ccnxlibs
	@rm -rf ${DISTILLERY_BUILD_DIR}/ccnxlibs
	@rm -rf ${DISTILLERY_INSTALL_DIR}/lib/libccnx-*
	@rm -rf ${DISTILLERY_INSTALL_DIR}/include/ccnx/common
	@rm -rf ${DISTILLERY_INSTALL_DIR}/include/ccnx/transport
	@rm -rf ${DISTILLERY_INSTALL_DIR}/include/ccnx/api

hicn-fwd-clean:
	@rm -rf src/sb-forwarder
	@rm -rf ${DISTILLERY_BUILD_DIR}/hicn-fwd
	@rm -rf ${DISTILLERY_INSTALL_DIR}/lib/libhicnfwd.*
	@rm -rf ${DISTILLERY_INSTALL_DIR}/include/hicn-forwarder
	@rm -rf ${DISTILLERY_INSTALL_DIR}/include/config.h

libhicnet-clean:
	@rm -rf src/libhicnet
	@rm -rf ${DISTILLERY_BUILD_DIR}/libhicnet
	@rm -rf ${DISTILLERY_INSTALL_DIR}/lib/libhicnet*
	@rm -rf ${DISTILLERY_INSTALL_DIR}/include/hicnet

libhicn-clean:
	@rm -rf src/libhicnet
	@rm -rf ${DISTILLERY_BUILD_DIR}/libhicn
	@rm -rf ${DISTILLERY_INSTALL_DIR}/lib/libhicn.*
	@rm -rf ${DISTILLERY_INSTALL_DIR}/include/hicnet.h
	@rm -rf ${DISTILLERY_INSTALL_DIR}/include/hicnet_*

libdash-clean:
	@rm -rf ${DISTILLERY_BUILD_DIR}/libdash
	@rm -rf ${DISTILLERY_INSTALL_DIR}/lib/libdash.*
	@rm -rf ${DISTILLERY_INSTALL_DIR}/include/libdash

qt-clean:
	@rm -rf qt/*
	@rm -rf ${DISTILLERY_BUILD_DIR}/qtav
	
all-clean: dependencies-clean cframework-clean ccnxlibs-clean hicn-fwd-clean libhicnet-clean qt-clean libhicn-clean

update:
	./scripts/update.sh

help:
	@echo "---- Basic build targets ----"
	@echo "make help			- This help message"
	@echo "make update			- git pull the different modules to the head of master"
	@echo "make all				- Download sdk, ndk and dependencies, configure, compile and install all software in DISTILLERY_INSTALL_DIR"
	@echo "make init_depend 	- Download sdk, ndk and dependencies, compile and install all dependencies in DISTILLERY_INSTALL"
	@echo "make install-all 	- Configure, compile and install all software in DISTILLERY_INSTALL_DIR"
	@echo "curl-clean			- Clean curl files and libs"
	@echo "boost-clean			- Clean boost files and libs"
	@echo "openssl-clean		- Clean opennssl files and libs"
	@echo "event-clean			- Clean libevent files and libs"
	@echo "jsoncpp-clean		- Clean libjsoncpp files and libs"
	@echo "xml2-clean			- Clean libxml2 files and libs"
	@echo "dependencies-clean 	- Clean all dependencies files and libs"
	@echo "sdk-clean			- Clean sdk files"
	@echo "ndk-clean			- Clean ndk files"
	@echo "cmake-clean			- Clean cmake files"
	@echo "androidsdk-clean		- Clean sdk, ndk and cmake files"
	@echo "cframework-clean		- Clean cframework (libparc and longbow) files and libs"
	@echo "ccnxlibs-clean		- Clean ccnxlibs files and libs"
	@echo "hicn-fwd-clean		- Clean hicn-fwd files and libs"
	@echo "libhicnet-clean		- Clean libhicnet files and libs"
	@echo "libhicn-clean		- Clean libhicn files and libs"
	@echo "libdash-clean		- Clean libdash files and libs"
	@echo "all-clean			- Clean	all files and libs"
	@echo "android_metisforwarder	- Build MetisForwarder apk for android"
	@echo "android_metisforwarder_debug	- Build MetisForwarder apk for android in debug mode"
	@echo "android_iget		- Build iGet apk for android apk" 
	@echo "android_iget_debug	- Build iGet apk for android apk in debug mode"
	@echo "android_httpserver		- Build HttpServer apk for android apk" 
	@echo "android_httpserver_debug	- Build HttpServer apk for android apk in debug mode"
	@echo "android_viper		- Build Viper apk for android apk" 
	@echo "android_viper_debug	- Build Viper apk for android apk in debug mode"
	
${DISTILLERY_STAMP}: ${REBUILD_DEPENDS}
	touch $@

install-directories:
	@mkdir -p ${DISTILLERY_INSTALL_DIR}/include
	@mkdir -p ${DISTILLERY_INSTALL_DIR}/lib
	@mkdir -p ${DISTILLERY_INSTALL_DIR}/bin


.PHONY: dependencies