# Shell options
RM	?= rm
FIND	?= find

# Git options
GIT	?= git

# Rust options
CARGO	?= cargo

# Path variables
SRC_DIR	  := $(CURDIR)/src
PROTO_DIR := $(CURDIR)/myblog-proto

.DEFAULT_GOAL := build

.PHONY: clean
clean:
	$(RM) -rf $(PROTO_DIR) && \
	$(FIND) $(SRC_DIR) -type f -name '*.proto.*' -exec rm -f {} \;
	
.PHONY: build
build: clean
	$(GIT) clone https://github.com/nomkhonwaan/myblog-proto.git $(PROTO_DIR) && \
	$(CARGO) build --color=always

.PHONY: publish
publish:
	$(CARGO) publish --no-verify --allow-dirty