-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
67 lines (57 loc) · 1.4 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
CMD_FILES=$(shell ls cmd)
CONF_FILES=$(shell find config)
USER_HOME ?= $$HOME
build:
@go mod tidy
@for i in $(shell ls cmd) ; do \
cd cmd/$$i ; \
echo "Building $$i" ; \
go build -o ../../bin/uq-$$i main.go && echo 'Build successful' ; \
cd ../.. ; \
done
install: build
@chmod 755 bin/*
@chmod 755 scripts/*
@cp -fp bin/* /usr/bin/
@cp -fp scripts/* /usr/bin
uninstall:
clean:
rm bin/*
sync:
@for i in $(shell find configs/root); do \
host_path=$$(echo "$$i" | cut -c13-) ; \
if [[ -f $$i ]]; then \
echo "Linking $$host_path to $$i" ; \
ln -f $$host_path $$i ; \
fi ; \
done
@for i in $(shell find configs/home); do \
host_path="${USER_HOME}/$$(echo "$$i" | cut -c14-)" ; \
if [[ -f $$i ]]; then \
echo "Linking $$host_path to $$i" ; \
ln -f $$i $$host_path ; \
fi ; \
done
config:
@for i in $(shell find configs/root); do \
path=$$(echo "$$i" | cut -c13-) ; \
echo $$i $$path ; \
if [[ -d $$i ]]; then \
echo "Creating directory $$i" ; \
mkdir -p $$path ; \
elif [[ -f $$i ]]; then \
echo "Linking $$i to $$path" ; \
ln -f $$i $$path ; \
fi \
done
@for i in $(shell find configs/home); do \
path="$$HOME/$$(echo "$$i" | cut -c14-)" ; \
echo $$i $$path ; \
if [[ -d $$i ]]; then \
echo "Creating directory $$i" ; \
mkdir -p $$path ; \
elif [[ -f $$i ]]; then \
echo "Linking $$i to $$path" ; \
ln -f $$i $$path ; \
fi \
done