build: add and use C_STANDARD in depends

This commit is contained in:
fanquake 2021-08-31 13:34:43 +08:00
parent 8035b5c80d
commit 7e7b3e42fa
No known key found for this signature in database
GPG key ID: 2EEB9F5CC09526C1
10 changed files with 24 additions and 16 deletions

View file

@ -45,6 +45,8 @@ MULTIPROCESS ?=
LTO ?=
FALLBACK_DOWNLOAD_PATH ?= https://bitcoincore.org/depends-sources
C_STANDARD ?= c11
BUILD = $(shell ./config.guess)
HOST ?= $(BUILD)
PATCHES_PATH = $(BASEDIR)/patches

View file

@ -96,6 +96,7 @@ The following can be set when running make: `make FOO=bar`
- `BASE_CACHE`: Built packages will be placed here
- `SDK_PATH`: Path where SDKs can be found (used by macOS)
- `FALLBACK_DOWNLOAD_PATH`: If a source file can't be fetched, try here before giving up
- `C_STANDARD`: Set the C standard version used. Defaults to `c11`.
- `NO_QT`: Don't download/build/cache Qt and its dependencies
- `NO_QR`: Don't download/build/cache packages needed for enabling qrencode
- `NO_ZMQ`: Don't download/build/cache packages needed for enabling ZeroMQ

View file

@ -6,6 +6,8 @@ android_CXX=$(ANDROID_TOOLCHAIN_BIN)/$(HOST)$(ANDROID_API_LEVEL)-clang++
android_CC=$(ANDROID_TOOLCHAIN_BIN)/$(HOST)$(ANDROID_API_LEVEL)-clang
endif
android_CFLAGS=-std=$(C_STANDARD)
ifneq ($(LTO),)
android_CFLAGS += -flto
android_LDFLAGS += -flto

View file

@ -109,15 +109,15 @@ darwin_CXX=env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH \
-Xclang -internal-externc-isystem$(clang_resource_dir)/include \
-Xclang -internal-externc-isystem$(OSX_SDK)/usr/include
darwin_CFLAGS=-pipe
darwin_CFLAGS=-pipe -std=$(C_STANDARD)
darwin_CXXFLAGS=-pipe
ifneq ($(LTO),)
darwin_CFLAGS += -flto
darwin_CXXFLAGS += -flto
darwin_LDFLAGS += -flto
endif
darwin_CXXFLAGS=$(darwin_CFLAGS)
darwin_release_CFLAGS=-O2
darwin_release_CXXFLAGS=$(darwin_release_CFLAGS)

View file

@ -1,12 +1,12 @@
freebsd_CFLAGS=-pipe
freebsd_CFLAGS=-pipe -std=$(C_STANDARD)
freebsd_CXXFLAGS=-pipe
ifneq ($(LTO),)
freebsd_CFLAGS += -flto
freebsd_CXXFLAGS += -flto
freebsd_LDFLAGS += -flto
endif
freebsd_CXXFLAGS=$(freebsd_CFLAGS)
freebsd_release_CFLAGS=-O2
freebsd_release_CXXFLAGS=$(freebsd_release_CFLAGS)

View file

@ -1,12 +1,12 @@
linux_CFLAGS=-pipe
linux_CFLAGS=-pipe -std=$(C_STANDARD)
linux_CXXFLAGS=-pipe
ifneq ($(LTO),)
linux_CFLAGS += -flto
linux_CXXFLAGS += -flto
linux_LDFLAGS += -flto
endif
linux_CXXFLAGS=$(linux_CFLAGS)
linux_release_CFLAGS=-O2
linux_release_CXXFLAGS=$(linux_release_CFLAGS)

View file

@ -2,15 +2,15 @@ ifneq ($(shell $(SHELL) $(.SHELLFLAGS) "command -v $(host)-g++-posix"),)
mingw32_CXX := $(host)-g++-posix
endif
mingw32_CFLAGS=-pipe
mingw32_CFLAGS=-pipe -std=$(C_STANDARD)
mingw32_CXXFLAGS=-pipe
ifneq ($(LTO),)
mingw32_CFLAGS += -flto
mingw32_CXXFLAGS += -flto
mingw32_LDFLAGS += -flto
endif
mingw32_CXXFLAGS=$(mingw32_CFLAGS)
mingw32_release_CFLAGS=-O2
mingw32_release_CXXFLAGS=$(mingw32_release_CFLAGS)

View file

@ -1,7 +1,9 @@
netbsd_CFLAGS=-pipe
netbsd_CFLAGS=-pipe -std=$(C_STANDARD)
netbsd_CXXFLAGS=-pipe
ifneq ($(LTO),)
netbsd_CFLAGS += -flto
netbsd_CXXFLAGS += -flto
netbsd_LDFLAGS += -flto
endif

View file

@ -1,8 +1,9 @@
openbsd_CFLAGS=-pipe
openbsd_CXXFLAGS=$(openbsd_CFLAGS)
openbsd_CFLAGS=-pipe -std=$(C_STANDARD)
openbsd_CXXFLAGS=-pipe
ifneq ($(LTO),)
openbsd_CFLAGS += -flto
openbsd_CXXFLAGS += -flto
openbsd_LDFLAGS += -flto
endif

View file

@ -15,7 +15,7 @@ QMAKE_MAC_SDK.macosx.SDKVersion = $${MAC_SDK_VERSION}
QMAKE_MAC_SDK.macosx.PlatformPath = /phony
!host_build: QMAKE_CFLAGS += -target $${MAC_TARGET}
!host_build: QMAKE_OBJECTIVE_CFLAGS += $$QMAKE_CFLAGS
!host_build: QMAKE_CXXFLAGS += $$QMAKE_CFLAGS
!host_build: QMAKE_CXXFLAGS += -target $${MAC_TARGET}
!host_build: QMAKE_LFLAGS += -target $${MAC_TARGET}
QMAKE_AR = $${CROSS_COMPILE}ar cq
QMAKE_RANLIB=$${CROSS_COMPILE}ranlib