-
Notifications
You must be signed in to change notification settings - Fork 93
/
Makefile
38 lines (30 loc) · 964 Bytes
/
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
.DEFAULT_GOAL := stub
bindir ?= ./build/bin
etcdir ?= ./build/etc
uname := $(shell uname -s)
clean: | uninstall
install: | stub
@rsync -a src/ ${bindir}/
ifeq (${uname}, Darwin)
@$(eval _bindir := $(shell greadlink -f ${bindir}))
@$(eval _etcdir := $(shell greadlink -f ${etcdir}))
@sed -i '' "s|bindir=.*|bindir=${_bindir}|g" ${bindir}/slack
@sed -i '' "s|etcdir=.*|etcdir=${_etcdir}|g" ${bindir}/slack
else ifeq (${uname}, Linux)
@$(eval _bindir := $(shell readlink -f ${bindir}))
@$(eval _etcdir := $(shell readlink -f ${etcdir}))
@sed -i "s|bindir=.*|bindir=${_bindir}|g" ${bindir}/slack
@sed -i "s|etcdir=.*|etcdir=${_etcdir}|g" ${bindir}/slack
endif
stub:
@mkdir -p ${bindir}
@mkdir -p ${etcdir}
test: | test-unit test-integration
test-integration: | install
@bats test/integration
test-unit: | install
@bats test/unit
uninstall:
@rm -rf ${bindir}
@rm -rf ${etcdir}
.PHONY: clean install stub test test-integration test-unit uninstall