.DEFAULT_GOAL=help .PHONY: clear linux win darwin release image image-push up down help BINARY_NAME := iptvc IMAGE_TAG ?= latest GOARCH ?= amd64 GOOS ?= linux ## clear = Remove all compiled binaries clear: @go clear @rm -rf bin/ ## linux = Build new binaries for linux linux: @rm -rf bin/linux_$(GOARCH) @GOARCH=$(GOARCH) GOOS=linux go build -o bin/linux_$(GOARCH)/$(BINARY_NAME) . @zip -j bin/linux_$(GOARCH).zip bin/linux_$(GOARCH)/$(BINARY_NAME) @echo "Compiled: bin/linux_$(GOARCH)/$(BINARY_NAME) ($(GOARCH))" ## win = Build new binaries for windows win: @rm -rf bin/windows_$(GOARCH) @GOARCH=$(GOARCH) GOOS=windows go build -o bin/windows_$(GOARCH)/$(BINARY_NAME).exe . @zip -j bin/windows_$(GOARCH).zip bin/windows_$(GOARCH)/$(BINARY_NAME).exe @echo "Compiled: bin/windows_$(GOARCH)/$(BINARY_NAME).exe ($(GOARCH))" ## darwin = Build new binaries for darwin darwin: @rm -rf bin/darwin_$(GOARCH) @GOARCH=$(GOARCH) GOOS=darwin go build -o bin/darwin_$(GOARCH)/$(BINARY_NAME) . @zip -j bin/darwin_$(GOARCH).zip bin/darwin_$(GOARCH)/$(BINARY_NAME) @echo "Compiled: bin/darwin_$(GOARCH)/$(BINARY_NAME) ($(GOARCH))" ## release = Build all binaries and zip them release: clear @make linux GOARCH=amd64 @make linux GOARCH=arm64 @make win GOARCH=amd64 @make win GOARCH=arm64 @make darwin GOARCH=amd64 @make darwin GOARCH=arm64 ## image = Build and push the Docker image image: @GOOS=$(GOOS) GOARCH=$(GOARCH) ./build-docker-image.sh $(IMAGE_TAG) ## image-push = Alias for image image-push: image ## up = Build and start the Docker Compose environment up: @docker compose up -d --build ## down = Stop the Docker Compose environment down: @docker compose down ## help = Show this message and exit help: Makefile @echo "Available recipes:" @sed -n 's/^##/ /p' $< | column -t -s '='