chore: abuse spaces for cgo_enabled.mk

This commit is contained in:
mzz2017
2024-06-25 02:24:11 +08:00
parent 201dd45ad7
commit 1a6ea54425

View File

@ -4,29 +4,29 @@
#
ifneq ($(KEEP_CGO_ENVS),1)
ifdef CGO_ENABLED_NDEF
export CGO_ENABLED := 0
endif
ifeq ($(CGO_ENABLED),0)
ifdef GOARCH_NDEF
ifeq ($(CC),cc)
ifneq ($(shell which musl-gcc),)
export CC := musl-gcc
else ifneq ($(shell which zig),)
export CC := zig cc -target $(shell . install/musl-targets.sh && echo $$GOARCH_$(GOARCH))
else
$(info ! CGO_ENABLED=0 is not recommended. Please consider to install musl-gcc for static link instead. See https://github.com/daeuniverse/dae/issues/557)
endif
endif
else ifneq ($(shell which zig),)
export CC := zig cc -target $(shell . install/musl-targets.sh && echo $$GOARCH_$(GOARCH))
else
$(info ! CGO_ENABLED=0 is not recommended. See https://github.com/daeuniverse/dae/issues/557)
endif
endif
ifneq ($(CC),cc)
export CGO_ENABLED := 1
GO_LDFLAGS += -linkmode external -extldflags=-static
$(info * Building dae with "$(CC)" static linking instead of CGO_ENABLED=0. See https://github.com/daeuniverse/dae/issues/557)
endif
ifdef CGO_ENABLED_NDEF
export CGO_ENABLED := 0
endif
ifeq ($(CGO_ENABLED),0)
ifdef GOARCH_NDEF
ifeq ($(CC),cc)
ifneq ($(shell which musl-gcc),)
export CC := musl-gcc
else ifneq ($(shell which zig),)
export CC := zig cc -target $(shell . install/musl-targets.sh && echo $$GOARCH_$(GOARCH))
else
$(info ! CGO_ENABLED=0 is not recommended. Please consider to install musl-gcc for static link instead. See https://github.com/daeuniverse/dae/issues/557)
endif
endif
else ifneq ($(shell which zig),)
export CC := zig cc -target $(shell . install/musl-targets.sh && echo $$GOARCH_$(GOARCH))
else
$(info ! CGO_ENABLED=0 is not recommended. See https://github.com/daeuniverse/dae/issues/557)
endif
endif
ifneq ($(CC),cc)
export CGO_ENABLED := 1
GO_LDFLAGS += -linkmode external -extldflags=-static
$(info * Building dae with "$(CC)" static linking instead of CGO_ENABLED=0. See https://github.com/daeuniverse/dae/issues/557)
endif
endif