forked from shelaf-dygma/Firmware-Binaries
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
49 lines (37 loc) · 1.64 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
# where the repos are
RAISE=~/work/dygma/raise-v3/firmwares/Raise-Firmware-ARM
CORE=~/Arduino/hardware/dygma/samd
SIDES=~/work/dygma/raise-v3/firmwares/at88-matrix-test
SIDE_BOOTLOADER=~/work/dygma/raise-v3/firmwares/attiny_i2c_bootloader/
# $@ The file name of the target of the rule.rule
# $< first pre requisite
# $^ names of all preerquisites
# get commit names
RAISE_COMMIT= $(shell git -C ${RAISE} log --pretty=format:'%h' -n1)
CORE_COMMIT= $(shell git -C ${CORE} log --pretty=format:'%h' -n1)
SIDES_COMMIT= $(shell git -C ${SIDES} log --pretty=format:'%h' -n1)
SIDE_BOOTLOADER_COMMIT= $(shell git -C ${SIDE_BOOTLOADER} log --pretty=format:'%h' -n1)
DATE := $(shell date +'%Y-%m-%d')
# dir name
DIR=${DATE}-Raise-${RAISE_COMMIT}-Core-${CORE_COMMIT}-Side-${SIDES_COMMIT}-SideBootloader-${SIDE_BOOTLOADER_COMMIT}
all: ${DIR}/side.hex ${DIR}/side-with-bootloader.hex ${DIR}/Raise-firmware.bin ${DIR}/Raise-firmware.hex ${DIR}/Raise-bootloader.bin latest
${DIR}:
mkdir ${DIR}
latest: ${DIR}
rm -f latest
ln -s ${DIR} latest
${DIR}/side.hex: ${DIR}
git -C ${SIDES} diff-index --quiet HEAD || exit 1
cp ${SIDES}/out/attiny88_keyscanner.hex $@
${DIR}/side-with-bootloader.hex: ${DIR}
git -C ${SIDES} diff-index --quiet HEAD || exit 1
cp ${SIDES}/out/factory.hex $@
${DIR}/Raise-firmware.bin: ${DIR}
git -C ${RAISE} diff-index --quiet HEAD || exit 1
cp ${RAISE}/output/Raise-Firmware.ino.bin $@
${DIR}/Raise-firmware.hex: ${DIR}
git -C ${RAISE} diff-index --quiet HEAD || exit 1
cp ${RAISE}/output/Raise-Firmware.ino.hex $@
${DIR}/Raise-bootloader.bin: ${DIR}
git -C ${CORE} diff-index --quiet HEAD || exit 1
cp ${CORE}/bootloaders/zero/samd21_sam_ba.bin $@