export LOG_DEBUG=1
export HTTP_LISTEN=:8085
export PASTE_STORE=data/paste/
export ARTIFACT_STORE=data/artifact/
export IMAGE_STORE=data/image/

SOURCE=$(wildcard v2/*.go) $(wildcard v2/paste/*.go) $(wildcard assets/*.go)
ASSETS=$(wildcard assets/*) $(wildcard assets/public/*) $(wildcard assets/src/*) $(wildcard assets/src/paste/*) 
ASSET_FILE=assets/build/index.html
BINARY=sour.is-paste

all: $(BINARY)
clean:
	rm -rf $(BINARY)
setup:
	cd assets; npm i
fmt:
	go fmt ./...
test:
	go test ./...
	go vet ./...
run: $(BINARY)
	# go run ./v2
	./$(BINARY)

build-assets: $(ASSET_FILE)
${ASSET_FILE}: $(ASSETS)
	cd assets; \
	npm run build

build:  $(BINARY)
$(BINARY): $(SOURCE) $(ASSET_FILE)
	go build -o $(BINARY) ./v2

.PHONEY: all clean build run setup
# DO NOT DELETE