-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
67 lines (52 loc) · 1.43 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
55
56
57
58
59
60
61
62
63
64
65
66
67
.PHONY: all build clean \
check checkdist \
docker \
test testdocker testdev testci \
readme
# Default target
all: check test build checkdist
# Build target
build: build/jdvlib.sh
# Specify dependencies for build/jdvlib.sh
LIB_FILES := $(wildcard lib/*)
TEMPLATES := $(wildcard templates/*)
# all files under the test directory, at any level
TESTS := $(wildcard test/**/*)
build/jdvlib.sh: $(LIB_FILES) $(TEMPLATES) compile.sh
@mkdir -p build
@./compile.sh lib build/jdvlib.sh
VERSION=$$(bash build/jdvlib.sh --version); \
command cp build/jdvlib.sh build/jdvlib-$${VERSION}.sh
# Clean target
clean:
@echo "Cleaning up..."
@rm -rfv build
check:
shellcheck compile.sh
shellcheck test/test_helper/common_setup.bash
shellcheck test/*.bats
shellcheck test/scripts/*.sh
shellcheck templates/*.sh
shellcheck --check-sourced lib/lib.sh
checkdist: build/jdvlib.sh
shellcheck build/jdvlib.sh
test:
@./test/bats/bin/bats test
docker: $(LIB_FILES) $(TEMPLATES) Dockerfile
@docker build -t jdvlib .
testdocker:
@docker run -it --rm jdvlib
testdev:
@docker run -it --rm -v $(PWD):/app jdvlib $(MODULE)
readme:
@./compile.sh readme
testci:
echo no
# Installation directories
DESTDIR ?= /
PREFIX ?= /usr/local
# Install target
install: build/jdvlib.sh
@echo "Installing jdvlib.sh to $(DESTDIR)$(PREFIX)..."
install -d $(DESTDIR)$(PREFIX)/bin
install -CS -m 755 build/jdvlib.sh $(DESTDIR)$(PREFIX)/bin/jdvlib.sh