506115d1f38ad674fe1e8f73b0a5ad0293865886
[fltk_mvc_template.git] / _template / packages / googletest / Makefile
1 ############################################################################
2 # Workfile: Makefile
3 # Author: Daniel Giritzer, S1810567004 (daniel@giritzer.eu)
4 # Date: 03.12.2018
5 # Description: Universal Makefile for Unix based Operating Systems
6 ############################################################################
7 WORKDIR = $(shell pwd)
8
9 # Add android ndk toolchain
10 ANDROID_NDK_HOME=/usr/lib/android-ndk
11 export PATH := $(ANDROID_NDK_HOME)/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/:$(PATH)
12
13 all: unpack windows linux32 linux_arm
14
15 .PHONY: unpack
16 unpack:
17         unzip -o googletest-release-1.8.1.zip
18
19 .PHONY: windows
20 windows:
21         cd $(WORKDIR)/googletest-release-1.8.1; \
22         make clean; \
23         autoreconf -vfi; \
24         ./configure CFLAGS="-m32 -mwindows" CXXFLAGS="-m32 -mwindows" LDFLAGS="-m32 -static-libgcc -static-libstdc++" --host=i686-w64-mingw32 --disable-pthreads --with-pthreads=no; \
25         make -j4
26         mkdir -p $(WORKDIR)/../../include
27         mkdir -p $(WORKDIR)/../../lib/mingw32
28         cp -rf $(WORKDIR)/googletest-release-1.8.1/googletest/include/gtest $(WORKDIR)/../../include
29         cp -rf $(WORKDIR)/googletest-release-1.8.1/googlemock/include/gmock $(WORKDIR)/../../include
30         cp $(WORKDIR)/googletest-release-1.8.1/googletest/lib/.libs/libgtest.a $(WORKDIR)/../../lib/mingw32
31         cp $(WORKDIR)/googletest-release-1.8.1/googlemock/lib/.libs/libgmock.a $(WORKDIR)/../../lib/mingw32
32
33 .PHONY: linux32
34 linux32:
35         cd $(WORKDIR)/googletest-release-1.8.1; \
36         make clean; \
37         autoreconf -vfi; \
38         ./configure CFLAGS="-m32" CXXFLAGS="-m32" LDFLAGS="-m32 -static-libgcc -static-libstdc++"; \
39         make -j4
40         mkdir -p $(WORKDIR)/../../include
41         mkdir -p $(WORKDIR)/../../lib/linux32
42         cp -rf $(WORKDIR)/googletest-release-1.8.1/googletest/include/gtest $(WORKDIR)/../../include
43         cp -rf $(WORKDIR)/googletest-release-1.8.1/googlemock/include/gmock $(WORKDIR)/../../include
44         cp $(WORKDIR)/googletest-release-1.8.1/googletest/lib/.libs/libgtest.a $(WORKDIR)/../../lib/linux32
45         cp $(WORKDIR)/googletest-release-1.8.1/googlemock/lib/.libs/libgmock.a $(WORKDIR)/../../lib/linux32
46
47 .PHONY: linux_arm
48 linux_arm:
49         cd $(WORKDIR)/googletest-release-1.8.1; \
50         make clean; \
51         autoreconf -vfi; \
52         ./configure CFLAGS="" CXXFLAGS="" LDFLAGS="-static-libgcc -static-libstdc++" --host=arm-linux-gnueabihf; \
53         make -j4
54         mkdir -p $(WORKDIR)/../../include
55         mkdir -p $(WORKDIR)/../../lib/linux_arm
56         cp -rf $(WORKDIR)/googletest-release-1.8.1/googletest/include/gtest $(WORKDIR)/../../include
57         cp -rf $(WORKDIR)/googletest-release-1.8.1/googlemock/include/gmock $(WORKDIR)/../../include
58         cp $(WORKDIR)/googletest-release-1.8.1/googletest/lib/.libs/libgtest.a $(WORKDIR)/../../lib/linux_arm
59         cp $(WORKDIR)/googletest-release-1.8.1/googlemock/lib/.libs/libgmock.a $(WORKDIR)/../../lib/linux_arm
60
61 ## not working...
62 .PHONY: android_arm
63 android_arm:
64         cd $(WORKDIR)/googletest-release-1.8.1; \
65         make clean; \
66         autoreconf -vfi; \
67         ./configure --host=arm-linux-androideabi CFLAGS="--sysroot=$(ANDROID_NDK_HOME)/platforms/android-23/arch-arm -I$(ANDROID_NDK_HOME)/sources/cxx-stl/llvm-libc++/libcxx/include -I$(ANDROID_NDK_HOME)/sources/android/support/include -I$(ANDROID_NDK_HOME)/sources/cxx-stl/llvm-libc++abi/libcxxabi/include" LDFLAGS="--sysroot=$(ANDROID_NDK_HOME)/platforms/android-23/arch-arm -static-libgcc -static-libstdc++"; \
68         make -j4
69         mkdir -p $(WORKDIR)/../../include
70         mkdir -p $(WORKDIR)/../../lib/android_arm
71         cp -rf $(WORKDIR)/googletest-release-1.8.1/googletest/include/gtest $(WORKDIR)/../../include
72         cp -rf $(WORKDIR)/googletest-release-1.8.1/googlemock/include/gmock $(WORKDIR)/../../include
73         cp $(WORKDIR)/googletest-release-1.8.1/googletest/lib/.libs/libgtest.a $(WORKDIR)/../../lib/android_arm
74         cp $(WORKDIR)/googletest-release-1.8.1/googlemock/lib/.libs/libgmock.a $(WORKDIR)/../../lib/android_arm
75
76
77 .PHONY: clean
78 clean:
79         rm -rf $(WORKDIR)/googletest-release-1.8.1
80