Fix Makefile to allow build both on winnt and linux/unix

This commit is contained in:
eleksir
2023-09-02 14:35:22 +03:00
parent 7f609ffb97
commit 716fc59700

View File

@@ -1,18 +1,26 @@
#!/usr/bin/env gmake -f #!/usr/bin/env gmake -f
CGO_ENABLED=0
BUILDOPTS=-ldflags="-s -w" -a -gcflags=all=-l -trimpath -pgo=auto BUILDOPTS=-ldflags="-s -w" -a -gcflags=all=-l -trimpath -pgo=auto
all: clean build all: clean build
build: build:
ifeq ($(OS),Windows_NT)
CGO_ENABLED=0
go build ${BUILDOPTS} -o "buny-jabber-bot" collection.go types.go globals.go lib.go event_parser.go buny.go main.go go build ${BUILDOPTS} -o "buny-jabber-bot" collection.go types.go globals.go lib.go event_parser.go buny.go main.go
else
CGO_ENABLED=0 go build ${BUILDOPTS} -o "buny-jabber-bot" collection.go types.go globals.go lib.go event_parser.go buny.go main.go
endif
clean: clean:
go clean go clean
upgrade: upgrade:
ifeq ($(OS),Windows_NT)
rmdir vendor /s /q
else
rm -rf vendor rm -rf vendor
endif
go get -d -u -t ./... go get -d -u -t ./...
go mod tidy go mod tidy
go mod vendor go mod vendor