Makefile 6.45 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.
#
############################################################################

Ghislain MARY's avatar
Ghislain MARY committed
23 24
NUMCPUS?=$(shell grep -c '^processor' /proc/cpuinfo || echo "1" )

Ghislain MARY's avatar
Ghislain MARY committed
25
.PHONY: build-desktop build-bb10-i486 build-bb10-arm build-bb10 build-ios-i386 build-ios-armv7 build-ios-armv7s
26 27 28 29

all: build-desktop

build-desktop:
30 31 32
	mkdir -p WORK/cmake-desktop && \
	cd WORK/cmake-desktop && \
	cmake ../.. $(filter -D%,$(MAKEFLAGS)) && \
Ghislain MARY's avatar
Ghislain MARY committed
33
	make -j $(NUMCPUS)
34 35

clean-desktop:
36 37
	rm -rf WORK/Build-desktop && \
	rm -rf WORK/tmp-desktop
38

39
build-bb10-i486:
40 41 42
	mkdir -p OUTPUT/liblinphone-bb10-sdk && \
	mkdir -p WORK/cmake-bb10-i486 && \
	cd WORK/cmake-bb10-i486 && \
43
	cmake ../.. -DCMAKE_TOOLCHAIN_FILE=toolchains/toolchain-bb10-i486.cmake -DLINPHONE_BUILDER_CONFIG_FILE=configs/config-bb10-i486.cmake -DCMAKE_PREFIX_PATH=../../OUTPUT/liblinphone-bb10-sdk/i486 -DCMAKE_INSTALL_PREFIX=../../OUTPUT/liblinphone-bb10-sdk/i486 $(filter -D%,$(MAKEFLAGS)) && \
Ghislain MARY's avatar
Ghislain MARY committed
44
	make -j $(NUMCPUS)
45 46

build-bb10-arm:
47 48 49
	mkdir -p OUTPUT/liblinphone-bb10-sdk && \
	mkdir -p WORK/cmake-bb10-arm && \
	cd WORK/cmake-bb10-arm && \
50
	cmake ../.. -DCMAKE_TOOLCHAIN_FILE=toolchains/toolchain-bb10-arm.cmake -DLINPHONE_BUILDER_CONFIG_FILE=configs/config-bb10-arm.cmake -DCMAKE_PREFIX_PATH=../../OUTPUT/liblinphone-bb10-sdk/arm -DCMAKE_INSTALL_PREFIX=../../OUTPUT/liblinphone-bb10-sdk/arm $(filter -D%,$(MAKEFLAGS)) && \
Ghislain MARY's avatar
Ghislain MARY committed
51
	make -j $(NUMCPUS)
52 53 54 55

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

clean-bb10-i486:
56
	rm -rf WORK/Build-bb10-i486 && \
57 58
	rm -rf WORK/tmp-bb10-i486 && \
	rm -rf OUTPUT/liblinphone-bb10-sdk/i486
59 60

clean-bb10-arm:
61
	rm -rf WORK/Build-bb10-arm && \
62 63
	rm -rf WORK/tmp-bb10-arm && \
	rm -rf OUTPUT/liblinphone-bb10-sdk/arm
64

65
clean-bb10: clean-bb10-i486 clean-bb10-arm
66

Ghislain MARY's avatar
Ghislain MARY committed
67 68 69 70
help-bb10:
	mkdir -p OUTPUT/liblinphone-bb10-sdk && \
	mkdir -p WORK/cmake-bb10-i486 && \
	cd WORK/cmake-bb10-i486 && \
71
	cmake ../.. -DCMAKE_TOOLCHAIN_FILE=toolchains/toolchain-bb10-i486.cmake -DLINPHONE_BUILDER_CONFIG_FILE=configs/config-bb10-i486.cmake -DCMAKE_PREFIX_PATH=../../OUTPUT/liblinphone-bb10-sdk/i486 -DCMAKE_INSTALL_PREFIX=../../OUTPUT/liblinphone-bb10-sdk/i486 $(filter -D%,$(MAKEFLAGS)) -LH
Ghislain MARY's avatar
Ghislain MARY committed
72

Ghislain MARY's avatar
Ghislain MARY committed
73 74 75 76 77 78 79 80
generate-bb10-sdk: build-bb10
	cd OUTPUT && \
	zip -r liblinphone-bb10-sdk.zip liblinphone-bb10-sdk

build-ios-i386:
	mkdir -p OUTPUT/liblinphone-ios-sdk && \
	mkdir -p WORK/cmake-ios-i386 && \
	cd WORK/cmake-ios-i386 && \
81
	cmake ../.. -DCMAKE_TOOLCHAIN_FILE=toolchains/toolchain-ios-i386.cmake -DLINPHONE_BUILDER_CONFIG_FILE=configs/config-ios-i386.cmake -DCMAKE_PREFIX_PATH=../../OUTPUT/liblinphone-ios-sdk/i386 -DCMAKE_INSTALL_PREFIX=../../OUTPUT/liblinphone-ios-sdk/i386 $(filter -D%,$(MAKEFLAGS)) && \
Ghislain MARY's avatar
Ghislain MARY committed
82 83 84 85 86 87
	make -j $(NUMCPUS)

build-ios-armv7:
	mkdir -p OUTPUT/liblinphone-ios-sdk && \
	mkdir -p WORK/cmake-ios-armv7 && \
	cd WORK/cmake-ios-armv7 && \
88
	cmake ../.. -DCMAKE_TOOLCHAIN_FILE=toolchains/toolchain-ios-armv7.cmake -DLINPHONE_BUILDER_CONFIG_FILE=configs/config-ios-armv7.cmake -DCMAKE_PREFIX_PATH=../../OUTPUT/liblinphone-ios-sdk/armv7 -DCMAKE_INSTALL_PREFIX=../../OUTPUT/liblinphone-ios-sdk/armv7 $(filter -D%,$(MAKEFLAGS)) && \
Ghislain MARY's avatar
Ghislain MARY committed
89 90 91 92 93 94
	make -j $(NUMCPUS)

build-ios-armv7s:
	mkdir -p OUTPUT/liblinphone-ios-sdk && \
	mkdir -p WORK/cmake-ios-armv7s && \
	cd WORK/cmake-ios-armv7s && \
95
	cmake ../.. -DCMAKE_TOOLCHAIN_FILE=toolchains/toolchain-ios-armv7s.cmake -DLINPHONE_BUILDER_CONFIG_FILE=configs/config-ios-armv7s.cmake -DCMAKE_PREFIX_PATH=../../OUTPUT/liblinphone-ios-sdk/armv7s -DCMAKE_INSTALL_PREFIX=../../OUTPUT/liblinphone-ios-sdk/armv7s $(filter -D%,$(MAKEFLAGS)) && \
Ghislain MARY's avatar
Ghislain MARY committed
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
	make -j $(NUMCPUS)

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 && \
121
	cmake ../.. -DCMAKE_TOOLCHAIN_FILE=toolchains/toolchain-ios-i386.cmake -DLINPHONE_BUILDER_CONFIG_FILE=configs/config-ios-i386.cmake -DCMAKE_PREFIX_PATH=../../OUTPUT/liblinphone-ios-sdk/i386 -DCMAKE_INSTALL_PREFIX=../../OUTPUT/liblinphone-ios-sdk/i386 $(filter -D%,$(MAKEFLAGS)) -LH
Ghislain MARY's avatar
Ghislain MARY committed
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
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

151 152 153
veryclean:
	rm -rf WORK && \
	rm -rf OUTPUT