hodu/Makefile

89 lines
2.2 KiB
Makefile
Raw Permalink Normal View History

2024-12-16 15:19:01 +09:00
# make
# make GOARCH=386
# make GOARCH=amd64
# make GOOS=linux GOARCH=mips
#
# 'go tool dist list' for available os and architextures
NAME=hodu
VERSION=1.0.0
2024-11-23 12:41:49 +09:00
SRCS=\
client.go \
client-ctl.go \
2025-01-28 00:44:02 +09:00
client-metrics.go \
client-peer.go \
2024-11-23 12:41:49 +09:00
hodu.go \
hodu.pb.go \
hodu_grpc.pb.go \
2025-01-28 00:44:02 +09:00
jwt.go \
2024-11-23 12:41:49 +09:00
packet.go \
server.go \
server-ctl.go \
2025-01-28 00:44:02 +09:00
server-metrics.go \
server-peer.go \
server-proxy.go \
2024-12-27 14:43:44 +09:00
system.go \
transform.go \
2024-12-13 02:25:27 +09:00
DATA = \
xterm.css \
xterm.js \
xterm-addon-fit.js \
xterm.html
CMD_DATA=\
cmd/rsa.key \
cmd/tls.crt \
cmd/tls.key
CMD_SRCS=\
cmd/config.go \
cmd/logger.go \
cmd/main.go
all: $(NAME)
2024-11-23 12:41:49 +09:00
2024-12-13 02:25:27 +09:00
$(NAME): $(DATA) $(SRCS) $(CMD_DATA) $(CMD_SRCS)
2024-12-27 14:43:44 +09:00
##CGO_ENABLED=0 go build -x -ldflags "-X 'main.HODU_NAME=$(NAME)' -X 'main.HODU_VERSION=$(VERSION)'" -o $@ $(CMD_SRCS)
CGO_ENABLED=1 go build -x -ldflags "-X 'main.HODU_NAME=$(NAME)' -X 'main.HODU_VERSION=$(VERSION)'" -o $@ $(CMD_SRCS)
##CGO_ENABLED=1 go build -x -ldflags "-X 'main.HODU_NAME=$(NAME)' -X 'main.HODU_VERSION=$(VERSION)' -linkmode external -extldflags=-static" -o $@ $(CMD_SRCS)
2024-11-23 12:41:49 +09:00
clean:
go clean -x -i
rm -f $(NAME)
2025-01-28 00:44:02 +09:00
test:
go test -x
hodu.pb.go: hodu.proto
protoc --go_out=. --go_opt=paths=source_relative \
--go-grpc_out=. --go-grpc_opt=paths=source_relative \
hodu.proto
hodu_grpc.pb.go: hodu.proto
protoc --go_out=. --go_opt=paths=source_relative \
--go-grpc_out=. --go-grpc_opt=paths=source_relative \
hodu.proto
2024-11-23 12:41:49 +09:00
2024-12-13 02:25:27 +09:00
xterm.js:
curl -L -o "$@" https://cdn.jsdelivr.net/npm/@xterm/xterm/lib/xterm.min.js
xterm-addon-fit.js:
curl -L -o "$@" https://cdn.jsdelivr.net/npm/xterm-addon-fit/lib/xterm-addon-fit.min.js
xterm.css:
curl -L -o "$@" https://cdn.jsdelivr.net/npm/@xterm/xterm/css/xterm.min.css
sed -r -i 's|^/\*# sourceMappingURL=/.+ \*/$$||g' "$@"
2024-12-13 02:25:27 +09:00
cmd/tls.crt:
openssl req -x509 -newkey rsa:4096 -keyout cmd/tls.key -out cmd/tls.crt -sha256 -days 36500 -nodes -subj "/CN=$(NAME)" --addext "subjectAltName=DNS:$(NAME),IP:10.0.0.1,IP:::1"
cmd/tls.key:
openssl req -x509 -newkey rsa:4096 -keyout cmd/tls.key -out cmd/tls.crt -sha256 -days 36500 -nodes -subj "/CN=$(NAME)" --addext "subjectAltName=DNS:$(NAME),IP:10.0.0.1,IP:::1"
cmd/rsa.key:
openssl genrsa -traditional -out cmd/rsa.key 2048
2025-01-28 00:44:02 +09:00
.PHONY: clean test