github.com/opencontainers/runc@v1.2.0-rc.1.0.20240520010911-492dc558cdd6/cc_platform.mk (about) 1 # NOTE: Make sure you keep this file in sync with scripts/lib.sh. 2 3 GO ?= go 4 GOARCH ?= $(shell $(GO) env GOARCH) 5 6 ifneq ($(shell grep -i "ID_LIKE=.*suse" /etc/os-release),) 7 # openSUSE has a custom PLATFORM 8 PLATFORM ?= suse-linux 9 IS_SUSE := 1 10 else 11 PLATFORM ?= linux-gnu 12 endif 13 14 ifeq ($(GOARCH),$(shell GOARCH= $(GO) env GOARCH)) 15 # use the native CC and STRIP 16 HOST := 17 else ifeq ($(GOARCH),386) 18 # Always use the 64-bit compiler to build the 386 binary, which works for 19 # the more common cross-build method for x86 (namely, the equivalent of 20 # dpkg --add-architecture). 21 ifdef IS_SUSE 22 # There is no x86_64-suse-linux-gcc, so use the native one. 23 HOST := 24 CPU_TYPE := i586 25 else 26 HOST := x86_64-$(PLATFORM)- 27 CPU_TYPE := i686 28 endif 29 CFLAGS := -m32 -march=$(CPU_TYPE) $(CFLAGS) 30 else ifeq ($(GOARCH),amd64) 31 ifdef IS_SUSE 32 # There is no x86_64-suse-linux-gcc, so use the native one. 33 HOST := 34 else 35 HOST := x86_64-$(PLATFORM)- 36 endif 37 else ifeq ($(GOARCH),arm64) 38 HOST := aarch64-$(PLATFORM)- 39 else ifeq ($(GOARCH),arm) 40 # HOST already configured by release_build.sh in this case. 41 else ifeq ($(GOARCH),armel) 42 HOST := arm-$(PLATFORM)eabi- 43 else ifeq ($(GOARCH),armhf) 44 HOST := arm-$(PLATFORM)eabihf- 45 else ifeq ($(GOARCH),ppc64le) 46 HOST := powerpc64le-$(PLATFORM)- 47 else ifeq ($(GOARCH),riscv64) 48 HOST := riscv64-$(PLATFORM)- 49 else ifeq ($(GOARCH),s390x) 50 HOST := s390x-$(PLATFORM)- 51 else 52 $(error Unsupported GOARCH $(GOARCH)) 53 endif 54 55 ifeq ($(origin CC),$(filter $(origin CC),undefined default)) 56 # Override CC if it's undefined or just the default value set by Make. 57 CC := $(HOST)gcc 58 export CC 59 endif 60 STRIP ?= $(HOST)strip 61 export STRIP