Skip to content

Commit 2d890db

Browse files
authored
Merge pull request #10440 from jcarrano/no-export-ports
makefiles: remove exports so that PORT is not evaluated if it's not needed.
2 parents c262770 + 7f1357b commit 2d890db

File tree

4 files changed

+8
-24
lines changed

4 files changed

+8
-24
lines changed

boards/native/Makefile.include

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ export LINKFLAGS += -ffunction-sections
6969

7070
# set the tap interface for term/valgrind
7171
ifneq (,$(filter netdev_default gnrc_netdev_default,$(USEMODULE)))
72-
export PORT ?= tap0
72+
PORT ?= tap0
7373
else
74-
export PORT =
74+
PORT =
7575
endif
7676

7777
TERMFLAGS := $(PORT) $(TERMFLAGS)

dist/tools/usb-serial/README.md

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -41,29 +41,14 @@ solution):
4141
# Add serial matching command
4242
ifneq ($(PROGRAMMER_SERIAL),)
4343
OOCD_BOARD_FLAGS += -c 'ftdi_serial $(PROGRAMMER_SERIAL)'
44-
45-
ifeq ($(PORT),)
46-
# try to find tty name by serial number, only works on Linux currently.
47-
ifeq ($(OS),Linux)
48-
PORT := $(firstword $(shell $(RIOTTOOLS)/usb-serial/find-tty.sh "^$(PROGRAMMER_SERIAL)$$"))
49-
endif
50-
endif
5144
endif
5245

53-
# Fallback PORT if no serial was specified or if the specified serial was not found
54-
ifeq ($(PORT),)
55-
ifeq ($(OS),Linux)
56-
PORT := $(firstword $(shell $(RIOTTOOLS)/usb-serial/find-tty.sh))
57-
else ifeq ($(OS),Darwin)
58-
PORT := $(shell ls -1 /dev/tty.SLAB_USBtoUART* | head -n 1)
59-
endif
60-
endif
46+
PORT_LINUX_EXACT = $(if $(PROGRAMMER_SERIAL),$(firstword $(shell $(RIOTTOOLS)/usb-serial/find-tty.sh "^$(PROGRAMMER_SERIAL)$$")),)
47+
48+
PORT_LINUX = $(if $(PORT_LINUX_EXACT),$(PORT_LINUX_EXACT),$(firstword $(shell $(RIOTTOOLS)/usb-serial/find-tty.sh)))
49+
50+
PORT_DARWIN = $(shell ls -1 /dev/tty.SLAB_USBtoUART* | head -n 1)
6151

62-
# TODO: add support for windows as host platform
63-
ifeq ($(PORT),)
64-
$(info CAUTION: No terminal port for your host system found!)
65-
endif
66-
export PORT
6752

6853

6954
Limitations

makefiles/tools/serial.inc.mk

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ endif
88
ifeq ($(PORT),)
99
$(info Warning: no PORT set!)
1010
endif
11-
export PORT
1211

1312
export BAUD ?= 115200
1413

makefiles/vars.inc.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export GIT_CACHE_DIR # path to git-cache cache directory
7575
export FLASH_ADDR # Define an offset to flash code into ROM memory.
7676
# TERMPROG # The command to call on "make term".
7777
# TERMFLAGS # Additional parameters to supply to TERMPROG.
78-
export PORT # The port to connect the TERMPROG to.
78+
# PORT # The port to connect the TERMPROG to.
7979
export ELFFILE # The unstripped result of the compilation.
8080
export HEXFILE # The 'intel hex' stripped result of the compilation.
8181
# BINFILE # The 'binary' stripped result of the compilation.

0 commit comments

Comments
 (0)