diff options
| author | Sudar <sudar@sudarmuthu.com> | 2014-08-19 10:38:52 +0530 |
|---|---|---|
| committer | Sudar <sudar@sudarmuthu.com> | 2014-08-19 10:38:52 +0530 |
| commit | 0d2c9661c3ddabf503e80d56187c5b2684e8b028 (patch) | |
| tree | ea93260b540916278cb035f9e97d7b2c9eba93eb /Arduino.mk | |
| parent | e17b2a4781d661246a44f14b4096cf2e19eefafd (diff) | |
| parent | f930c1780170f53f81bfe42095c8c161a5802cfc (diff) | |
Merge pull request #238 from WeAreLeka/auto-libauto-lib
Add Support for Library Auto-detection
Diffstat (limited to 'Arduino.mk')
| -rw-r--r-- | Arduino.mk | 42 |
1 files changed, 34 insertions, 8 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))) @@ -1333,7 +1359,7 @@ ifneq ($(strip $(AVRDUDE_ISP_FUSES_POST)),) $(AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ISP_OPTS) $(AVRDUDE_ISP_FUSES_POST) endif -clean: +clean:: $(REMOVE) $(OBJDIR) size: $(TARGET_HEX) |
