# main StreamGoose build flow

SRC = src
DIST = out
CROSSPREFIX=x86_64-w64-mingw32
CROSSCC = $(CROSSPREFIX)-gcc
CROSSCXX = $(CROSSPREFIX)-g++
GOBIN ?= go

.PHONY: all test clean

all:
	$(MAKE) -C $(SRC) GOBIN=$(GOBIN) unix
	$(MAKE) dist

headless:
	$(MAKE) -C $(SRC) GOBIN=$(GOBIN) unix-headless
	$(MAKE) dist

win64:
	$(MAKE) -C $(SRC) GOBIN=$(GOBIN) win64
	$(MAKE) dist

win64-cross:
	$(MAKE) -C $(SRC) GOBIN=$(GOBIN) CGO_ENABLED=1 CC=$(CROSSCC) CXX=$(CROSSCXX) win64
	$(MAKE) dist

win64-headless:
	$(MAKE) -C $(SRC) GOBIN=$(GOBIN) win64-headless
	$(MAKE) dist

dist:
	mkdir -p $(DIST)
	mv $(SRC)/streamgoose* $(DIST)/
	cp -r webroot $(DIST)/
	cp -r auth $(DIST)/
	cp -r external $(DIST)/
	cp config.json $(DIST)/

clean:
	rm -rf $(DIST)

