-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
54 lines (44 loc) · 1.14 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
54
# Author: Rory Olsen, LabJack Corporation
# Date: 2020-07-03
# License: MIT
# https://tech.davis-hansson.com/p/make/
SHELL := bash
.ONESHELL:
.SHELLFLAGS := -eu -o pipefail -c
.DELETE_ON_ERROR:
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
ifeq ($(origin .RECIPEPREFIX), undefined)
$(error This Make does not support .RECIPEPREFIX. Please use GNU Make 4.0 or later)
endif
.RECIPEPREFIX = >
# Default - top level rule is what gets ran when you run just `make`
build: out/labjack-ljm
.PHONY: build
clean:
> rm -rf out
.PHONY: clean
out/labjack-ljm:
> mkdir -p $(@D)
> image_id="labjack/ljm:$$(cat VERSION)"
> docker build --tag="$${image_id}" ubuntu_18
> echo "$${image_id}" > out/labjack-ljm
# Test / example
out/example:
> mkdir -p $(@D)
> image_id="labjack/ljm:$$(cat VERSION)"
> docker build -t ljm-example example
> echo "$${image_id}" > out/example
test: out/example
> docker run --rm \
-v /run/udev:/run/udev:ro \
-v /dev/bus/usb:/dev/bus/usb \
--privileged \
--network=host \
ljm-example
.PHONY: test
# Publish
publish:
> image_id="labjack/ljm:$$(cat VERSION)"
> docker push $${image_id}
.PHONY: publish