# Rust options
CARGO	?= cargo

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

.DEFAULT_GOAL := build

.PHONY: clean
clean:
	find $(SRC_DIR) -type f -name '*.proto.*' -exec rm -f {} \; && \
	rm -rf $(PROTO_DIR)/*
	
.PHONY: build
build: clean
	cp -r $(CURDIR)/../myblog-proto/proto/* $(PROTO_DIR)/ && \
	$(CARGO) build --color=always

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