-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
44 lines (39 loc) · 1.11 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
.DEFAULT_GOAL := flash
.PHONY: flash build check-env
include .env
TINYGO_ARGS = \
-ldflags \
"-X main.updateIntervalSetting=${UPDATE_INTERVAL} \
-X main.sensorPinsSetting=${SENSOR_PINS} \
-X main.sensorDryCalibrationsSetting=${SENSOR_DRY_CALIBRATIONS} \
-X main.sensorWetCalibrationsSetting=${SENSOR_WET_CALIBRATIONS}" \
-target ${MICROCONTROLLER_TYPE} \
-size full \
./cmd/automatic_soil_monitor
check-env:
ifndef UPDATE_INTERVAL
@echo "The UPDATE_INTERVAL environment variable must be set."
@exit 1
endif
ifndef SENSOR_PINS
@echo "The SENSOR_PINS environment variable must be set."
@exit 1
endif
ifndef SENSOR_DRY_CALIBRATIONS
@echo "The SENSOR_DRY_CALIBRATIONS environment variable must be set."
@exit 1
endif
ifndef SENSOR_WET_CALIBRATIONS
@echo "The SENSOR_WET_CALIBRATIONS environment variable must be set."
@exit 1
endif
ifndef MICROCONTROLLER_TYPE
@echo "The MICROCONTROLLER_TYPE environment variable must be set."
@exit 1
endif
flash: check-env
@echo "Building and flashing program..."
tinygo flash -monitor $(TINYGO_ARGS)
build: check-env
@echo "Building program..."
tinygo build $(TINYGO_ARGS)