forked from jwdb/rflink
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
53 lines (39 loc) · 1.46 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
# -*- make -*-
PROJ := $(notdir $(PWD))
SOURCES := $(wildcard *.ino wildcard Plugins/*.c wildcard Config/*.c)
CFGFILE := arduino-cli.yaml
CLI := arduino-cli --config-file $(CFGFILE)
PLATFORM := arduino:avr
BOARDS := arduino/package_index.json
# PORT can be overridden by the environment or on the command line. E.g.:
# export PORT=/dev/ttyUSB2; make upload, or: make upload PORT=/dev/ttyUSB2
PORT ?= /dev/ttyACM0
INO = $(PROJ).ino
FILES = $(wildcard $(PLUGINDIR)/*.c $(CONFIGDIR)/*.c)
BOARD = $(PLATFORM):mega
FQBN = $(BOARD)
IMAGE = build/$(subst :,.,$(BOARD))/$(INO).hex
CFLAGS = --build-property "build.extra_flags=\"-DSKETCH_PATH=$(PWD)\""
binaries: $(IMAGE)
platform: $(BOARDS)
clean:
rm -f *~
distclean: clean
rm -rf arduino build libraries staging arduino-cli.yaml
$(CFGFILE):
$(CLI) config init --dest-file $(CFGFILE)
$(CLI) config set directories.data $(PWD)/arduino
$(CLI) config set directories.downloads $(PWD)/staging
$(CLI) config set directories.user $(PWD)
$(CLI) config set sketch.always_export_binaries true
$(BOARDS): | $(CFGFILE)
$(CLI) core update-index
$(CLI) core install $(PLATFORM)
$(IMAGE): $(BOARDS) $(LIBRARIES) $(SOURCES)
$(CLI) compile --fqbn=$(FQBN) --warnings default --verbose $(CFLAGS)
upload: $(IMAGE)
$(CLI) upload -p $(PORT) --fqbn=$(FQBN) .
.PHONY: binaries platform clean distclean upload
### Allow customization through a local Makefile: Makefile-local.mk
# Include the local make file, if it exists
-include Makefile-local.mk