Debian Codegraph @

Makefile

raw symbols SCIP
1 # Copyright (c) 2014-2022, The Monero Project
2 #
3 # All rights reserved.
4 #
5 # Redistribution and use in source and binary forms, with or without modification, are
6 # permitted provided that the following conditions are met:
7 #
8 # 1. Redistributions of source code must retain the above copyright notice, this list of
9 # conditions and the following disclaimer.
10 #
11 # 2. Redistributions in binary form must reproduce the above copyright notice, this list
12 # of conditions and the following disclaimer in the documentation and/or other
13 # materials provided with the distribution.
14 #
15 # 3. Neither the name of the copyright holder nor the names of its contributors may be
16 # used to endorse or promote products derived from this software without specific
17 # prior written permission.
18 #
19 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
20 # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21 # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
22 # THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26 # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
27 # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
29 ANDROID_STANDALONE_TOOLCHAIN_PATH ?= /usr/local/toolchain
30
31 dotgit=$(shell ls -d .git/config)
32 ifneq ($(dotgit), .git/config)
33 USE_SINGLE_BUILDDIR=1
34 endif
35
36 subbuilddir:=$(shell echo `uname | sed -e 's|[:/\\ \(\)]|_|g'`/`git branch | grep '\* ' | cut -f2- -d' '| sed -e 's|[:/\\ \(\)]|_|g'`)
37 ifeq ($(USE_SINGLE_BUILDDIR),)
38 builddir := build/"$(subbuilddir)"
39 topdir := ../../../..
40 deldirs := $(builddir)
41 else
42 builddir := build
43 topdir := ../..
44 deldirs := $(builddir)/debug $(builddir)/release $(builddir)/fuzz
45 endif
46
47 all: release-all
48
49 depends:
50 cd contrib/depends && $(MAKE) HOST=$(target) && cd ../.. && mkdir -p build/$(target)/release
51 cd build/$(target)/release && USE_DEVICE_TREZOR_MANDATORY=1 cmake -DCMAKE_TOOLCHAIN_FILE=$(CURDIR)/contrib/depends/$(target)/share/toolchain.cmake ../../.. && $(MAKE)
52
53 cmake-debug:
54 mkdir -p $(builddir)/debug
55 cd $(builddir)/debug && cmake -D CMAKE_BUILD_TYPE=Debug $(topdir)
56
57 debug: cmake-debug
58 cd $(builddir)/debug && $(MAKE)
59
60 # Temporarily disable some tests:
61 # * libwallet_api_tests fail (Issue #895)
62 debug-test:
63 mkdir -p $(builddir)/debug
64 cd $(builddir)/debug && cmake -D BUILD_TESTS=ON -D CMAKE_BUILD_TYPE=Debug $(topdir) && $(MAKE) && $(MAKE) ARGS="-E libwallet_api_tests" test
65
66 debug-test-asan:
67 mkdir -p $(builddir)/debug
68 cd $(builddir)/debug && cmake -D BUILD_TESTS=ON -D SANITIZE=ON -D CMAKE_BUILD_TYPE=Debug $(topdir) && $(MAKE) && $(MAKE) ARGS="-E libwallet_api_tests" test
69
70 debug-test-trezor:
71 mkdir -p $(builddir)/debug
72 cd $(builddir)/debug && cmake -D BUILD_TESTS=ON -D TREZOR_DEBUG=ON -D CMAKE_BUILD_TYPE=Debug $(topdir) && $(MAKE) && $(MAKE) ARGS="-E libwallet_api_tests" test
73
74 debug-all:
75 mkdir -p $(builddir)/debug
76 cd $(builddir)/debug && cmake -D BUILD_TESTS=ON -D BUILD_SHARED_LIBS=OFF -D CMAKE_BUILD_TYPE=Debug $(topdir) && $(MAKE)
77
78 debug-static-all:
79 mkdir -p $(builddir)/debug
80 cd $(builddir)/debug && cmake -D BUILD_TESTS=ON -D STATIC=ON -D CMAKE_BUILD_TYPE=Debug $(topdir) && $(MAKE)
81
82 debug-static-win64:
83 mkdir -p $(builddir)/debug
84 cd $(builddir)/debug && cmake -G "MSYS Makefiles" -D STATIC=ON -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Debug -D BUILD_TAG="win-x64" -D CMAKE_TOOLCHAIN_FILE=$(topdir)/cmake/64-bit-toolchain.cmake -D MSYS2_FOLDER=$(shell cd ${MINGW_PREFIX}/.. && pwd -W) $(topdir) && $(MAKE)
85
86 debug-static-win32:
87 mkdir -p $(builddir)/debug
88 cd $(builddir)/debug && cmake -G "MSYS Makefiles" -D STATIC=ON -D ARCH="i686" -D BUILD_64=OFF -D CMAKE_BUILD_TYPE=Debug -D BUILD_TAG="win-x32" -D CMAKE_TOOLCHAIN_FILE=$(topdir)/cmake/32-bit-toolchain.cmake -D MSYS2_FOLDER=$(shell cd ${MINGW_PREFIX}/.. && pwd -W) $(topdir) && $(MAKE)
89
90 cmake-release:
91 mkdir -p $(builddir)/release
92 cd $(builddir)/release && cmake -D CMAKE_BUILD_TYPE=Release $(topdir)
93
94 release: cmake-release
95 cd $(builddir)/release && $(MAKE)
96
97 release-test:
98 mkdir -p $(builddir)/release
99 cd $(builddir)/release && cmake -D BUILD_TESTS=ON -D CMAKE_BUILD_TYPE=Release $(topdir) && $(MAKE) && $(MAKE) test
100
101 release-all:
102 mkdir -p $(builddir)/release
103 cd $(builddir)/release && cmake -D BUILD_TESTS=ON -D CMAKE_BUILD_TYPE=Release $(topdir) && $(MAKE)
104
105 release-static:
106 mkdir -p $(builddir)/release
107 cd $(builddir)/release && cmake -D STATIC=ON -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Release $(topdir) && $(MAKE)
108
109 coverage:
110 mkdir -p $(builddir)/debug
111 cd $(builddir)/debug && cmake -D BUILD_TESTS=ON -D CMAKE_BUILD_TYPE=Debug -D COVERAGE=ON $(topdir) && $(MAKE) && $(MAKE) test
112
113 # Targets for specific prebuilt builds which will be advertised for updates by their build tag
114
115 release-static-linux-armv6:
116 mkdir -p $(builddir)/release
117 cd $(builddir)/release && cmake -D BUILD_TESTS=OFF -D ARCH="armv6zk" -D STATIC=ON -D BUILD_64=OFF -D CMAKE_BUILD_TYPE=Release -D BUILD_TAG="linux-armv6" $(topdir) && $(MAKE)
118
119 release-static-linux-armv7:
120 mkdir -p $(builddir)/release
121 cd $(builddir)/release && cmake -D BUILD_TESTS=OFF -D ARCH="armv7-a" -D STATIC=ON -D BUILD_64=OFF -D CMAKE_BUILD_TYPE=Release -D BUILD_TAG="linux-armv7" $(topdir) && $(MAKE)
122
123 release-static-android-armv7:
124 mkdir -p $(builddir)/release/translations
125 cd $(builddir)/release/translations && cmake ../../../translations && $(MAKE)
126 cd $(builddir)/release && CC=arm-linux-androideabi-clang CXX=arm-linux-androideabi-clang++ cmake -D BUILD_TESTS=OFF -D ARCH="armv7-a" -D STATIC=ON -D BUILD_64=OFF -D CMAKE_BUILD_TYPE=Release -D ANDROID=true -D BUILD_TAG="android-armv7" -D CMAKE_SYSTEM_NAME="Android" -D CMAKE_ANDROID_STANDALONE_TOOLCHAIN="${ANDROID_STANDALONE_TOOLCHAIN_PATH}" -D CMAKE_ANDROID_ARM_MODE=ON -D CMAKE_ANDROID_ARCH_ABI="armeabi-v7a" ../.. && $(MAKE)
127
128 release-static-android-armv8:
129 mkdir -p $(builddir)/release/translations
130 cd $(builddir)/release/translations && cmake ../../../translations && $(MAKE)
131 cd $(builddir)/release && CC=aarch64-linux-android-clang CXX=aarch64-linux-android-clang++ cmake -D BUILD_TESTS=OFF -D ARCH="armv8-a" -D STATIC=ON -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Release -D ANDROID=true -D BUILD_TAG="android-armv8" -D CMAKE_SYSTEM_NAME="Android" -D CMAKE_ANDROID_STANDALONE_TOOLCHAIN="${ANDROID_STANDALONE_TOOLCHAIN_PATH}" -D CMAKE_ANDROID_ARCH_ABI="arm64-v8a" ../.. && $(MAKE)
132
133 release-static-linux-armv8:
134 mkdir -p $(builddir)/release
135 cd $(builddir)/release && cmake -D BUILD_TESTS=OFF -D ARCH="armv8-a" -D STATIC=ON -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Release -D BUILD_TAG="linux-armv8" $(topdir) && $(MAKE)
136
137 release-static-linux-x86_64:
138 mkdir -p $(builddir)/release
139 cd $(builddir)/release && cmake -D STATIC=ON -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Release -D BUILD_TAG="linux-x64" $(topdir) && $(MAKE)
140
141 release-static-freebsd-x86_64:
142 mkdir -p $(builddir)/release
143 cd $(builddir)/release && cmake -D STATIC=ON -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Release -D BUILD_TAG="freebsd-x64" $(topdir) && $(MAKE)
144
145 release-static-mac-x86_64:
146 mkdir -p $(builddir)/release
147 cd $(builddir)/release && cmake -D STATIC=ON -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Release -D BUILD_TAG="mac-x64" $(topdir) && $(MAKE)
148
149 release-static-linux-i686:
150 mkdir -p $(builddir)/release
151 cd $(builddir)/release && cmake -D STATIC=ON -D ARCH="i686" -D BUILD_64=OFF -D CMAKE_BUILD_TYPE=Release -D BUILD_TAG="linux-x86" $(topdir) && $(MAKE)
152
153 release-static-win64:
154 mkdir -p $(builddir)/release
155 cd $(builddir)/release && cmake -G "MSYS Makefiles" -D STATIC=ON -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Release -D BUILD_TAG="win-x64" -D CMAKE_TOOLCHAIN_FILE=$(topdir)/cmake/64-bit-toolchain.cmake -D MSYS2_FOLDER=$(shell cd ${MINGW_PREFIX}/.. && pwd -W) $(topdir) && $(MAKE)
156
157 release-static-win32:
158 mkdir -p $(builddir)/release
159 cd $(builddir)/release && cmake -G "MSYS Makefiles" -D STATIC=ON -D ARCH="i686" -D BUILD_64=OFF -D CMAKE_BUILD_TYPE=Release -D BUILD_TAG="win-x32" -D CMAKE_TOOLCHAIN_FILE=$(topdir)/cmake/32-bit-toolchain.cmake -D MSYS2_FOLDER=$(shell cd ${MINGW_PREFIX}/.. && pwd -W) $(topdir) && $(MAKE)
160
161 fuzz:
162 mkdir -p $(builddir)/fuzz
163 cd $(builddir)/fuzz && cmake -D STATIC=ON -D SANITIZE=ON -D BUILD_TESTS=ON -D USE_LTO=OFF -D CMAKE_C_COMPILER=afl-gcc -D CMAKE_CXX_COMPILER=afl-g++ -D ARCH="x86-64" -D CMAKE_BUILD_TYPE=fuzz -D BUILD_TAG="linux-x64" $(topdir) && $(MAKE)
164
165 clean:
166 @echo "WARNING: Back-up your wallet if it exists within ./"$(deldirs)"!" ; \
167 read -r -p "This will destroy the build directory, continue (y/N)?: " CONTINUE; \
168 [ $$CONTINUE = "y" ] || [ $$CONTINUE = "Y" ] || (echo "Exiting."; exit 1;)
169 rm -rf $(deldirs)
170
171 clean-all:
172 @echo "WARNING: Back-up your wallet if it exists within ./build!" ; \
173 read -r -p "This will destroy all build directories, continue (y/N)?: " CONTINUE; \
174 [ $$CONTINUE = "y" ] || [ $$CONTINUE = "Y" ] || (echo "Exiting."; exit 1;)
175 rm -rf ./build
176
177 tags:
178 ctags -R --sort=1 --c++-kinds=+p --fields=+iaS --extra=+q --language-force=C++ src contrib tests/gtest
179
180 .PHONY: all cmake-debug debug debug-test debug-all cmake-release release release-test release-all clean tags