mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-12-25 04:49:05 +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
|
TARGET = ./cc-backend
|
||||||
VAR = ./var
|
VAR = ./var
|
||||||
DB = ./var/job.db
|
|
||||||
FRONTEND = ./web/frontend
|
FRONTEND = ./web/frontend
|
||||||
VERSION = 1
|
VERSION = 1
|
||||||
GIT_HASH := $(shell git rev-parse --short HEAD || echo 'development')
|
GIT_HASH := $(shell git rev-parse --short HEAD || echo 'development')
|
||||||
CURRENT_TIME = $(shell date +"%Y-%m-%d:T%H:%M:%S")
|
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}'
|
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 \
|
SVELTE_COMPONENTS = status \
|
||||||
analysis \
|
analysis \
|
||||||
node \
|
node \
|
||||||
@ -28,14 +31,20 @@ SVELTE_SRC = $(wildcard $(FRONTEND)/src/*.svelte) \
|
|||||||
|
|
||||||
.NOTPARALLEL:
|
.NOTPARALLEL:
|
||||||
|
|
||||||
$(TARGET): $(VAR) $(DB) $(SVELTE_TARGETS)
|
$(TARGET): $(VAR) $(SVELTE_TARGETS)
|
||||||
$(info ===> BUILD cc-backend)
|
$(info ===> BUILD cc-backend)
|
||||||
@go build -ldflags=${LD_FLAGS} ./cmd/cc-backend
|
@go build -ldflags=${LD_FLAGS} ./cmd/cc-backend
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(info ===> CLEAN)
|
$(info ===> CLEAN)
|
||||||
@go clean
|
@go clean
|
||||||
@rm $(TARGET)
|
@rm -f $(TARGET)
|
||||||
|
|
||||||
|
distclean:
|
||||||
|
@$(MAKE) clean
|
||||||
|
$(info ===> DISTCLEAN)
|
||||||
|
@rm -rf $(FRONTEND)/node_modules
|
||||||
|
@rm -rf $(VAR)
|
||||||
|
|
||||||
test:
|
test:
|
||||||
$(info ===> TESTING)
|
$(info ===> TESTING)
|
||||||
@ -51,9 +60,6 @@ $(VAR):
|
|||||||
@mkdir $(VAR)
|
@mkdir $(VAR)
|
||||||
cd web/frontend && npm install
|
cd web/frontend && npm install
|
||||||
|
|
||||||
$(DB):
|
|
||||||
./cc-backend --migrate-db
|
|
||||||
|
|
||||||
$(SVELTE_TARGETS): $(SVELTE_SRC)
|
$(SVELTE_TARGETS): $(SVELTE_SRC)
|
||||||
$(info ===> BUILD frontend)
|
$(info ===> BUILD frontend)
|
||||||
cd web/frontend && npm run build
|
cd web/frontend && npm run build
|
||||||
|
Loading…
Reference in New Issue
Block a user