@@ -794,7 +794,7 @@ ifeq ($(strip $(CHK_SOURCES)),)
794
794
$(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)
795
795
else
796
796
# TODO: Support more than one file. https://github.com/sudar/Arduino-Makefile/issues/49
797
- $(error Need exactly one .pde or .ino file. This makefile doesn't support multiple .ino/.pde files yet)
797
+ $(error Need exactly one .pde or .ino file. This makefile doesn\ 't support multiple .ino/.pde files yet)
798
798
endif
799
799
endif
800
800
@@ -821,6 +821,19 @@ else
821
821
$(call show_config_info,NO_CORE set so core library will not be built,[MANUAL])
822
822
endif
823
823
824
+ # #######################################################################
825
+ # Automatically find the libraries needed to compile the sketch
826
+
827
+ ifndef SKETCH_LIBS
828
+ SKETCH_LIBS := $(shell $(ARDMK_DIR)/bin/lib-detection $(USER_LIB_PATH) | \
829
+ sed -ne 's/SKETCH_LIBS \(.*\) /\1/p')
830
+ endif
831
+
832
+ ifndef SKETCH_LIBS_DEPS
833
+ SKETCH_LIBS_DEPS := $(shell $(ARDMK_DIR)/bin/lib-detection $(USER_LIB_PATH) | \
834
+ sed -ne 's/SKETCH_LIBS_DEPS \(.*\) /\1/p')
835
+ endif
836
+
824
837
# #######################################################################
825
838
# Determine ARDUINO_LIBS automatically
826
839
@@ -932,7 +945,10 @@ get_library_files = $(if $(and $(wildcard $(1)/src), $(wildcard $(1)/library.pr
932
945
$(wildcard $(1 ) /* .$(2 ) $(1 ) /utility/* .$(2 ) ) )
933
946
934
947
# General arguments
935
- USER_LIBS := $(sort $(wildcard $(patsubst % ,$(USER_LIB_PATH ) /% ,$(ARDUINO_LIBS ) ) ) )
948
+ USER_LIBS := $(wildcard $(patsubst % ,$(USER_LIB_PATH ) /% ,$(ARDUINO_LIBS ) ) ) \
949
+ $(wildcard $(patsubst % ,$(USER_LIB_PATH ) /% ,$(SKETCH_LIBS ) ) ) \
950
+ $(wildcard $(patsubst % ,$(USER_LIB_PATH ) /% ,$(SKETCH_LIBS_DEPS ) ) )
951
+
936
952
USER_LIB_NAMES := $(patsubst $(USER_LIB_PATH ) /% ,% ,$(USER_LIBS ) )
937
953
938
954
# Let user libraries override system ones.
@@ -1107,17 +1123,32 @@ else
1107
1123
$(call show_config_info,Size utility : Basic (not AVR-aware),[AUTODETECTED])
1108
1124
endif
1109
1125
1110
- ifneq (,$(strip $(ARDUINO_LIBS ) ) )
1126
+ ifneq (,$(strip $(SKETCH_LIBS ) ) )
1127
+ $(call arduino_output,-)
1128
+ $(call show_config_info,SKETCH_LIBS =)
1129
+ endif
1130
+
1131
+ ifneq (,$(strip $(SKETCH_LIBS ) ) )
1132
+ $(foreach lib,$(SKETCH_LIBS),$(call show_config_info, $(lib),[USER]))
1133
+ endif
1134
+
1135
+ ifneq (,$(strip $(SKETCH_LIBS_DEPS ) ) )
1111
1136
$(call arduino_output,-)
1112
- $(call show_config_info,ARDUINO_LIBS =)
1137
+ $(call show_config_info,SKETCH_LIBS_DEPS =)
1113
1138
endif
1114
1139
1115
- ifneq (,$(strip $(USER_LIB_NAMES ) ) )
1116
- $(foreach lib,$(USER_LIB_NAMES),$(call show_config_info, $(lib),[USER]))
1140
+ ifneq (,$(strip $(SKETCH_LIBS_DEPS ) ) )
1141
+ $(foreach lib,$(SKETCH_LIBS_DEPS),$(call show_config_info, $(lib),[USER]))
1142
+ endif
1143
+
1144
+ ifneq (,$(strip $(SYS_LIB_NAMES ) $(PLATFORM_LIB_NAMES ) ) )
1145
+ $(call arduino_output,-)
1146
+ $(call show_config_info,SYSTEM_LIBS =)
1117
1147
endif
1118
1148
1119
1149
ifneq (,$(strip $(SYS_LIB_NAMES ) ) )
1120
1150
$(foreach lib,$(SYS_LIB_NAMES),$(call show_config_info, $(lib),[SYSTEM]))
1151
+ $(call arduino_output,-)
1121
1152
endif
1122
1153
1123
1154
ifneq (,$(strip $(PLATFORM_LIB_NAMES ) ) )
0 commit comments