make Makefile work out MONERO_BUILD_ROOT

This commit is contained in:
Jethro Grassie 2019-05-11 01:53:03 -04:00
parent cee0ca90ec
commit 4b2f804354
No known key found for this signature in database
GPG key ID: DE8ED755616565BB
2 changed files with 62 additions and 13 deletions

View file

@ -1,3 +1,39 @@
define LICENSE
Copyright (c) 2014-2019, The Monero Project
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Parts of the project are originally copyright (c) 2012-2013 The Cryptonote
developers.
endef
TARGET = monero-pool TARGET = monero-pool
TYPE = debug TYPE = debug
@ -6,7 +42,14 @@ ifeq ($(MAKECMDGOALS),release)
TYPE = release TYPE = release
endif endif
MONERO_INC = ${MONERO_ROOT}/src ${MONERO_ROOT}/external/easylogging++ ${MONERO_ROOT}/contrib/epee/include MONERO_BUILD_ROOT = ${MONERO_ROOT}/build/$(shell echo `uname | \
sed -e 's|[:/\\ \(\)]|_|g'`/`\
git -C ${MONERO_ROOT} branch | grep '\* ' | cut -f2- -d' '| \
sed -e 's|[:/\\ \(\)]|_|g'`)/release
MONERO_INC = ${MONERO_ROOT}/src \
${MONERO_ROOT}/external/easylogging++ \
${MONERO_ROOT}/contrib/epee/include
MONERO_LIBS = \ MONERO_LIBS = \
${MONERO_BUILD_ROOT}/src/cryptonote_basic/libcryptonote_basic.a \ ${MONERO_BUILD_ROOT}/src/cryptonote_basic/libcryptonote_basic.a \
@ -56,9 +99,11 @@ LDPARAM += $(LDFLAGS)
LIBS := lmdb pthread microhttpd unbound LIBS := lmdb pthread microhttpd unbound
ifeq ($(OS), Darwin) ifeq ($(OS), Darwin)
LIBS += c++ boost_system-mt boost_date_time-mt boost_chrono-mt boost_filesystem-mt boost_thread-mt boost_regex-mt LIBS += c++ boost_system-mt boost_date_time-mt boost_chrono-mt \
boost_filesystem-mt boost_thread-mt boost_regex-mt
else else
LIBS += dl boost_system boost_date_time boost_chrono boost_filesystem boost_thread boost_regex uuid LIBS += dl boost_system boost_date_time boost_chrono boost_filesystem \
boost_thread boost_regex uuid
endif endif
PKG_LIBS := $(shell pkg-config \ PKG_LIBS := $(shell pkg-config \
@ -105,14 +150,21 @@ SDFILES := $(addprefix $(STORE)/,$(CSOURCE:.S=.d))
$(TARGET): preflight dirs $(OBJECTS) $(COBJECTS) $(SOBJECTS) $(HTMLOBJECTS) $(TARGET): preflight dirs $(OBJECTS) $(COBJECTS) $(SOBJECTS) $(HTMLOBJECTS)
@echo Linking $(OBJECTS)... @echo Linking $(OBJECTS)...
$(C++) -o $(STORE)/$(TARGET) $(OBJECTS) $(COBJECTS) $(SOBJECTS) $(HTMLOBJECTS) $(LDPARAM) $(MONERO_LIBS) $(foreach LIBRARY, $(LIBS),-l$(LIBRARY)) $(foreach LIB,$(LIBPATH),-L$(LIB)) $(PKG_LIBS) $(STATIC_LIBS) $(C++) -o $(STORE)/$(TARGET) $(OBJECTS) $(COBJECTS) $(SOBJECTS) $(HTMLOBJECTS) \
$(LDPARAM) $(MONERO_LIBS) \
$(foreach LIBRARY, $(LIBS),-l$(LIBRARY)) \
$(foreach LIB,$(LIBPATH),-L$(LIB)) \
$(PKG_LIBS) $(STATIC_LIBS)
@cp pool.conf $(STORE)/ @cp pool.conf $(STORE)/
@cp tools/* $(STORE)/ @cp tools/* $(STORE)/
$(STORE)/%.o: %.cpp $(STORE)/%.o: %.cpp
@echo Creating object file for $*... @echo Creating object file for $*...
$(C++) -Wp,-MMD,$(STORE)/$*.dd $(CCPARAM) $(CXXFLAGS) $(foreach INC,$(INCPATH),-I$(INC)) $(PKG_INC)\ $(C++) -Wp,-MMD,$(STORE)/$*.dd $(CCPARAM) $(CXXFLAGS) \
$(foreach CPPDEF,$(CPPDEFS),-D$(CPPDEF)) -c $< -o $@ $(foreach INC,$(INCPATH),-I$(INC)) \
$(PKG_INC) \
$(foreach CPPDEF,$(CPPDEFS),-D$(CPPDEF)) \
-c $< -o $@
@sed -e '1s/^\(.*\)$$/$(subst /,\/,$(dir $@))\1/' $(STORE)/$*.dd > $(STORE)/$*.d @sed -e '1s/^\(.*\)$$/$(subst /,\/,$(dir $@))\1/' $(STORE)/$*.dd > $(STORE)/$*.d
@rm -f $(STORE)/$*.dd @rm -f $(STORE)/$*.dd
@ -149,15 +201,13 @@ clean:
dirs: dirs:
@-if [ ! -e $(STORE) ]; then mkdir -p $(STORE); fi; @-if [ ! -e $(STORE) ]; then mkdir -p $(STORE); fi;
@-$(foreach DIR,$(DIRS), if [ ! -e $(STORE)/$(DIR) ]; then mkdir -p $(STORE)/$(DIR); fi; ) @-$(foreach DIR,$(DIRS), \
if [ ! -e $(STORE)/$(DIR) ]; then mkdir -p $(STORE)/$(DIR); fi; )
preflight: preflight:
ifeq ($(origin MONERO_ROOT), undefined) ifeq ($(origin MONERO_ROOT), undefined)
$(error You need to set an environment variable MONERO_ROOT to your monero repository root) $(error You need to set an environment variable MONERO_ROOT to your monero repository root)
endif endif
ifeq ($(origin MONERO_BUILD_ROOT), undefined)
$(error You need to set an environment variable MONERO_BUILD_ROOT to your monero build root)
endif
ifndef PKG_LIBS ifndef PKG_LIBS
$(error Missing dependencies) $(error Missing dependencies)
endif endif

View file

@ -34,14 +34,13 @@ shout on IRC: jtgrassie on Freenode.
The build system now requires the Monero source tree to be cloned and compiled. The build system now requires the Monero source tree to be cloned and compiled.
Follow the Follow the
[instructions](https://github.com/monero-project/monero#compiling-monero-from-source) [instructions](https://github.com/monero-project/monero#compiling-monero-from-source)
for compiling Monero, then export the following variables: for compiling Monero, then export the following variable:
```bash ```bash
export MONERO_ROOT=/path/to/cloned/monero export MONERO_ROOT=/path/to/cloned/monero
export MONERO_BUILD_ROOT=$MONERO_ROOT/build/<system>/<branch>/<release|debug>
``` ```
Replacing the values appropriately. Replacing the path appropriately.
Beyond the Monero dependencies, the following extra libraries are also required Beyond the Monero dependencies, the following extra libraries are also required
to build the pool: to build the pool: