diff options
| author | ladislas <ladislas@weareleka.com> | 2014-08-19 00:02:38 +0200 |
|---|---|---|
| committer | ladislas <ladislas@weareleka.com> | 2014-08-19 00:29:52 +0200 |
| commit | f930c1780170f53f81bfe42095c8c161a5802cfc (patch) | |
| tree | ea93260b540916278cb035f9e97d7b2c9eba93eb /Arduino.mk | |
| parent | 58f303a5d358f68e1b53012790225e8d677f8f0e (diff) | |
Add automatic lib detection with python script, enhance lib listing output when compiling
Diffstat (limited to 'Arduino.mk')
| -rw-r--r-- | Arduino.mk | 40 |
1 files changed, 33 insertions, 7 deletions
@@ -736,7 +736,7 @@ ifeq ($(strip $(CHK_SOURCES)),) $(call show_config_info,No .pde or .ino files found. If you are compiling .c or .cpp files then you need to explicitly include Arduino header files) else #TODO: Support more than one file. https://github.com/sudar/Arduino-Makefile/issues/49 - $(error Need exactly one .pde or .ino file. This makefile doesn't support multiple .ino/.pde files yet) + $(error Need exactly one .pde or .ino file. This makefile doesn\'t support multiple .ino/.pde files yet) endif endif @@ -764,6 +764,19 @@ else endif ######################################################################## +# Automatically find the libraries needed to compile the sketch + +ifndef MAIN_LIBS + MAIN_LIBS = $(shell $(ARDMK_DIR)/bin/auto-lib.py $(USER_LIB_PATH) | \ + sed -ne 's/MAIN_LIBS \(.*\) /\1/p') +endif + +ifndef LIBS_DEPS + LIBS_DEPS = $(shell $(ARDMK_DIR)/bin/auto-lib.py $(USER_LIB_PATH) | \ + sed -ne 's/LIBS_DEPS \(.*\) /\1/p') +endif + +######################################################################## # Determine ARDUINO_LIBS automatically ifndef ARDUINO_LIBS @@ -772,8 +785,7 @@ ifndef ARDUINO_LIBS $(shell sed -ne "s/^ *\# *include *[<\"]\(.*\)\.h[>\"]/\1/p" $(LOCAL_SRCS))) ARDUINO_LIBS += $(filter $(notdir $(wildcard $(ARDUINO_SKETCHBOOK)/libraries/*)), \ $(shell sed -ne "s/^ *\# *include *[<\"]\(.*\)\.h[>\"]/\1/p" $(LOCAL_SRCS))) - ARDUINO_LIBS += $(filter $(notdir $(wildcard $(USER_LIB_PATH)/*)), \ - $(shell sed -ne "s/^ *\# *include *[<\"]\(.*\)\.h[>\"]/\1/p" $(LOCAL_SRCS))) + ARDUINO_LIBS += $(MAIN_LIBS) $(LIBS_DEPS) endif ######################################################################## @@ -989,13 +1001,27 @@ else $(call show_config_info,Size utility: Basic (not AVR-aware),[AUTODETECTED]) endif -ifneq (,$(strip $(ARDUINO_LIBS))) +ifneq (,$(strip $(MAIN_LIBS))) $(call arduino_output,-) - $(call show_config_info,ARDUINO_LIBS =) + $(call show_config_info,MAIN_LIBS =) endif -ifneq (,$(strip $(USER_LIB_NAMES))) - $(foreach lib,$(USER_LIB_NAMES),$(call show_config_info, $(lib),[USER])) +ifneq (,$(strip $(MAIN_LIBS))) + $(foreach lib,$(MAIN_LIBS),$(call show_config_info, $(lib),[USER])) +endif + +ifneq (,$(strip $(LIBS_DEPS))) + $(call arduino_output,-) + $(call show_config_info,LIBS_DEPS =) +endif + +ifneq (,$(strip $(LIBS_DEPS))) + $(foreach lib,$(LIBS_DEPS),$(call show_config_info, $(lib),[USER])) +endif + +ifneq (,$(strip $(SYS_LIBS))) + $(call arduino_output,-) + $(call show_config_info,SYS_LIBS =) endif ifneq (,$(strip $(SYS_LIB_NAMES))) |
