aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Pavlik <rpavlik@iastate.edu>2012-07-05 15:02:24 -0500
committerRyan Pavlik <rpavlik@iastate.edu>2012-07-05 15:02:24 -0500
commitc93c8e16a5480205f452e18e022ad7f812ca7206 (patch)
tree12d496136967acd11b75cf1a605aafb3e0221562
parent6c7a8bad60e56502c91da9ab4b3588dbd3ab21f4 (diff)
Improved library finding logic.
Look first in the user dir. Any not found there are sought in the system (Arduino) dir. If any are not found, error out right away with a useful message. Show all libraries and where they were found (user or system) in the config info.
-rw-r--r--arduino-mk/Arduino.mk13
1 files changed, 12 insertions, 1 deletions
diff --git a/arduino-mk/Arduino.mk b/arduino-mk/Arduino.mk
index 5ab69c8..d50ff22 100644
--- a/arduino-mk/Arduino.mk
+++ b/arduino-mk/Arduino.mk
@@ -547,8 +547,19 @@ CAT = cat
ECHO = echo
# General arguments
-SYS_LIBS = $(wildcard $(patsubst %,$(ARDUINO_LIB_PATH)/%,$(ARDUINO_LIBS)))
USER_LIBS = $(wildcard $(patsubst %,$(USER_LIB_PATH)/%,$(ARDUINO_LIBS)))
+USER_LIB_NAMES= $(patsubst $(USER_LIB_PATH)/%,%,$(USER_LIBS))
+
+# Let user libraries override system ones.
+SYS_LIBS = $(wildcard $(patsubst %,$(ARDUINO_LIB_PATH)/%,$(filter-out $(USER_LIB_NAMES),$(ARDUINO_LIBS))))
+SYS_LIB_NAMES = $(patsubst $(ARDUINO_LIB_PATH)/%,%,$(SYS_LIBS))
+
+# Error here if any are missing.
+LIBS_NOT_FOUND = $(filter-out $(USER_LIB_NAMES) $(SYS_LIB_NAMES),$(ARDUINO_LIBS))
+ifneq (,$(strip $(LIBS_NOT_FOUND)))
+ $(error The following libraries specified in ARDUINO_LIBS could not be found (searched USER_LIB_PATH and ARDUINO_LIB_PATH): $(LIBS_NOT_FOUND))
+endif
+
SYS_INCLUDES = $(patsubst %,-I%,$(SYS_LIBS))
USER_INCLUDES = $(patsubst %,-I%,$(USER_LIBS))
LIB_C_SRCS = $(wildcard $(patsubst %,%/*.c,$(SYS_LIBS)))