This repository has been archived by the owner on Jun 18, 2024. It is now read-only.
forked from pojntfx/felicitas.pojtinger.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
76 lines (60 loc) · 1.97 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
68
69
70
71
72
73
74
75
76
# Variables
DESTDIR ?=
WWWROOT ?= /var/www/html
WWWPREFIX ?= /yara.amendiares
PREFIX ?= /usr/local
OUTPUT_DIR ?= out
DST ?=
# Private variables
obj = ps-api ps-gen-projects ps-proxy ps-spotify-get-refresh-token
sts = ps-pwa
all: $(addprefix build-cli/,$(obj)) $(addprefix build-pwa/,$(sts))
# Build
build: $(addprefix build-cli/,$(obj)) $(addprefix build-pwa/,$(sts))
# Build binary
$(addprefix build-cli/,$(obj)):
ifdef DST
go build -o $(DST) ./cmd/$(subst build-cli/,,$@)
else
go build -o $(OUTPUT_DIR)/$(subst build-cli/,,$@) ./cmd/$(subst build-cli/,,$@)
endif
# Build frontend
$(addprefix build-pwa/,$(sts)):
mkdir -p $(OUTPUT_DIR)
hugo --baseUrl=/
tar czvf $(OUTPUT_DIR)/$(subst build-pwa/,,$@).tar.gz -C public .
# Install
install: $(addprefix install-cli/,$(obj)) $(addprefix install-pwa/,$(sts))
# Install binary
$(addprefix install-cli/,$(obj)):
install -D -m 0755 $(OUTPUT_DIR)/$(subst install-cli/,,$@) $(DESTDIR)$(PREFIX)/bin/$(subst install-cli/,,$@)
# Install frontend
$(addprefix install-pwa/,$(sts)):
mkdir -p $(DESTDIR)$(WWWROOT)$(WWWPREFIX)
cp -rf public/* $(DESTDIR)$(WWWROOT)$(WWWPREFIX)
# Uninstall
uninstall: $(addprefix uninstall-cli/,$(obj)) $(addprefix uninstall-pwa/,$(sts))
# Uninstall binary
$(addprefix uninstall-cli/,$(obj)):
rm -f $(DESTDIR)$(PREFIX)/bin/$(subst uninstall-cli/,,$@)
# Uninstall frontend
$(addprefix uninstall-pwa/,$(sts)):
rm -rf $(DESTDIR)$(WWWROOT)$(WWWPREFIX)
# Run
run:
go run ./cmd/ps-proxy/ -scmd='hugo server --baseUrl=/ --appendPort=false'
# Develop
dev:
go run ./cmd/ps-proxy/ -scmd='hugo server -D --baseUrl=/ --appendPort=false' -verbose
# Clean
clean:
rm -rf out public resources
# Dependencies
depend:
npm i
find node_modules/@patternfly/patternfly/ -name "*.css" -type f -delete
rm -rf static/fonts
mkdir -p static
cp -r node_modules/@patternfly/patternfly/assets/fonts static
cp -r node_modules/@fontsource/lato/files static/fonts/lato
go run ./cmd/ps-gen-projects/ -src data/projects.yaml > data/projects_gen.yaml