From ab812a70765af1a2a132d99341a3be59b3f12337 Mon Sep 17 00:00:00 2001 From: Jethro Grassie Date: Sun, 24 Feb 2019 14:07:16 -0500 Subject: [PATCH] improve Makefile --- Makefile | 18 +++++++++++++++--- README.md | 4 ++-- src/pool.c | 2 +- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 7e7f429..71a1dd4 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,14 @@ TARGET = monero-pool TYPE = debug +ifeq ($(MAKECMDGOALS),release) +TYPE = release +endif + +ifeq ($(MAKECMDGOALS),profile) +TYPE = profile +endif + DIRS = src data rxi/log/src monero monero/epee/include monero/epee/src monero/common monero/crypto \ monero/cryptonote_basic monero/cryptonote_core monero/device monero/ringdt monero/easylogging++ @@ -89,13 +97,15 @@ CDFILES := $(addprefix $(STORE)/,$(CSOURCE:.c=.d)) SDFILES := $(addprefix $(STORE)/,$(CSOURCE:.S=.d)) -.PHONY: clean backup dirs +.PHONY: clean backup dirs debug release profile $(TARGET): dirs $(OBJECTS) $(COBJECTS) $(SOBJECTS) $(HTMLOBJECTS) @echo Linking $(OBJECTS)... $(C++) -o $(STORE)/$(TARGET) $(OBJECTS) $(COBJECTS) $(SOBJECTS) $(HTMLOBJECTS) $(LDPARAM) $(foreach LIBRARY, $(LIBS),-l$(LIBRARY)) $(foreach LIB,$(LIBPATH),-L$(LIB)) $(PKG_LIBS) $(STATIC_LIBS) @cp pool.conf $(STORE)/ +debug release profile: $(TARGET) + $(STORE)/%.o: %.cpp @echo Creating object file for $*... $(C++) -Wp,-MMD,$(STORE)/$*.dd $(CCPARAM) $(CXXFLAGS) $(foreach INC,$(INCPATH),-I$(INC)) $(PKG_INC)\ @@ -128,8 +138,9 @@ $(STORE)/%.o: %.html clean: @echo Making clean. - @-rm -f $(foreach DIR,$(DIRS),$(STORE)/$(DIR)/*.d $(STORE)/$(DIR)/*.o) - @-rm -f $(TARGET) + @find ./build -type f -name '*.o' -delete + @find ./build -type f -name '*.d' -delete + @find ./build -type f -name $(TARGET) -delete backup: @-if [ ! -e build/backup ]; then mkdir -p build/backup; fi; @@ -141,4 +152,5 @@ dirs: -include $(DFILES) -include $(CDFILES) +-include $(SDFILES) diff --git a/README.md b/README.md index 3ac0068..385882d 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ First install all the dependencies. Then to compile the pool as a release build, run: ``` -make TYPE=release +make release ``` The application will be built in `build/release/`. @@ -83,7 +83,7 @@ options are self explanatory. Ensure you have your daemon and wallet RPC up and running with the correct host and port settings in the pool config file. -Then simply `cd build/debug|release` and `./monero-pool`. +Then simply `cd build/debug|release` and run `./monero-pool`. ## Supporting the project diff --git a/src/pool.c b/src/pool.c index 633a154..e8f67b1 100644 --- a/src/pool.c +++ b/src/pool.c @@ -1092,7 +1092,7 @@ stratum_new_job_body(int json_id, const char *client_id, const char *job_id, { snprintf(body, CLIENT_BODY_MAX, "{\"id\":%d,\"jsonrpc\":\"2.0\",\"method\":\"job\",\"params\"" ":{\"id\":\"%.32s\",\"blob\":\"%s\",\"job_id\":\"%.32s\",\"target\":\"%.8s\"," - "\"height\":%"PRIu64"}}\n", + "\"height\":%"PRIu64"}}\n", json_id, client_id, blob, job_id, target_hex, height); } return body;