-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
42 lines (32 loc) · 1.29 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
DATASHEET_DIR = hardware/datasheets
DATASHEET_ZIP = hardware/datasheets.zip
DATASHEETS = $(wildcard $(DATASHEET_DIR)/*.pdf)
GATEWAY_CMD_DIR = cmd/gatewayd
GATEWAY_OUT_BIN = ../gatewayd
USE_GO_MODULES = GO111MODULE=on
.PHONY: init clean-datasheets test-gateway test-firmware test-firmware-mcu test-firmware-wifi
init:
echo "initialising repository - configuring githooks"
cp -n .github/pre-commit.sh .git/hooks/pre-commit | true
cp -n .github/post-commit.sh .git/hooks/post-commit | true
chmod +x .git/hooks/post-commit .git/hooks/pre-commit
# extract all hardware datasheets
mkdir -p $(DATASHEET_DIR)
unzip -u $(DATASHEET_ZIP) -d $(DATASHEET_DIR)
clean-datasheets:
rm -rf $(DATASHEET_ZIP)
# There is an update flag for zip (-u) but it's inconsistent.
$(DATASHEET_ZIP): $(DATASHEET_DIR)
make clean-datasheets
cd $(DATASHEET_DIR); zip -D ../../$(DATASHEET_ZIP) *.pdf
test-gateway: gateway/pkg gateway/cmd
cd gateway; GO111MODULE=on go generate ./...
cd gateway; GO111MODULE=on go test ./...
gofmt -e -l gateway/pkg
gatewayd: gateway/pkg gateway/cmd
cd gateway; $(USE_GO_MODULES) go build -o $(GATEWAY_OUT_BIN) ./$(GATEWAY_CMD_DIR)
test-firmware-mcu:
cd firmware; pio test -f mcu -e mcu -v
test-firmware-wifi:
cd firmware; pio test -f wifi -e wifi -v
test-firmware: test-firmware-mcu test-firmware-wifi