-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
executable file
·152 lines (123 loc) · 5.07 KB
/
Makefile
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
# Copyright (c) 2017 Perlover
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
# Makefile for CentOS to compile full bitcoin core node for UASF
# This make does many things under user local folder ( NOT root! ;-) ):
# Compiling and installing from fresh sources (actual at 2017-06-06):
# - autotools
# - pkg-config
# - libevent
# - openssl
# - automake
# - m4
# - gcc
# - bitcoin core
# To run from /home/bitcoin/bitcoin-core-makefile for example
# --login is important here. It forces read ~/.bash_profile file before each execution of make command in rules
SHELL := /bin/bash --login
# The option --no-check-certificate needs because old systems doesn't check correct some certificates (Let's Encrypt for example)
# In anyway we check md5 / sha256 sums
WGET := wget --no-check-certificate
# The base directory of all packages. It's home directory now but in a future it can be used for common directory in OS, for example /opt/
BASE_INSTALL_DIR := $(HOME)
# Here will be some password files and etc. for authorization of services
CREDENTIALS_DIR := $(HOME)/credentials
# This hash will be used when defining the network configuration (as cache ID)
HASH_NETWORK_CONFIG := $(shell echo `uname -a` `/sbin/ifconfig | grep 'inet '|sed -r -e 's/[^0-9]+([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+).*/\1/'|grep -vE '^127\.'`|md5sum|awk '{print $$1}')
# commit/tag of LND for installation - the current master branch (the lnd v0.18.3-beta)
LND_ACTUAL_COMMIT := d72a3aaf261e278fa4aad5be4453df2f74ab50ee
# Should be updated in PATH of golang_envs.sh too!
GOLANG_VER := 1.22.3
# Go now is $(GOLANG_VER) (to see file mk/golang.mk)
CURRENT_GOLANG_TARGET := $(BASE_INSTALL_DIR)/go$(GOLANG_VER)/bin/go
# This is macro for version compareof software (for example gnu, python, pkg-config)
# $(eval $(call COMPARE_VERSIONS,command_for_version,required_version,result_variable_name))
# Example: $(eval $(call COMPARE_VERSIONS,gcc -dumpversion,5.0.0,GCC_5_0_0)) after will be 'OK' or 'FAIL'
COMPARE_VERSIONS = $(4) = $$(shell ./test_ver.sh $(1) $(2) $(3))
$(eval $(call COMPARE_VERSIONS,1,'m4 --version',1.4.17,M4_MIN))
$(eval $(call COMPARE_VERSIONS,1,'automake --version',1.15,AUTOMAKE_MIN))
$(eval $(call COMPARE_VERSIONS,1,'autoconf --version',2.69,AUTOCONF_MIN))
$(eval $(call COMPARE_VERSIONS,1,'libtoolize --version',2.4.6,LIBTOOL_MIN))
$(eval $(call COMPARE_VERSIONS,1,'pkg-config --version',0.29,PKG_CONFIG_MIN))
$(eval $(call COMPARE_VERSIONS,1,'ld --version',2.37,BINUTILS_MIN))
$(eval $(call COMPARE_VERSIONS,2,'gcc -dumpversion',11.2.0,GCC_MIN))
ifneq ($(MAKECMDGOALS),rsync)
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(MAKECMDGOALS),help)
ifneq ($(MAKECMDGOALS),help-more)
ifneq ($(MAKECMDGOALS),)
NETWORK_MK_FILE := network_$(HASH_NETWORK_CONFIG).mk
NETWORK_SHELL_FILE := network_$(HASH_NETWORK_CONFIG).sh
ifneq ($(wildcard $(NETWORK_MK_FILE)),$(NETWORK_MK_FILE))
$(shell mkdir -p $(CREDENTIALS_DIR) && ./define_all_ipaddresses.sh $(NETWORK_MK_FILE) $(NETWORK_SHELL_FILE) $(CREDENTIALS_DIR)/network-summary.txt)
endif
include $(NETWORK_MK_FILE)
endif
endif
endif
endif
endif
PROFILE_FILE := $(shell if [ -f $(HOME)/.bash_profile ]; then \
echo $(HOME)/.bash_profile; \
elif [ -f $(HOME)/.bash_login ]; then \
echo $(HOME)/.bash_login; \
else \
echo $(HOME)/.profile; \
fi )
# For aliases
BASHRC_FILE := $(HOME)/.bashrc
# MAKE_COMPILE: make or make -jN, where N = amount processors in system - 1
MAKE_COMPILE := $(MAKE) $(shell nproc=$$((`cat /proc/cpuinfo|grep processor|wc -l`-1));nproc=$$(($$nproc<=1?0:$$nproc));if [ $$nproc -le 0 ] ; then echo -n '' ; else echo "-j$$nproc" ; fi)
# For configure script: make variables for implicit rules
CONFIGURE_VARS += LDFLAGS="$(patsubst %,-L%,$(subst :, ,$(shell bash -c '. bitcoin_envs.sh; echo $$LD_LIBRARY_PATH')))"
CONFIGURE_VARS += CPPFLAGS="$(patsubst %,-isystem %,$(subst :, ,$(shell bash -c '. bitcoin_envs.sh; echo $$CPATH')))"
.PHONY: help help-more
help:
@cat Usage_Brief.txt
help-more:
@cat Usage_More.txt
bitcoind-start:
nice -n 20 bitcoind -daemon -upnp=0 -maxconnections=500 -maxmempool=100 -mempoolexpiry=24
@echo "The bitcoind started"
bitcoind-stop:
bitcoin-cli stop
@echo "The bitcoind stoped"
bitcoind-restart:
sleep 5 && $(MAKE) stop && sleep 5 && $(MAKE) start
@echo "The bitcoind restarted"
# developer target - to test version of software
test-versions:
echo $(M4_MIN)
echo $(AUTOMAKE_MIN)
echo $(AUTOCONF_MIN)
echo $(LIBTOOL_MIN)
echo $(PKG_CONFIG_MIN)
echo $(BINUTILS_MIN)
echo $(GCC_MIN)
.PHONY: start stop restart
include mk/common.mk
include mk/autotools.mk
include mk/gcc.mk
include mk/libs.mk
include mk/tor.mk
include mk/bitcoind.mk
include mk/electrumx.mk
include mk/python3.mk
include mk/python2.mk
include mk/sqlite3.mk
include mk/binutils.mk
include mk/c-lightning.mk
include mk/nodejs.mk
include mk/golang.mk
include mk/lnd.mk
include mk/lncli-web.mk
include mk/iptables.mk
include mk/zeromq.mk
include mk/miniupnp.mk
include mk/i-want-lightning.mk
include mk/rsync.mk
include mk/git.mk
include mk/inotify.mk
include mk/cmake.mk
include mk/rust.mk
include mk/finally.mk