build(Makefile): rework help and clean
This commit is contained in:
parent
72f5a9fb37
commit
d55efd77f7
54
Makefile
54
Makefile
@ -1,34 +1,42 @@
|
|||||||
export SHELL=bash
|
export SHELL=bash
|
||||||
|
|
||||||
|
export CLEAN_DEPENDENCIES ?= false
|
||||||
|
|
||||||
.PHONY: help
|
.PHONY: help
|
||||||
# HELP: print out this help message
|
# HELP: print out this help message
|
||||||
help:
|
help:
|
||||||
@if [ -z "$$(which perl 2>/dev/null)" ] ; then \
|
docker compose run help
|
||||||
$(CONTAINER_FGRUN) .:/mnt 'debian:12.5' '/mnt/utils/makehelp.pl' '/mnt/Makefile' ; \
|
|
||||||
else \
|
|
||||||
utils/makehelp.pl Makefile ; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
# HELP: stop all running containers and remove all compilation results in the directory (but leave images including dependencies unharmed)
|
# HELP: clean compilation caches
|
||||||
clean:
|
clean: clean-frontend clean-backend ;
|
||||||
-rm -rf frontend/node_modules .npm .cache frontend/assets/icons frontend/assets/favicons frontend/static well-known config/manifest.json frontend/src/env.sass
|
|
||||||
-rm -rf .stack-work .stack-work.lock
|
|
||||||
-rm -rf bin .Dockerfile develop
|
|
||||||
-$(CONTAINER_COMMAND) container prune --force
|
|
||||||
.PHONY: clean-images
|
|
||||||
# HELP: stop all running containers and clean all images from local repositories
|
|
||||||
clean-images:
|
|
||||||
rm -rf develop
|
|
||||||
sleep 5
|
|
||||||
-$(CONTAINER_COMMAND) system prune --all --force --volumes
|
|
||||||
-$(CONTAINER_COMMAND) image prune --all --force
|
|
||||||
-$(CONTAINER_COMMAND) volume prune --force
|
|
||||||
.PHONY: clean-all
|
.PHONY: clean-all
|
||||||
# HELP: like clean but with full container, image, and volume prune
|
# HELP: clean everything, including dependency and image caches
|
||||||
clean-all: clean
|
clean-all: CLEAN_DEPENDENCIES = true
|
||||||
-rm -rf .stack
|
clean-all: clean ;
|
||||||
$(CONTAINER_COMMAND) system reset --force
|
|
||||||
|
.PHONY: clean-%
|
||||||
|
# HELP(clean-$SERVICE): invalidate caches for a given service. Supported services: frontend, backend.
|
||||||
|
clean-%:
|
||||||
|
$(MAKE) stop-$*
|
||||||
|
@$(MAKE) -- --clean-$*
|
||||||
|
@echo "Cleaned $* build files and binaries."
|
||||||
|
ifeq ("$(CLEAN_DEPENDENCIES)", "true")
|
||||||
|
@$(MAKE) -- --clean-$*-deps
|
||||||
|
@echo "Cleaned $* dependencies."
|
||||||
|
endif
|
||||||
|
--clean-frontend:
|
||||||
|
-rm -rf assets/icons assets/favicons
|
||||||
|
-rm -rf static well-known
|
||||||
|
--clean-frontend-deps:
|
||||||
|
-rm -rf frontend/node_modules
|
||||||
|
-rm -rf frontend/.npm
|
||||||
|
--clean-backend:
|
||||||
|
-rm -rf backend/.stack-work
|
||||||
|
-rm -rf bin/
|
||||||
|
--clean-backend-deps:
|
||||||
|
-rf -rf backend/.stack
|
||||||
|
|
||||||
|
|
||||||
.PHONY: release
|
.PHONY: release
|
||||||
# HELP: create, commit and push a new release
|
# HELP: create, commit and push a new release
|
||||||
|
|||||||
@ -1,4 +1,12 @@
|
|||||||
services:
|
services:
|
||||||
|
help:
|
||||||
|
image: docker.io/library/perl:stable
|
||||||
|
pull_policy: if_not_present
|
||||||
|
volumes:
|
||||||
|
- ./utils/makehelp.pl:/mnt/utils/makehelp.pl
|
||||||
|
- ./Makefile:/tmp/Makefile
|
||||||
|
command: perl /mnt/utils/makehelp.pl
|
||||||
|
|
||||||
frontend:
|
frontend:
|
||||||
build:
|
build:
|
||||||
context: ./frontend
|
context: ./frontend
|
||||||
@ -22,6 +30,7 @@ services:
|
|||||||
userns_mode: host
|
userns_mode: host
|
||||||
volumes:
|
volumes:
|
||||||
- ./backend:/fradrive
|
- ./backend:/fradrive
|
||||||
|
- ./bin:/usr/bin/fradrive
|
||||||
- ./assets:/fradrive/assets:ro
|
- ./assets:/fradrive/assets:ro
|
||||||
- ./static:/fradrive/static:ro
|
- ./static:/fradrive/static:ro
|
||||||
- ./well-known:/fradrive/well-known:ro
|
- ./well-known:/fradrive/well-known:ro
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user