Skip to content

Commit 66728c4

Browse files
rzrhobinjk
authored andcommitted
build: Prefix rules to avoid collisions
Other included makefiles are defining common rules, so we use the "rule/" namespace Change-Id: Ide5a7444f25181169eb46e434e385d94e15a2dec Signed-off-by: Philippe Coval <[email protected]>
1 parent 2f1e120 commit 66728c4

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

Makefile

+6-6
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# file, You can obtain one at http://mozilla.org/MPL/2.0/
77
#}
88

9-
default: help
9+
default: rule/help
1010

1111
topdir?=${CURDIR}
1212
extra_dir?=${topdir}/tmp
@@ -20,10 +20,10 @@ arduino_mk_url?=https://github.com/sudar/Arduino-Makefile
2020
ARDMK_DIR?=${extra_dir}/arduino-mk
2121

2222

23-
help:
23+
rule/help:
2424
@echo "# Usage:"
25-
@echo "# make setup # Will install tools and deps"
26-
@echo "# make all # Will build all examples"
25+
@echo "# make rule/setup # Will install tools and deps"
26+
@echo "# make rule/all # Will build all examples"
2727

2828
${ARDUINO_DIR}:
2929
mkdir -p ${@D}
@@ -60,10 +60,10 @@ rule/arduino_lib_dirs: ${ArduinoMDNS_dir} ${ArduinoJson_dir}
6060
ls $^
6161
#}
6262

63-
setup: rule/arduino_dir rule/arduino_mk_dir rule/arduino_lib_dirs
63+
rule/setup: rule/arduino_dir rule/arduino_mk_dir rule/arduino_lib_dirs
6464
sync
6565

66-
all: $(wildcard examples/*/Makefile | sort)
66+
rule/all: $(wildcard examples/*/Makefile | sort)
6767
for file in $^; do \
6868
dirname=$$(dirname -- "$${file}") ; ${MAKE} -C $${dirname}; \
6969
done

examples/LevelSensor/Makefile

+11-3
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@
99
default: all
1010
@echo "# $@: $^"
1111

12-
all: rule/setup
13-
1412
top_reldir?=../..
1513
topdir?=${CURDIR}/${top_reldir}
14+
1615
-include ${topdir}/Makefile
1716

1817
AVR_TOOLS_DIR?=${ARDUINO_DIR}/hardware/tools/avr
@@ -26,7 +25,10 @@ BOARD_TAG=mega2560
2625
BOARD_SUB=
2726
MCU?=at${BOARD_TAG}
2827
F_CPU?=16000000L
29-
MONITOR_PORT?=$(shell ls /dev/ttyUSB* /dev/ttyACM* | head -n1)
28+
MONITOR_PORT?=$(shell ls /dev/ttyUSB* 2> /dev/null \
29+
|| ls /dev/ttyACM* 2> /dev/null \
30+
|| echo "/dev/TODO/setup/monitor" \
31+
| sort | head -n1)
3032
#}
3133

3234
ARCHITECTURE=avr
@@ -41,3 +43,9 @@ ARDUINO_LIBS += ArduinoMDNS
4143
ARDUINO_LIBS += ArduinoJson
4244

4345
-include ${arduino_mk}
46+
47+
rule/setup:
48+
@echo "Please setup your env to use ${arduino_mk}"
49+
50+
%: rule/setup
51+
@echo "Please run \"make $@\" again"

0 commit comments

Comments
 (0)