REMOVEME: add OS and OS_ARCH variable

This commit is contained in:
Francisco Molina 2019-10-18 08:23:02 +02:00
parent de2ba4ff1a
commit f3482de277
4 changed files with 29 additions and 14 deletions

View File

@ -6,8 +6,9 @@ ifneq (,$(filter mtd,$(USEMODULE)))
USEMODULE += mtd_native USEMODULE += mtd_native
endif endif
OS := $(shell uname -s)
ifneq (,$(filter can,$(USEMODULE))) ifneq (,$(filter can,$(USEMODULE)))
ifeq ($(shell uname -s),Linux) ifeq ($(OS),Linux)
USEMODULE += can_linux USEMODULE += can_linux
CFLAGS += -DCAN_DLL_NUMOF=2 CFLAGS += -DCAN_DLL_NUMOF=2
endif endif

View File

@ -5,7 +5,9 @@ export NATIVEINCLUDES += -I$(RIOTBASE)/drivers/include/
USEMODULE += native-drivers USEMODULE += native-drivers
ifeq ($(shell uname -s),Darwin) OS := $(shell uname -s)
ifeq ($(OS),Darwin)
DEBUGGER ?= lldb DEBUGGER ?= lldb
else else
DEBUGGER ?= gdb DEBUGGER ?= gdb
@ -27,18 +29,22 @@ ifeq (,$(filter -std=%, $(CFLAGS)))
CFLAGS += -std=gnu99 CFLAGS += -std=gnu99
endif endif
ifeq ($(shell uname -m),x86_64) OS_ARCH := $(shell uname -m)
ifeq ($(OS_ARCH),x86_64)
CFLAGS += -m32 CFLAGS += -m32
endif endif
ifneq (,$(filter -DDEVELHELP,$(CFLAGS))) ifneq (,$(filter -DDEVELHELP,$(CFLAGS)))
CFLAGS += -fstack-protector-all CFLAGS += -fstack-protector-all
endif endif
ifeq ($(shell uname -s),FreeBSD) OS := $(shell uname -s)
ifeq ($(shell uname -m),amd64) ifeq ($(OS),FreeBSD)
OS_ARCH := $(shell uname -m)
ifeq ($(OS_ARCH),amd64)
CFLAGS += -m32 -DCOMPAT_32BIT -B/usr/lib32 CFLAGS += -m32 -DCOMPAT_32BIT -B/usr/lib32
endif endif
endif endif
ifeq ($(shell uname -s),Darwin) OS := $(shell uname -s)
ifeq ($(OS),Darwin)
CFLAGS += -Wno-deprecated-declarations CFLAGS += -Wno-deprecated-declarations
endif endif
@ -46,11 +52,14 @@ endif
CXXUWFLAGS += CXXUWFLAGS +=
CXXEXFLAGS += CXXEXFLAGS +=
ifeq ($(shell uname -m),x86_64) OS_ARCH := $(shell uname -m)
ifeq ($(OS_ARCH),x86_64)
export LINKFLAGS += -m32 export LINKFLAGS += -m32
endif endif
ifeq ($(shell uname -s),FreeBSD) OS := $(shell uname -s)
ifeq ($(shell uname -m),amd64) ifeq ($(OS),FreeBSD)
OS_ARCH := $(shell uname -m)
ifeq ($(OS_ARCH),amd64)
export LINKFLAGS += -m32 -DCOMPAT_32BIT -L/usr/lib32 -B/usr/lib32 export LINKFLAGS += -m32 -DCOMPAT_32BIT -L/usr/lib32 -B/usr/lib32
endif endif
export LINKFLAGS += -L $(BINDIR) export LINKFLAGS += -L $(BINDIR)
@ -60,7 +69,8 @@ endif
# clean up unused functions # clean up unused functions
CFLAGS += -ffunction-sections -fdata-sections CFLAGS += -ffunction-sections -fdata-sections
ifeq ($(shell uname -s),Darwin) OS := $(shell uname -m)
ifeq ($(OS),Darwin)
export LINKFLAGS += -Wl,-dead_strip export LINKFLAGS += -Wl,-dead_strip
else else
export LINKFLAGS += -Wl,--gc-sections export LINKFLAGS += -Wl,--gc-sections
@ -113,7 +123,8 @@ endif
# backward compatability with glibc <= 2.17 for native # backward compatability with glibc <= 2.17 for native
ifeq ($(CPU),native) ifeq ($(CPU),native)
ifeq ($(shell uname -s),Linux) OS := $(shell uname -s)
ifeq ($(OS),Linux)
ifeq ($(shell ldd --version | awk '/^ldd/{if ($$NF < 2.17) {print "yes"} else {print "no"} }'),yes) ifeq ($(shell ldd --version | awk '/^ldd/{if ($$NF < 2.17) {print "yes"} else {print "no"} }'),yes)
LINKFLAGS += -lrt LINKFLAGS += -lrt
endif endif
@ -123,7 +134,8 @@ endif
# clumsy way to enable building native on osx: # clumsy way to enable building native on osx:
BUILDOSXNATIVE = 0 BUILDOSXNATIVE = 0
ifeq ($(CPU),native) ifeq ($(CPU),native)
ifeq ($(shell uname -s),Darwin) OS := $(shell uname -s)
ifeq ($(OS),Darwin)
BUILDOSXNATIVE = 1 BUILDOSXNATIVE = 1
endif endif
endif endif

View File

@ -3,7 +3,8 @@ MODULE = cpu
DIRS += periph DIRS += periph
DIRS += vfs DIRS += vfs
ifeq ($(shell uname -s),Darwin) OS := $(shell uname -s)
ifeq ($(OS),Darwin)
CFLAGS += -D_XOPEN_SOURCE=600 -D_DARWIN_C_SOURCE CFLAGS += -D_XOPEN_SOURCE=600 -D_DARWIN_C_SOURCE
endif endif

View File

@ -16,6 +16,7 @@ else
CFLAGS += -DFATFS_FFCONF_OPT_FS_NORTC=1 CFLAGS += -DFATFS_FFCONF_OPT_FS_NORTC=1
endif endif
ifeq ($(shell uname -s),Darwin) OS := $(shell uname -s)
ifeq ($(OS),Darwin)
CFLAGS += -Wno-empty-body CFLAGS += -Wno-empty-body
endif endif