Makefile 8.56 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
############################################################################
# Makefile
# Copyright (C) 2014  Belledonne Communications, Grenoble France
#
############################################################################
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#
############################################################################

23 24 25 26 27 28
PWD=$(shell pwd)

.PHONY: all \
	build-desktop clean-desktop \
	build-flexisip clean-flexisip \
	build-flexisip-rpm clean-flexisip-rpm \
29
	build-python clean-python build-python-raspberry \
30 31 32
	build-bb10-i486 build-bb10-arm build-bb10 clean-bb10-i486 clean-bb10-arm clean-bb10 help-bb10 generate-bb10-sdk \
	build-ios-i386 build-ios-armv7 build-ios-armv7s build-ios clean-ios-i386 clean-ios-armv7 clean-ios-armv7s clean-ios help-ios generate-ios-sdk \
	veryclean
Ghislain MARY's avatar
Ghislain MARY committed
33 34 35 36

all: build-desktop

build-desktop:
37 38
	mkdir -p WORK/cmake-desktop && \
	cd WORK/cmake-desktop && \
39 40 41 42
	cmake ../.. \
		-DCMAKE_PREFIX_PATH=$(PWD)/OUTPUT\
		-DCMAKE_INSTALL_PREFIX=$(PWD)/OUTPUT \
		$(filter -D%,$(MAKEFLAGS)) && \
43
	make
Ghislain MARY's avatar
Ghislain MARY committed
44 45

clean-desktop:
46 47
	rm -rf WORK/Build-desktop && \
	rm -rf WORK/tmp-desktop
48

49
prepare-flexisip:
Guillaume BIENKOWSKI's avatar
Guillaume BIENKOWSKI committed
50 51 52 53 54
	export ODBC_PATH=../../OUTPUT
	mkdir -p WORK/cmake-flexisip && \
	cd WORK/cmake-flexisip && \
	cmake ../.. -DLINPHONE_BUILDER_CONFIG_FILE=configs/config-flexisip.cmake \
		-DLINPHONE_BUILDER_TARGET=flexisip \
55 56
		-DCMAKE_PREFIX_PATH=$(PWD)/OUTPUT\
		-DCMAKE_INSTALL_PREFIX=$(PWD)/OUTPUT \
57
		$(filter -D%,$(MAKEFLAGS))
58

Guillaume BIENKOWSKI's avatar
Guillaume BIENKOWSKI committed
59 60 61 62
clean-flexisip:
	rm -rf WORK/tmp-flexisip && \
	rm -rf WORK/Build-flexisip

63
prepare-flexisip-rpm:
64 65 66 67 68
	export ODBC_PATH=../../OUTPUT
	mkdir -p WORK/cmake-flexisip-rpm && \
	cd WORK/cmake-flexisip-rpm && \
	cmake ../.. -DLINPHONE_BUILDER_CONFIG_FILE=configs/config-flexisip-rpm.cmake \
		-DLINPHONE_BUILDER_TARGET=flexisip \
69 70
		-DCMAKE_PREFIX_PATH=$(PWD)/OUTPUT\
		-DCMAKE_INSTALL_PREFIX=$(PWD)/OUTPUT \
71 72 73
		$(filter -D%,$(MAKEFLAGS))


74

75
clean-flexisip-rpm:
76
	rm -rf WORK/tmp-flexisip-rpm
77 78 79 80
	rm -rf WORK/Build-flexisip-rpm
# needed: ?
#	rm -rf WORK/rpmbuild/RPMS/*

81 82 83 84
build-python:
	mkdir -p WORK/cmake-python && \
	cd WORK/cmake-python && \
	cmake ../.. -DLINPHONE_BUILDER_CONFIG_FILE=configs/config-python.cmake -DCMAKE_PREFIX_PATH=$(PWD)/OUTPUT -DCMAKE_INSTALL_PREFIX=$(PWD)/OUTPUT $(filter -D%,$(MAKEFLAGS)) && \
85
	make
86

87 88 89 90 91 92 93 94 95
build-python-raspberry:
	mkdir -p WORK/cmake-python-raspberry && \
	cd WORK/cmake-python-raspberry && \
	cmake ../.. -DCMAKE_TOOLCHAIN_FILE=toolchains/toolchain-raspberry.cmake \
		-DLINPHONE_BUILDER_CONFIG_FILE=configs/config-python-raspberry.cmake \
		-DCMAKE_PREFIX_PATH=$(PWD)/OUTPUT -DCMAKE_INSTALL_PREFIX=$(PWD)/OUTPUT \
		$(filter -D%,$(MAKEFLAGS)) && \
	make

96 97 98 99 100
clean-python:
	rm -rf WORK/Build-python && \
	rm -rf WORK/tmp-python
	rm -rf OUTPUT

101
build-bb10-i486:
102 103 104
	mkdir -p OUTPUT/liblinphone-bb10-sdk && \
	mkdir -p WORK/cmake-bb10-i486 && \
	cd WORK/cmake-bb10-i486 && \
