From 829058aea45121a56fcfa9c3c463c0868d0e012d Mon Sep 17 00:00:00 2001 From: Stephan Barth Date: Mon, 23 Sep 2024 11:57:46 +0200 Subject: [PATCH 1/2] build(Makefile): containerized make help if no perl installed. --- Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 19703432c..9c6cb4424 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,11 @@ export DEV_PORT_HTTPS .PHONY: help # HELP: print out this help message help: - @utils/makehelp.pl Makefile + @if [ -z "$$(which perl 2>/dev/null)" ] ; then \ + $(CONTAINER_COMMAND) run -v .:/mnt 'debian:12.5' '/mnt/utils/makehelp.pl' '/mnt/Makefile' ; \ + else \ + utils/makehelp.pl Makefile ; \ + fi .PHONY: all # HELP: unfinished From 371cdf1e3e2b48f20a6764271e5874d8267d8895 Mon Sep 17 00:00:00 2001 From: Stephan Barth Date: Mon, 23 Sep 2024 12:21:18 +0200 Subject: [PATCH 2/2] build(Makefile): unified phonyness of '--'-targets. --- Makefile | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/Makefile b/Makefile index 9c6cb4424..dc8fcd8f5 100644 --- a/Makefile +++ b/Makefile @@ -23,6 +23,8 @@ export DEV_PORT_HTTPS ########################### ##### GENERAL TARGETS ##### +.PHONY: --% + .PHONY: help # HELP: print out this help message help: @@ -32,11 +34,6 @@ help: utils/makehelp.pl Makefile ; \ fi -.PHONY: all -# HELP: unfinished -all: - @echo "TODO" - .PHONY: clean # HELP: remove all compilation results in the directory but leave containers and images unharmed clean: @@ -105,11 +102,9 @@ test: test-frontend test-backend i18n-check %-frontend: FRADRIVE_SERVICE=frontend %-frontend: --image-build --containerized---%-frontend; -.PHONY: --%-frontend --%-frontend: --containerized---frontend-dependencies-frontend; # HELP(compile-frontend): compile frontend -.PHONY: --compile-frontend --compile-frontend: --frontend-dependencies npx -- webpack --progress $(WATCH) @@ -119,23 +114,19 @@ serve-frontend: CONTAINER_INTERACTIVE=-it serve-frontend: $(MAKE) -- --containerized---compile-frontend WATCH=--watch -# .PHONY: --serve-frontend # --serve-frontend: WATCH=--watch # --serve-frontend: --compile-frontend; # HELP(lint-frontend): lint frontend -.PHONY: --lint-frontend --lint-frontend: eslint.config.js npx -- eslint frontend/src $(FIX) @echo Hooray! There are no hints. # HELP(test-frontend): test frontend -.PHONY: --test-frontend --test-frontend: karma.conf.cjs @echo Karma frontend tests are currently broken after npm update and have therefor been temporarily disabled. # npx -- karma start --conf karma.conf.cjs $(WATCH) -.PHONY: --frontend-dependencies --frontend-dependencies: node_modules package.json package-lock.json assets; node_modules: package.json package-lock.json @@ -169,12 +160,10 @@ well-known: node_modules assets %-prod-backend: FRADRIVE_SERVICE=backend %-prod-backend: --image-build --containerized---%-prod-backend; -.PHONY: --%-dev-backend --%-dev-backend: FRADRIVE_SERVICE=backend --%-dev-backend: stackopts=--flag uniworx:dev --%-dev-backend: --image-build --containerized---%-backend; -.PHONY: --%-prod-backend --%-prod-backend: FRADRIVE_SERVICE=backend --%-prod-backend: stackopts=--flag uniworx:-dev --%-prod-backend: --image-build --containerized-%-backend; @@ -186,24 +175,20 @@ serve-backend: DEV_PORT_HTTP=`docker/backend/dev_port.pl 3000 | tee .dev-port-http`; \ DEV_PORT_HTTPS=`docker/backend/dev_port.pl 3443 | tee .dev-port-https`; \ $(MAKE) -- --containerized---serve-dev-backend DEV_PORT_HTTP=$${DEV_PORT_HTTP} DEV_PORT_HTTPS=$${DEV_PORT_HTTPS} -.PHONY: --serve-dev-backend --serve-dev-backend: start.sh DEV_PORT_HTTP=`cat .dev-port-http`; \ DEV_PORT_HTTPS=`cat .dev-port-https`; \ ./start.sh # HELP(compile-backend): compile backend -.PHONY: --compile-backend --compile-backend: stack build --fast --profile --library-profiling --executable-profiling --flag uniworx:-library-only --local-bin-path $$(pwd)/bin $(stackopts) # HELP(lint-backend): lint backend -.PHONY: --lint-backend --lint-backend: stack build --test --fast --flag uniworx:library-only uniworx:test:hlint $(stackopts) # HELP(test-backend): test backend -.PHONY: --test-backend --test-backend: stack build --test --coverage --fast --flag uniworx:library-only $(stackopts) @@ -215,7 +200,6 @@ serve-database: --containerized-database .PHONY: %-database %-database: $(MAKE) -- --containerized---$*-database-backend -.PHONY: --%-database --%-database: .stack SERVER_SESSION_ACID_FALLBACK=${SERVER_SESSION_ACID_FALLBACK:-true} ; \ AVSPASS=${AVSPASS:-nopasswordset} ; \ @@ -224,7 +208,6 @@ serve-database: --containerized-database .stack: stack.yaml stack.yaml.lock .stack: $(MAKE) -- --image-run---.stack -.PHONY: --.stack --.stack: stack.yaml stack.yaml.lock stack build --fast --only-dependencies $(stackopts) @@ -239,7 +222,6 @@ serve-database: --containerized-database ############################# ##### CONTAINER TARGETS ##### -.PHONY: --containerized-database --containerized-database: FRADRIVE_SERVICE=database # port forwarding is disabled in --network=host mode; nevertheless it is stated here for documentation reasons --containerized-database: CONTAINER_PORTS=-p 5432:5432/tcp @@ -248,13 +230,11 @@ serve-database: --containerized-database $(CONTAINER_COMMAND) run -it $(CONTAINER_PORTS) --name fradrive.$(FRADRIVE_SERVICE).$$(date +'%Y-%m-%dT%H-%M-%S') fradrive/$(FRADRIVE_SERVICE) ; \ fi -.PHONY: --containerized-%-frontend --containerized-%-frontend: FRADRIVE_SERVICE=frontend #--containerized-%-frontend: --image-build --image-run-%-frontend; --containerized-%-frontend: --image-build $(MAKE) -- --image-run-$*-frontend -.PHONY: --containerized-%-backend --containerized-%-backend: FRADRIVE_SERVICE=backend #--containerized-%-backend: --image-build --image-run-%-backend; --containerized-%-backend: CONTAINER_PORTS=-p 127.0.0.1:$(DEV_PORT_HTTP):3000/tcp -p 127.0.0.1:$(DEV_PORT_HTTPS):3443/tcp @@ -265,7 +245,6 @@ serve-database: --containerized-database # HELP: rebuild the stated docker image (frontend, backend, database instead of %) image-rebuild-%: $(MAKE) -- --image-build FRADRIVE_SERVICE=$* NO_CACHE=--no-cache -.PHONY: --image-build --image-build: rm -f .Dockerfile ln -s docker/$(FRADRIVE_SERVICE)/Dockerfile .Dockerfile @@ -278,7 +257,6 @@ image-rebuild-%: $(CONTAINER_COMMAND) build $(NO_CACHE) -v $(PWD):$${MOUNT_DIR} --env IN_CONTAINER=true --build-arg MOUNT_DIR=$${MOUNT_DIR} --build-arg PROJECT_DIR=$${PROJECT_DIR} --tag fradrive/$(FRADRIVE_SERVICE) --file $(PWD)/.Dockerfile ; \ fi -.PHONY: --image-run-% --image-run-%: MOUNT_DIR=/mnt/fradrive; \ if [ "$(IN_CONTAINER)" == "true" ] ; then \ @@ -294,7 +272,6 @@ image-rebuild-%: .PHONY: i18n-check # HELP: check internationalization i18n-check: --image-run---i18n-check -.PHONY: --i18n-check --i18n-check: ./missing-translations.sh @echo No missing translations.