GOBIN ?= go
LDFLAGS = -s -w
LDFLAGS_WIN = -H windowsgui -s -w
GOFLAGS = -trimpath
SOURCES = server.go twitch.go youtube.go owncast.go kick.go
SOURCES_GUI = $(SOURCES) gui.go
BIN = streamgoose

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

unix-headless:
	$(GOBIN) mod tidy
	$(GOBIN) build $(GOFLAGS) -ldflags "$(LDFLAGS)" -o $(BIN) $(SOURCES)

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

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

clean:
	rm $(BIN)
