improve Makefile

This commit is contained in:
Jethro Grassie 2019-02-24 14:07:16 -05:00
parent 3c76d658c7
commit ab812a7076
No known key found for this signature in database
GPG Key ID: DE8ED755616565BB
3 changed files with 18 additions and 6 deletions

View File

@ -2,6 +2,14 @@ TARGET = monero-pool
TYPE = debug 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 \ 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++ 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)) SDFILES := $(addprefix $(STORE)/,$(CSOURCE:.S=.d))
.PHONY: clean backup dirs .PHONY: clean backup dirs debug release profile
$(TARGET): dirs $(OBJECTS) $(COBJECTS) $(SOBJECTS) $(HTMLOBJECTS) $(TARGET): dirs $(OBJECTS) $(COBJECTS) $(SOBJECTS) $(HTMLOBJECTS)
@echo Linking $(OBJECTS)... @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) $(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)/ @cp pool.conf $(STORE)/
debug release profile: $(TARGET)
$(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 INC,$(INCPATH),-I$(INC)) $(PKG_INC)\
@ -128,8 +138,9 @@ $(STORE)/%.o: %.html
clean: clean:
@echo Making clean. @echo Making clean.
@-rm -f $(foreach DIR,$(DIRS),$(STORE)/$(DIR)/*.d $(STORE)/$(DIR)/*.o) @find ./build -type f -name '*.o' -delete
@-rm -f $(TARGET) @find ./build -type f -name '*.d' -delete
@find ./build -type f -name $(TARGET) -delete
backup: backup:
@-if [ ! -e build/backup ]; then mkdir -p build/backup; fi; @-if [ ! -e build/backup ]; then mkdir -p build/backup; fi;
@ -141,4 +152,5 @@ dirs:
-include $(DFILES) -include $(DFILES)
-include $(CDFILES) -include $(CDFILES)
-include $(SDFILES)

View File

@ -58,7 +58,7 @@ First install all the dependencies.
Then to compile the pool as a release build, run: Then to compile the pool as a release build, run:
``` ```
make TYPE=release make release
``` ```
The application will be built in `build/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 Ensure you have your daemon and wallet RPC up and running with the correct host
and port settings in the pool config file. 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 ## Supporting the project