2022-09-26 11:22:34 +02:00
|
|
|
TARGET = ./cc-backend
|
|
|
|
VAR = ./var
|
2023-05-11 09:39:23 +02:00
|
|
|
CFG = config.json .env
|
2022-09-26 11:22:34 +02:00
|
|
|
FRONTEND = ./web/frontend
|
2024-12-19 06:34:35 +01:00
|
|
|
VERSION = 1.4.2
|
2022-09-26 13:16:04 +02:00
|
|
|
GIT_HASH := $(shell git rev-parse --short HEAD || echo 'development')
|
|
|
|
CURRENT_TIME = $(shell date +"%Y-%m-%d:T%H:%M:%S")
|
2023-06-16 14:31:09 +02:00
|
|
|
LD_FLAGS = '-s -X main.date=${CURRENT_TIME} -X main.version=${VERSION} -X main.commit=${GIT_HASH}'
|
2022-09-26 11:22:34 +02:00
|
|
|
|
2023-05-04 11:34:20 +02:00
|
|
|
EXECUTABLES = go npm
|
|
|
|
K := $(foreach exec,$(EXECUTABLES),\
|
|
|
|
$(if $(shell which $(exec)),some string,$(error "No $(exec) in PATH")))
|
|
|
|
|
2022-09-26 11:22:34 +02:00
|
|
|
SVELTE_COMPONENTS = status \
|
|
|
|
analysis \
|
|
|
|
node \
|
|
|
|
systems \
|
|
|
|
job \
|
|
|
|
list \
|
|
|
|
user \
|
|
|
|
jobs \
|
|
|
|
header
|
|
|
|
|
|
|
|
SVELTE_TARGETS = $(addprefix $(FRONTEND)/public/build/,$(addsuffix .js, $(SVELTE_COMPONENTS)))
|
2024-08-22 14:46:27 +02:00
|
|
|
SVELTE_SRC = $(wildcard $(FRONTEND)/src/*.svelte) \
|
|
|
|
$(wildcard $(FRONTEND)/src/*.js) \
|
|
|
|
$(wildcard $(FRONTEND)/src/analysis/*.svelte) \
|
|
|
|
$(wildcard $(FRONTEND)/src/config/*.svelte) \
|
|
|
|
$(wildcard $(FRONTEND)/src/config/admin/*.svelte) \
|
|
|
|
$(wildcard $(FRONTEND)/src/config/user/*.svelte) \
|
|
|
|
$(wildcard $(FRONTEND)/src/generic/*.js) \
|
|
|
|
$(wildcard $(FRONTEND)/src/generic/*.svelte) \
|
|
|
|
$(wildcard $(FRONTEND)/src/generic/filters/*.svelte) \
|
|
|
|
$(wildcard $(FRONTEND)/src/generic/plots/*.svelte) \
|
|
|
|
$(wildcard $(FRONTEND)/src/generic/joblist/*.svelte) \
|
|
|
|
$(wildcard $(FRONTEND)/src/generic/helper/*.svelte) \
|
|
|
|
$(wildcard $(FRONTEND)/src/generic/select/*.svelte) \
|
|
|
|
$(wildcard $(FRONTEND)/src/header/*.svelte) \
|
|
|
|
$(wildcard $(FRONTEND)/src/job/*.svelte)
|
2022-09-26 11:22:34 +02:00
|
|
|
|
2024-06-28 15:41:11 +02:00
|
|
|
.PHONY: clean distclean test tags frontend swagger graphql $(TARGET)
|
2022-09-26 11:22:34 +02:00
|
|
|
|
|
|
|
.NOTPARALLEL:
|
|
|
|
|
2023-05-11 09:39:23 +02:00
|
|
|
$(TARGET): $(VAR) $(CFG) $(SVELTE_TARGETS)
|
2022-09-26 11:22:34 +02:00
|
|
|
$(info ===> BUILD cc-backend)
|
2022-09-26 13:16:04 +02:00
|
|
|
@go build -ldflags=${LD_FLAGS} ./cmd/cc-backend
|
2022-09-26 11:22:34 +02:00
|
|
|
|
2023-06-20 07:55:57 +02:00
|
|
|
frontend:
|
|
|
|
$(info ===> BUILD frontend)
|
|
|
|
cd web/frontend && npm install && npm run build
|
|
|
|
|
2024-06-26 05:41:42 +02:00
|
|
|
swagger:
|
|
|
|
$(info ===> GENERATE swagger)
|
|
|
|
@go run github.com/swaggo/swag/cmd/swag init -d ./internal/api,./pkg/schema -g rest.go -o ./api
|
|
|
|
@mv ./api/docs.go ./internal/api/docs.go
|
|
|
|
|
2024-06-28 15:41:11 +02:00
|
|
|
graphql:
|
|
|
|
$(info ===> GENERATE graphql)
|
|
|
|
@go run github.com/99designs/gqlgen
|
|
|
|
|
2022-09-26 11:22:34 +02:00
|
|
|
clean:
|
|
|
|
$(info ===> CLEAN)
|
|
|
|
@go clean
|
2023-05-04 11:34:20 +02:00
|
|
|
@rm -f $(TARGET)
|
|
|
|
|
|
|
|
distclean:
|
|
|
|
@$(MAKE) clean
|
|
|
|
$(info ===> DISTCLEAN)
|
|
|
|
@rm -rf $(FRONTEND)/node_modules
|
|
|
|
@rm -rf $(VAR)
|
2022-09-26 11:22:34 +02:00
|
|
|
|
|
|
|
test:
|
|
|
|
$(info ===> TESTING)
|
2023-05-11 16:17:17 +02:00
|
|
|
@go clean -testcache
|
2022-09-26 11:22:34 +02:00
|
|
|
@go build ./...
|
|
|
|
@go vet ./...
|
|
|
|
@go test ./...
|
|
|
|
|
2023-03-02 14:11:06 +01:00
|
|
|
tags:
|
|
|
|
$(info ===> TAGS)
|
|
|
|
@ctags -R
|
|
|
|
|
2022-09-26 11:22:34 +02:00
|
|
|
$(VAR):
|
|
|
|
@mkdir $(VAR)
|
2023-05-11 09:39:23 +02:00
|
|
|
|
|
|
|
config.json:
|
|
|
|
$(info ===> Initialize config.json file)
|
|
|
|
@cp configs/config.json config.json
|
|
|
|
|
|
|
|
.env:
|
|
|
|
$(info ===> Initialize .env file)
|
|
|
|
@cp configs/env-template.txt .env
|
2023-02-25 08:17:58 +01:00
|
|
|
|
|
|
|
$(SVELTE_TARGETS): $(SVELTE_SRC)
|
|
|
|
$(info ===> BUILD frontend)
|
2023-05-11 09:39:23 +02:00
|
|
|
cd web/frontend && npm install && npm run build
|