105 106 107 108 109
	cmake ../.. -DCMAKE_TOOLCHAIN_FILE=toolchains/toolchain-bb10-i486.cmake \
		-DLINPHONE_BUILDER_CONFIG_FILE=configs/config-bb10-i486.cmake \
		-DCMAKE_PREFIX_PATH=$(PWD)/OUTPUT/liblinphone-bb10-sdk/i486 \
		-DCMAKE_INSTALL_PREFIX=$(PWD)/OUTPUT/liblinphone-bb10-sdk/i486 \
		$(filter -D%,$(MAKEFLAGS)) && \
110
	make
111 112

build-bb10-arm:
113 114 115
	mkdir -p OUTPUT/liblinphone-bb10-sdk && \
	mkdir -p WORK/cmake-bb10-arm && \
	cd WORK/cmake-bb10-arm && \
116 117 118 119 120
	cmake ../.. -DCMAKE_TOOLCHAIN_FILE=toolchains/toolchain-bb10-arm.cmake \
		-DLINPHONE_BUILDER_CONFIG_FILE=configs/config-bb10-arm.cmake \
		-DCMAKE_PREFIX_PATH=$(PWD)/OUTPUT/liblinphone-bb10-sdk/arm \
		-DCMAKE_INSTALL_PREFIX=$(PWD)/OUTPUT/liblinphone-bb10-sdk/arm \
		$(filter -D%,$(MAKEFLAGS)) && \
121
	make
122 123 124 125

build-bb10: build-bb10-i486 build-bb10-arm

clean-bb10-i486:
126
	rm -rf WORK/Build-bb10-i486 && \
127 128
	rm -rf WORK/tmp-bb10-i486 && \
	rm -rf OUTPUT/liblinphone-bb10-sdk/i486
129 130

clean-bb10-arm:
131
	rm -rf WORK/Build-bb10-arm && \
132 133
	rm -rf WORK/tmp-bb10-arm && \
	rm -rf OUTPUT/liblinphone-bb10-sdk/arm
134

135
clean-bb10: clean-bb10-i486 clean-bb10-arm
136

Ghislain MARY's avatar
Ghislain MARY committed
137 138 139 140
help-bb10:
	mkdir -p OUTPUT/liblinphone-bb10-sdk && \
	mkdir -p WORK/cmake-bb10-i486 && \
	cd WORK/cmake-bb10-i486 && \
141 142 143 144 145
	cmake ../.. -DCMAKE_TOOLCHAIN_FILE=toolchains/toolchain-bb10-i486.cmake \
		-DLINPHONE_BUILDER_CONFIG_FILE=configs/config-bb10-i486.cmake \
		-DCMAKE_PREFIX_PATH=$(PWD)/OUTPUT/liblinphone-bb10-sdk/i486 \
		-DCMAKE_INSTALL_PREFIX=$(PWD)/OUTPUT/liblinphone-bb10-sdk/i486 \
		$(filter -D%,$(MAKEFLAGS)) -LH
Ghislain MARY's avatar
Ghislain MARY committed
146

Ghislain MARY's avatar
Ghislain MARY committed
147 148
generate-bb10-sdk: build-bb10
	cd OUTPUT && \
149
	zip -r liblinphone-bb10-sdk-`cd ../WORK/Source/EP_linphone && git describe --always`.zip liblinphone-bb10-sdk
Ghislain MARY's avatar
Ghislain MARY committed
150 151 152 153 154

build-ios-i386:
	mkdir -p OUTPUT/liblinphone-ios-sdk && \
	mkdir -p WORK/cmake-ios-i386 && \
	cd WORK/cmake-ios-i386 && \
155 156 157 158 159
	cmake ../.. -DCMAKE_TOOLCHAIN_FILE=toolchains/toolchain-ios-i386.cmake \
		-DLINPHONE_BUILDER_CONFIG_FILE=configs/config-ios-i386.cmake \
		-DCMAKE_PREFIX_PATH=$(PWD)/OUTPUT/liblinphone-ios-sdk/i386 \
		-DCMAKE_INSTALL_PREFIX=$(PWD)/OUTPUT/liblinphone-ios-sdk/i386 \
		$(filter -D%,$(MAKEFLAGS)) && \
160
	make
Ghislain MARY's avatar
Ghislain MARY committed
161 162 163 164 165

build-ios-armv7:
	mkdir -p OUTPUT/liblinphone-ios-sdk && \
	mkdir -p WORK/cmake-ios-armv7 && \
	cd WORK/cmake-ios-armv7 && \
166 167 168 169 170
	cmake ../.. -DCMAKE_TOOLCHAIN_FILE=toolchains/toolchain-ios-armv7.cmake \
		-DLINPHONE_BUILDER_CONFIG_FILE=configs/config-ios-armv7.cmake \
		-DCMAKE_PREFIX_PATH=$(PWD)/OUTPUT/liblinphone-ios-sdk/armv7 \
		-DCMAKE_INSTALL_PREFIX=$(PWD)/OUTPUT/liblinphone-ios-sdk/armv7 \
		$(filter -D%,$(MAKEFLAGS)) && \
