2021-08-12 22:30:47 +03:00
|
|
|
BIN=linkserv
|
|
|
|
CC=go
|
2021-04-30 05:28:21 +03:00
|
|
|
|
2021-08-12 22:30:47 +03:00
|
|
|
prefix=/usr/local
|
|
|
|
confdir=/etc
|
|
|
|
systemd_dir=${DESTDIR}${confdir}/systemd/system
|
|
|
|
nginx_dir=${DESTDIR}${confdir}/nginx
|
|
|
|
bindir=${DESTDIR}${prefix}/bin
|
2021-04-30 05:28:21 +03:00
|
|
|
|
2021-08-29 00:40:36 +03:00
|
|
|
all: gen build
|
2021-04-30 05:28:21 +03:00
|
|
|
|
|
|
|
build:
|
|
|
|
@$(CC) build -ldflags='-s -w' -o $(BIN)
|
|
|
|
|
2021-08-12 22:30:47 +03:00
|
|
|
gen:
|
2021-04-30 05:28:21 +03:00
|
|
|
@$(CC) generate ./...
|
|
|
|
|
2021-08-12 22:30:47 +03:00
|
|
|
test:
|
2021-04-30 05:28:21 +03:00
|
|
|
@env $(ENV) $(CC) test ./... -cover -count 1
|
|
|
|
|
2021-06-15 04:03:31 +03:00
|
|
|
run: lint build
|
2021-04-30 05:28:21 +03:00
|
|
|
@clear
|
2021-08-29 00:40:36 +03:00
|
|
|
@env $(ENV) ./$(BIN) -v -demo -copy "2021 swurl@swurl.xyz" -url https://short.swurl.xyz -port 8080 -path /tmp/link -seed "secret"
|
2021-04-30 05:28:21 +03:00
|
|
|
|
|
|
|
dev:
|
|
|
|
@find . -type f | grep -E '(.*)\.(go|html)' | entr -cr make run
|
2021-06-15 04:03:31 +03:00
|
|
|
|
2021-08-12 22:30:47 +03:00
|
|
|
lint:
|
2021-06-15 04:03:31 +03:00
|
|
|
@golangci-lint run ./...
|
2021-08-12 22:30:47 +03:00
|
|
|
|
|
|
|
install-nginx:
|
|
|
|
@install -Dm644 doc/link.nginx.conf ${nginx_dir}/sites-available/link
|
|
|
|
|
|
|
|
install-systemd:
|
|
|
|
@install -Dm644 doc/link.service ${systemd_dir}/link.service
|
|
|
|
@install -Dm644 doc/link.conf ${DESTDIR}/${confdir}/link.conf
|
|
|
|
|
|
|
|
install-bin:
|
|
|
|
@install -Dm755 ${BIN} ${bindir}/${BIN}
|
|
|
|
|
|
|
|
install: build install-bin install-nginx install-systemd
|