mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-11-10 08:57:25 +01:00
Improve Makefile
* Add check for required executables * Remove defunct DB target * Add distclean target
This commit is contained in:
parent
3e2a462b38
commit
ce8eb86569
18
Makefile
18
Makefile
@ -1,12 +1,15 @@
|
||||
TARGET = ./cc-backend
|
||||
VAR = ./var
|
||||
DB = ./var/job.db
|
||||
FRONTEND = ./web/frontend
|
||||
VERSION = 1
|
||||
GIT_HASH := $(shell git rev-parse --short HEAD || echo 'development')
|
||||
CURRENT_TIME = $(shell date +"%Y-%m-%d:T%H:%M:%S")
|
||||
LD_FLAGS = '-s -X main.buildTime=${CURRENT_TIME} -X main.version=${VERSION} -X main.hash=${GIT_HASH}'
|
||||
|
||||
EXECUTABLES = go npm
|
||||
K := $(foreach exec,$(EXECUTABLES),\
|
||||
$(if $(shell which $(exec)),some string,$(error "No $(exec) in PATH")))
|
||||
|
||||
SVELTE_COMPONENTS = status \
|
||||
analysis \
|
||||
node \
|
||||
@ -28,14 +31,20 @@ SVELTE_SRC = $(wildcard $(FRONTEND)/src/*.svelte) \
|
||||
|
||||
.NOTPARALLEL:
|
||||
|
||||
$(TARGET): $(VAR) $(DB) $(SVELTE_TARGETS)
|
||||
$(TARGET): $(VAR) $(SVELTE_TARGETS)
|
||||
$(info ===> BUILD cc-backend)
|
||||
@go build -ldflags=${LD_FLAGS} ./cmd/cc-backend
|
||||
|
||||
clean:
|
||||
$(info ===> CLEAN)
|
||||
@go clean
|
||||
@rm $(TARGET)
|
||||
@rm -f $(TARGET)
|
||||
|
||||
distclean:
|
||||
@$(MAKE) clean
|
||||
$(info ===> DISTCLEAN)
|
||||
@rm -rf $(FRONTEND)/node_modules
|
||||
@rm -rf $(VAR)
|
||||
|
||||
test:
|
||||
$(info ===> TESTING)
|
||||
@ -51,9 +60,6 @@ $(VAR):
|
||||
@mkdir $(VAR)
|
||||
cd web/frontend && npm install
|
||||
|
||||
$(DB):
|
||||
./cc-backend --migrate-db
|
||||
|
||||
$(SVELTE_TARGETS): $(SVELTE_SRC)
|
||||
$(info ===> BUILD frontend)
|
||||
cd web/frontend && npm run build
|
||||
|
Loading…
Reference in New Issue
Block a user