171
	make
Ghislain MARY's avatar
Ghislain MARY committed
172 173 174 175 176

build-ios-armv7s:
	mkdir -p OUTPUT/liblinphone-ios-sdk && \
	mkdir -p WORK/cmake-ios-armv7s && \
	cd WORK/cmake-ios-armv7s && \
177 178 179 180 181
	cmake ../.. -DCMAKE_TOOLCHAIN_FILE=toolchains/toolchain-ios-armv7s.cmake \
		-DLINPHONE_BUILDER_CONFIG_FILE=configs/config-ios-armv7s.cmake \
		-DCMAKE_PREFIX_PATH=$(PWD)/OUTPUT/liblinphone-ios-sdk/armv7s \
		-DCMAKE_INSTALL_PREFIX=$(PWD)/OUTPUT/liblinphone-ios-sdk/armv7s \
		$(filter -D%,$(MAKEFLAGS)) && \
182
	make
Ghislain MARY's avatar
Ghislain MARY committed
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206

build-ios: build-ios-i386 build-ios-armv7 build-ios-armv7s

clean-ios-i386:
	rm -rf WORK/Build-ios-i386 && \
	rm -rf WORK/tmp-ios-i386 && \
	rm -rf OUTPUT/liblinphone-ios-sdk/i386

clean-ios-armv7:
	rm -rf WORK/Build-ios-armv7 && \
	rm -rf WORK/tmp-ios-armv7 && \
	rm -rf OUTPUT/liblinphone-ios-sdk/armv7

clean-ios-armv7s:
	rm -rf WORK/Build-ios-armv7s && \
	rm -rf WORK/tmp-ios-armv7s && \
	rm -rf OUTPUT/liblinphone-ios-sdk/armv7s

clean-ios: clean-ios-i386 clean-ios-armv7 clean-ios-armv7s

help-ios:
	mkdir -p OUTPUT/liblinphone-ios-sdk && \
	mkdir -p WORK/cmake-ios-i386 && \
	cd WORK/cmake-ios-i386 && \
207 208 209 210 211
	cmake ../.. -DCMAKE_TOOLCHAIN_FILE=toolchains/toolchain-ios-i386.cmake \
		-DLINPHONE_BUILDER_CONFIG_FILE=configs/config-ios-i386.cmake \
		-DCMAKE_PREFIX_PATH=$(PWD)/OUTPUT/liblinphone-ios-sdk/i386 \
		-DCMAKE_INSTALL_PREFIX=$(PWD)/OUTPUT/liblinphone-ios-sdk/i386 \
		$(filter -D%,$(MAKEFLAGS)) -LH
Ghislain MARY's avatar
Ghislain MARY committed
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
generate-ios-sdk: build-ios
	arm_archives=`find OUTPUT/liblinphone-ios-sdk/armv7 -name *.a` && \
	mkdir -p OUTPUT/liblinphone-ios-sdk/apple-darwin && \
	cp -rf OUTPUT/liblinphone-ios-sdk/armv7/include OUTPUT/liblinphone-ios-sdk/apple-darwin/. && \
	cp -rf OUTPUT/liblinphone-ios-sdk/armv7/share OUTPUT/liblinphone-ios-sdk/apple-darwin/. && \
	for archive in $$arm_archives ; do \
		i386_path=`echo $$archive | sed -e "s/armv7/i386/"` ;\
		armv6_path=`echo $$archive | sed -e "s/armv7/armv6/"` ;\
		if  test ! -f "$$armv6_path"; then \
			armv6_path= ; \
		fi; \
		armv7s_path=`echo $$archive | sed -e "s/armv7/armv7s/"` ;\
		if  test ! -f "$$armv7s_path"; then \
			armv7s_path= ; \
		fi; \
		destpath=`echo $$archive | sed -e "s/-debug//"` ;\
		destpath=`echo $$destpath | sed -e "s/armv7/apple-darwin/"` ;\
		if test -f "$$i386_path"; then \
			echo "Mixing $$archive into $$destpath"; \
			mkdir -p `dirname $$destpath` ; \
			lipo -create $$archive $$armv7s_path $$armv6_path $$i386_path -output $$destpath; \
		else \
			echo "WARNING: archive `basename $$archive` exists in arm tree but does not exists in i386 tree."; \
		fi \
	done && \
	cd OUTPUT && \
	zip -r liblinphone-ios-sdk.zip liblinphone-ios-sdk/apple-darwin

241 242 243
veryclean:
	rm -rf WORK && \
	rm -rf OUTPUT
244 245 246 247 248

check-latest:
	mkdir -p WORK && \
	cd WORK && \
	cmake .. -DLINPHONE_BUILDER_CHECK_LATEST=Yes