From a3dc9f64ecf7cd64ef84c08aaa249614cade7525 Mon Sep 17 00:00:00 2001 From: Sarah Vaupel Date: Sun, 20 Oct 2024 02:06:28 +0200 Subject: [PATCH] build(Makefile): remove debris and restructure --- Makefile | 82 ++++++++++++++++++++++++++------------------------------ 1 file changed, 38 insertions(+), 44 deletions(-) diff --git a/Makefile b/Makefile index ce3603e3c..78b183926 100644 --- a/Makefile +++ b/Makefile @@ -100,7 +100,9 @@ start: new-develop start-database start-memcached start-minio start-frontend sta .PHONY: compile # HELP: compile frontend and backend -compile: compile-frontend compile-backend; +compile: + $(MAKE) compile-frontend + $(MAKE) compile-backend .PHONY: lint # HELP: lint frontend and backend @@ -121,7 +123,10 @@ test: test-frontend test-backend i18n-check; %-frontend: FRADRIVE_SERVICE=frontend %-frontend: --image-build --containerized---%-frontend; ---%-frontend: --containerized-static-frontend --containerized-well-known-frontend; +--%-frontend: --containerized-static-frontend --containerized-well-known-frontend + +--start-frontend: static + npm run start # HELP(compile-frontend): compile frontend --compile-frontend: static well-known; @@ -164,6 +169,15 @@ well-known: static; %-backend: FRADRIVE_SERVICE=backend %-backend: --image-build --containerized---%-backend; +--start-backend: start.sh + DEV_PORT_HTTP=`cat $(CONTAINER_FILE) | grep 'DEV_PORT_HTTP=' | sed 's/DEV_PORT_HTTP=//'`; \ + DEV_PORT_HTTPS=`cat $(CONTAINER_FILE) | grep 'DEV_PORT_HTTPS=' | sed 's/DEV_PORT_HTTPS=//'`; \ + ./start.sh +--start-hoogle-backend: + HOOGLE_PORT=`cat $(CONTAINER_FILE) | grep 'HOOGLE_PORT=' | sed 's/HOOGLE_PORT=//'` ; \ + echo "${HOOGLE_PORT}" ; \ + stack --work-dir .stack-work-doc hoogle -- -server --local --port $${HOOGLE_PORT} + # HELP(compile-backend): compile backend --compile-backend: stack build --fast --work-dir .stack-work-build --profile --library-profiling --executable-profiling --flag uniworx:-library-only --local-bin-path $$(pwd)/bin $(stackopts) @@ -280,26 +294,8 @@ image-rebuild-%: fi \ fi -DATE := $(shell date +'%Y-%m-%dT%H-%M-%S') -SET_DEVELOP = $(eval DEVELOP=develop/`ls -1 develop | tail -n1`) -NEW_DEVELOP = $(eval DEVELOP=develop/$$(DATE)) - -.PHONY: new-develop -new-develop: - $(NEW_DEVELOP) - mkdir -p $(DEVELOP) - $(MAKE) develop/.current -.PHONY: --develop ---develop: - if ! [[ -e develop ]]; then \ - $(MAKE) new-develop; \ - fi - $(MAKE) develop/.current -.PHONY: develop/.current -develop/.current: - $(SET_DEVELOP) - echo "$(DEVELOP)" > develop/.current +# TODO: move starts below to respective entries, or leave together? start-database: BASE_PORTS = "PGPORT=5432" start-database: SINGLETON = true @@ -347,29 +343,6 @@ start-%: --develop echo "$(PORTS)" | sed 's/ /\n/g' > $${CONTAINER_FILE} ; \ $(MAKE) -- --containerized---start-$* CONTAINER_FILE=$${CONTAINER_FILE} ---start-backend: start.sh - DEV_PORT_HTTP=`cat $(CONTAINER_FILE) | grep 'DEV_PORT_HTTP=' | sed 's/DEV_PORT_HTTP=//'`; \ - DEV_PORT_HTTPS=`cat $(CONTAINER_FILE) | grep 'DEV_PORT_HTTPS=' | sed 's/DEV_PORT_HTTPS=//'`; \ - ./start.sh ---start-hoogle-backend: - HOOGLE_PORT=`cat $(CONTAINER_FILE) | grep 'HOOGLE_PORT=' | sed 's/HOOGLE_PORT=//'` ; \ - echo "${HOOGLE_PORT}" ; \ - stack --work-dir .stack-work-doc hoogle -- -server --local --port $${HOOGLE_PORT} - ---start-frontend: static - npm run start - -# --start-database: docker/database/initdb.sh docker/database/pg_hba.conf docker/database/postgresql.conf docker/database/schema.sql; -# ./utils/watchrun.sh "$(CONTAINER_FILE)" - -# TODO: mkdir inside develop/$(DATE)/minio instead of mktemp -# TODO: remove dir in stop-minio -#--containerized---start-minio: -# MINIO_DIR=`mktemp` ; \ -# echo "MINIO_DIR=$${MINIO_DIR}" > $(DEVELOP)/minio ; \ -# CONTAINER_ID=`$(CONTAINER_RUN) -v $(PWD):/mnt/fradrive --file docker/minio/Dockerfile -- (server $${MINIO_DIR})` ; \ -# echo "CONTAINER_ID=$${CONTAINER_ID}" >> $(DEVELOP)/minio - .PHONY: stop # HELP: stop all currently running develop instances stop: @@ -396,6 +369,27 @@ log-%: # TODO: move targets below to better location +DATE := $(shell date +'%Y-%m-%dT%H-%M-%S') + +SET_DEVELOP = $(eval DEVELOP=develop/`ls -1 develop | tail -n1`) +NEW_DEVELOP = $(eval DEVELOP=develop/$$(DATE)) + +.PHONY: new-develop +new-develop: + $(NEW_DEVELOP) + mkdir -p $(DEVELOP) + $(MAKE) develop/.current +.PHONY: --develop +--develop: + if ! [[ -e develop ]]; then \ + $(MAKE) new-develop; \ + fi + $(MAKE) develop/.current +.PHONY: develop/.current +develop/.current: + $(SET_DEVELOP) + echo "$(DEVELOP)" > develop/.current + # Some convenience aliases: .PHONY: hoogle # HELP: alias for start-hoogle