-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
39 lines (30 loc) · 706 Bytes
/
Makefile
File metadata and controls
39 lines (30 loc) · 706 Bytes
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
BIN_NAME = img2braille
SRC = $(foreach f,$(shell git ls-files '*.go'),$(abspath $(f)))
OUT_DIR = build
OUT = $(abspath $(OUT_DIR)/$(BIN_NAME))
$(info $(SRC))
.PHONY: all\
build\
pre-build\
install\
clean
all: build
$(OUT): $(SRC)
cd src && \
go build -o $(OUT) $(SRC)
build: pre-build $(OUT)
@ echo Build DONE
pre-build:
mkdir -p $(OUT_DIR)
install:
@ if [[ "$$(id -u)" -eq 0 ]]; then \
cp -f $(OUT) /usr/bin/$(BIN_NAME); \
echo "Installed as '/usr/bin/$(BIN_NAME)'." > /dev/stderr; \
else \
mkdir -p ~/.local/bin/; \
cp -f $(OUT) ~/.local/bin/$(BIN_NAME); \
echo "Installed as '~/.local/bin/$(BIN_NAME)'." > /dev/stderr; \
fi
clean:
rm -rf $(OUT_DIR)
@ echo Clean DONE