-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
67 lines (54 loc) · 1.66 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
build: clean
ifeq ($(OS),Windows_NT)
@go build -ldflags="-X 'main.Version=v$(VERSION)'" -o .\build\promptwin.exe .\cmd\prompt\main.go
else
@go build -ldflags="-X 'main.Version=v$(VERSION)'" -o build/prompt cmd/prompt/main.go
@GOOS=windows GOARCH=amd64 go build -ldflags="-X 'main.Version=v$(VERSION)'" -o ./build/promptwin.exe cmd/prompt/main.go
endif
@echo Built prompt
clean:
ifeq ($(OS),Windows_NT)
@if exist ".\build" rmdir .\build /s /q
else
@rm -rf build
endif
@echo Cleaned
install: uninstall
ifeq ($(OS),Windows_NT)
@if not exist "%LOCALAPPDATA%\prompt" mkdir %LOCALAPPDATA%\prompt
@copy .\build\promptwin.exe %LOCALAPPDATA%\prompt /y
else
@[ -d $${HOME}/.local/bin ] || @mkdir -p $${HOME}/.local/bin
@cp build/prompt $${HOME}/.local/bin
endif
@echo Installed prompt
uninstall:
ifeq ($(OS),Windows_NT)
@if exist "%LOCALAPPDATA%\prompt" rmdir "%LOCALAPPDATA%\prompt" /s /q
else
@rm -f $${HOME}/.local/bin/prompt
endif
@echo Uninstalled prompt
define newline
endef
define CONTROL_FILE_BODY
Package: prompt
Version: $(VERSION)
Section: base
Priority: optional
Architecture: amd64
Maintainer: Gwendolyn Goetz
Description: Fancy prompt output
endef
package-deb:
@mkdir -p ./package/prompt_$(VERSION)/usr/local/bin
@mkdir -p ./package/prompt_$(VERSION)/DEBIAN
@cp ./build/prompt ./package/prompt_$(VERSION)/usr/local/bin
@touch ./package/prompt_$(VERSION)/DEBIAN/control
@echo '$(subst $(newline),\n,${CONTROL_FILE_BODY})' > ./package/prompt_$(VERSION)/DEBIAN/control
@dpkg-deb --build ./package/prompt_$(VERSION)
@echo Package deb
package-zip:
@zip -j package/prompt_$(VERSION).zip build/promptwin.exe
@echo Package zip
package: package-deb package-zip