1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #12494 from fjmolinas/pr_remove_OS

Makefile/include: use ony one call to `uname`
This commit is contained in:
Alexandre Abadie 2019-10-18 15:03:10 +02:00 committed by GitHub
commit 14567ea973
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 19 additions and 20 deletions

View File

@ -103,8 +103,11 @@ CLEAN = $(filter clean, $(MAKECMDGOALS))
include $(RIOTMAKE)/utils/variables.mk
include $(RIOTMAKE)/utils/strings.mk
# get host operating system
OS := $(shell uname)
# UNAME is always needed so use simple variable expansion so only evaluated once
UNAME := $(shell uname -m -s)
OS = $(word 1, $(UNAME))
OS_ARCH = $(word 2, $(UNAME))
# set python path, e.g. for tests
PYTHONPATH := $(RIOTBASE)/dist/pythonlibs/:$(PYTHONPATH)

View File

@ -2,7 +2,6 @@
export PROGRAMMER ?= cc2538-bsl
ifeq ($(PROGRAMMER),cc2538-bsl)
OS := $(shell uname)
ifeq ($(OS),Linux)
PORT_BSL ?= $(PORT_LINUX)
else ifeq ($(OS),Darwin)

View File

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

View File

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

View File

@ -6,7 +6,6 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbserial*)))
export PROGRAMMER ?= cc2538-bsl
ifeq ($(PROGRAMMER),cc2538-bsl)
OS := $(shell uname)
ifeq ($(OS),Linux)
PORT_BSL ?= $(PORT_LINUX)
else ifeq ($(OS),Darwin)

View File

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

View File

@ -5,7 +5,6 @@ FFLAGS ?= -p $(PORT) -e -i -w -v -b -R $(FLASHFILE)
# some arduino boards need to toggle the serial interface a little bit to get
# them ready for flashing...
ifneq (,$(BOSSA_ARDUINO_PREFLASH))
OS := $(shell uname)
ifeq ($(OS),Linux)
STTY_FLAG = -F
else ifeq ($(OS),Darwin)

View File

@ -1,5 +1,4 @@
# set default port depending on operating system
OS := $(shell uname)
ifeq ($(OS),Linux)
PORT ?= $(call ensure_value,$(PORT_LINUX),No port set)
else ifeq ($(OS),Darwin)

View File

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