-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
50 lines (38 loc) · 920 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
39
40
41
42
43
44
45
46
47
48
49
50
today = $(shell date "+%Y%m%d")
product_name = pcd
.PHONY : patch
patch : clean diff-patch patch-copy2win
.PHONY : diff-patch
diff-patch :
git diff origin/master > $(product_name).$(today).patch
.PHONY : patch-branch
patch-branch :
git switch -c patch-$(today)
.PHONY : switch-master
switch-master :
git switch master
.PHONY : delete-branch
delete-branch : switch-master
git branch --list "patch*" | xargs -n 1 git branch -D
.PHONY : patch-copy2win
patch-copy2win :
cp *.patch $$WIN_HOME/Downloads/
.PHONY : install
install :
sudo cp ./$(product_name).sh ~/.local/bin/$(product_name)
.PHONY : clean
clean :
rm -f fmt-*
rm -f *.patch
.PHONY : lint
lint :
shellcheck ./$(product_name).sh
.PHONY : test
test : lint
.PHONY : format
format :
shfmt ./$(product_name).sh > ./fmt-$(product_name).sh
mv ./fmt-$(product_name).sh ./$(product_name).sh
chmod +x ./$(product_name).sh
.PHONY : fmt
fmt : format