diff options
| author | Ryan Pavlik <rpavlik@iastate.edu> | 2012-07-05 15:02:24 -0500 |
|---|---|---|
| committer | Ryan Pavlik <rpavlik@iastate.edu> | 2012-07-05 15:02:24 -0500 |
| commit | c93c8e16a5480205f452e18e022ad7f812ca7206 (patch) | |
| tree | 12d496136967acd11b75cf1a605aafb3e0221562 /arduino-mk/Arduino.mk | |
| parent | 6c7a8bad60e56502c91da9ab4b3588dbd3ab21f4 (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.
Diffstat (limited to 'arduino-mk/Arduino.mk')
| -rw-r--r-- | arduino-mk/Arduino.mk | 13 |
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))) |
