This repository has been archived by the owner on Nov 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
82 lines (60 loc) · 2.36 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
############################################################
# Configuration settings in this section
ARDMK_DIR=<path>
ARDUINO_VERSION=10813
BOARD_TAG=<tag>
MONITOR_PORT=<port>
ARDUINO_LIBS=arduino-timer-cpp17-4.5.0
ARDUINO_HOST=ip.ip.ip.ip-or-hostname
ARDUINO_OTA_PORT=65280
ARDUINO_OTA_USERNAME=arduino
ARDUINO_OTA_PASSWORD=password
ARDUINO_NET_DEBUG_PORT=64440
SERIAL_DEBUG=
NET_DEBUG=
OPTIMIZATION_LEVEL=s
# End of configuration settings
############################################################
ARDUINO_LIBS+=SPI Ethernet ArduinoBLE ArduinoOTA PubSubClient aWOT
ifdef SERIAL_DEBUG
MONITOR_BAUDRATE=115200
CPPFLAGS+=-DSERIAL_DEBUG -DSERIAL_DEBUG_BAUDRATE=$(MONITOR_BAUDRATE)
endif
ifdef NET_DEBUG
CPPFLAGS+=-DNET_DEBUG -DNET_DEBUG_PORT=$(ARDUINO_NET_DEBUG_PORT)
endif
CXXFLAGS_STD=-std=gnu++17
CPPFLAGS+=-DOTA_USERNAME=\"$(ARDUINO_OTA_USERNAME)\" -DOTA_PASSWORD=\"$(ARDUINO_OTA_PASSWORD)\"
include $(ARDMK_DIR)/Sam.mk
ifndef ARDUINO_OTA
BUNDLED_ARDUINO_OTA_DIR := $(call dir_if_exists,$(ARDUINO_PACKAGE_DIR)/$(ARDMK_VENDOR)/tools/arduinoOTA)
# Try Arduino support package first
ifdef BUNDLED_ARDUINO_OTA_DIR
ifndef ARDUINO_OTA_VER
ARDUINO_OTA_VER := $(shell basename $(firstword $(wildcard $(BUNDLED_ARDUINO_OTA_DIR)/*)))
endif
ARDUINO_OTA = $(BUNDLED_ARDUINO_OTA_DIR)/$(ARDUINO_OTA_VER)/bin/arduinoOTA
$(call show_config_variable,ARDUINO_OTA,[AUTODETECTED],(from ARDUINO_PACKAGE_DIR))
else
# Otherwise look on user path
ARDUINO_OTA := $(shell which arduinoOTA 2>/dev/null)
ifdef ARDUINO_OTA
$(call show_config_variable,ARDUINO_OTA,[AUTODETECTED],(found in $$PATH))
endif
endif
else
$(call show_config_variable,ARDUINO_OTA,[USER])
endif
ota: $(TARGET_BIN) verify_size
$(ARDUINO_OTA) -address $(ARDUINO_HOST) -port $(ARDUINO_OTA_PORT) -username $(ARDUINO_OTA_USERNAME) -password $(ARDUINO_OTA_PASSWORD) -sketch $(TARGET_BIN) -upload /sketch -b
net_monitor:
nc --recv-only $(ARDUINO_HOST) $(ARDUINO_NET_DEBUG_PORT)
$(OBJDIR)/garaduino.ino.o $(OBJDIR)/web.cpp.o: gitversion.hpp
gitversion.hpp:
@echo "#define GIT_VERSION \"$(shell git describe --long --tags)\"" > $@
$(OBJDIR)/web.cpp.o: buildstamp.hpp
buildstamp.hpp:
echo "#define BUILDSTAMP \"$(shell date '+%s')\"" > $@
clean::
$(REMOVE) gitversion.hpp buildstamp.hpp
.PHONY: gitversion.hpp buildstamp.hpp net_monitor