-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
47 lines (38 loc) · 1.15 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
MODULES = fetcher packager broadcaster plogger
MODULE_PATHS = $(foreach module,$(MODULES),$(abspath $(module)))
PI_ARCH = nto-aarch64-o.le
UTILITIES = i2c-scanner eeprom-write
BINARIES = $(foreach module,$(MODULES) $(UTILITIES),$(abspath $(module))/$(PI_ARCH)/$(module))
# Port is optional but will be 22 by default
deploy: PORT = 22
# Modules should not be treated as having dependencies
.PHONY: $(MODULES)
.PHONY: $(UTILITIES)
# Calls Makefile for the specific project
$(MODULES):
$(info Building $@)
$(MAKE) all -C $(abspath $@)
# Compiles all binaries
all: $(MODULES) $(UTILITIES)
$(info All modules built!)
$(UTILITIES):
$(info Building $@)
$(MAKE) all -C $(abspath $@)
# Cleans all binaries
clean:
for module in $(MODULE_PATHS); do $(MAKE) clean -C $$module; done
$(info All modules cleaned!)
# Updates all sub modules recursively
update:
git pull
git submodule foreach git pull origin main; git checkout main
# Rule for uploading binaries to the Raspberry Pi
deploy:
ifeq ($(HOST),)
$(error Try using 'make deploy HOST=<host>')
endif
ifeq ($(OS),Windows_NT)
deploy.bat $(HOST) $(PORT) $(BINARIES)
else
./deploy.sh -h $(HOST) -p $(PORT) $(BINARIES)
endif