GOBIN ?= go
GOMODTIDY ?= $(GOBIN) mod tidy
LDFLAGS ?= -s -w
LDFLAGS_WIN ?= -H windowsgui -s -w
GOFLAGS ?= -trimpath
SOURCES_GUI = -tags gui
BIN = streamgoose

unix:
	$(GOMODTIDY)
	$(GOBIN) build $(GOFLAGS) -ldflags "$(LDFLAGS)" -o $(BIN) $(SOURCES_GUI)

unix-headless:
	$(GOMODTIDY)
	$(GOBIN) build $(GOFLAGS) -ldflags "$(LDFLAGS)" -o $(BIN)

win64:
	$(GOMODTIDY)
	GOOS=windows GOARCH=amd64 $(GOBIN) build $(GOFLAGS) -ldflags "$(LDFLAGS_WIN)" -o $(BIN).exe $(SOURCES_GUI)

win64-headless:
	$(GOMODTIDY)
	GOOS=windows GOARCH=amd64 $(GOBIN) build $(GOFLAGS) -ldflags "$(LDFLAGS)" -o $(BIN).exe

clean:
	rm $(BIN)
