@@ -736,7 +736,7 @@ ifeq ($(strip $(CHK_SOURCES)),)
736
736
$(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)
737
737
else
738
738
# TODO: Support more than one file. https://github.com/sudar/Arduino-Makefile/issues/49
739
- $(error Need exactly one .pde or .ino file. This makefile doesn't support multiple .ino/.pde files yet)
739
+ $(error Need exactly one .pde or .ino file. This makefile doesn\ 't support multiple .ino/.pde files yet)
740
740
endif
741
741
endif
742
742
@@ -763,6 +763,19 @@ else
763
763
$(call show_config_info,NO_CORE set so core library will not be built,[MANUAL])
764
764
endif
765
765
766
+ # #######################################################################
767
+ # Automatically find the libraries needed to compile the sketch
768
+
769
+ ifndef MAIN_LIBS
770
+ MAIN_LIBS = $(shell $(ARDMK_DIR ) /bin/auto-lib.py $(USER_LIB_PATH ) | \
771
+ sed -ne 's/MAIN_LIBS \(.* \) /\1/p')
772
+ endif
773
+
774
+ ifndef LIBS_DEPS
775
+ LIBS_DEPS = $(shell $(ARDMK_DIR ) /bin/auto-lib.py $(USER_LIB_PATH ) | \
776
+ sed -ne 's/LIBS_DEPS \(.* \) /\1/p')
777
+ endif
778
+
766
779
# #######################################################################
767
780
# Determine ARDUINO_LIBS automatically
768
781
@@ -772,8 +785,7 @@ ifndef ARDUINO_LIBS
772
785
$(shell sed -ne "s/^ * \# * include * [<\"]\(.* \) \.h[>\"]/\1/p" $(LOCAL_SRCS ) ) )
773
786
ARDUINO_LIBS += $(filter $(notdir $(wildcard $(ARDUINO_SKETCHBOOK ) /libraries/* ) ) , \
774
787
$(shell sed -ne "s/^ * \# * include * [<\"]\(.* \) \.h[>\"]/\1/p" $(LOCAL_SRCS ) ) )
775
- ARDUINO_LIBS += $(filter $(notdir $(wildcard $(USER_LIB_PATH ) /* ) ) , \
776
- $(shell sed -ne "s/^ * \# * include * [<\"]\(.* \) \.h[>\"]/\1/p" $(LOCAL_SRCS ) ) )
788
+ ARDUINO_LIBS += $(MAIN_LIBS ) $(LIBS_DEPS )
777
789
endif
778
790
779
791
# #######################################################################
@@ -989,13 +1001,27 @@ else
989
1001
$(call show_config_info,Size utility : Basic (not AVR-aware),[AUTODETECTED])
990
1002
endif
991
1003
992
- ifneq (,$(strip $(ARDUINO_LIBS ) ) )
1004
+ ifneq (,$(strip $(MAIN_LIBS ) ) )
993
1005
$(call arduino_output,-)
994
- $(call show_config_info,ARDUINO_LIBS =)
1006
+ $(call show_config_info,MAIN_LIBS =)
995
1007
endif
996
1008
997
- ifneq (,$(strip $(USER_LIB_NAMES ) ) )
998
- $(foreach lib,$(USER_LIB_NAMES),$(call show_config_info, $(lib),[USER]))
1009
+ ifneq (,$(strip $(MAIN_LIBS ) ) )
1010
+ $(foreach lib,$(MAIN_LIBS),$(call show_config_info, $(lib),[USER]))
1011
+ endif
1012
+
1013
+ ifneq (,$(strip $(LIBS_DEPS ) ) )
1014
+ $(call arduino_output,-)
1015
+ $(call show_config_info,LIBS_DEPS =)
1016
+ endif
1017
+
1018
+ ifneq (,$(strip $(LIBS_DEPS ) ) )
1019
+ $(foreach lib,$(LIBS_DEPS),$(call show_config_info, $(lib),[USER]))
1020
+ endif
1021
+
1022
+ ifneq (,$(strip $(SYS_LIBS ) ) )
1023
+ $(call arduino_output,-)
1024
+ $(call show_config_info,SYS_LIBS =)
999
1025
endif
1000
1026
1001
1027
ifneq (,$(strip $(SYS_LIB_NAMES ) ) )
0 commit comments