Compare commits
5 Commits
11a37dd86e
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
d8c6e25376 | ||
|
1adff08581 | ||
|
d12f68d001 | ||
|
5ea0bff54e | ||
|
4b3d9840ef |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -60,3 +60,6 @@ Thumbs.db
|
||||
# Editor-spezifische Dateien (optional)
|
||||
*.swp
|
||||
*.swo
|
||||
|
||||
#config files
|
||||
.env
|
||||
|
69
Makefile
69
Makefile
@@ -1,6 +1,13 @@
|
||||
.PHONY: help build-thesis build-expose clean clean-paper
|
||||
.PHONY: help build-thesis build-expose clean clean-paper check-variables set-shell set-directory
|
||||
.DEFAULT_GOAL := help
|
||||
|
||||
# --- Load .env if it exists (no error if missing) ---
|
||||
-include .env
|
||||
|
||||
# --- Set default directory if not defined ---
|
||||
DIRECTORY ?= $(shell pwd)
|
||||
|
||||
|
||||
# Variables
|
||||
LATEX_DIR = paper
|
||||
LATEX_CONTAINER = texlive/texlive:TL2024-historic
|
||||
@@ -11,13 +18,14 @@ EXPOSE_SRC = expose.tex
|
||||
# Colors
|
||||
GREEN := \033[1;32m
|
||||
WHITE := \033[0;37m
|
||||
GRAY := \033[0;37m
|
||||
RESET := \033[0m
|
||||
|
||||
help: ## Show this help message
|
||||
@echo "Available commands:"
|
||||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
|
||||
| awk 'BEGIN {FS = ":.*?## "}; {printf " $(GREEN)make %-12s$(RESET) $(WHITE)%s$(RESET)\n", $$1, $$2}' \
|
||||
| sort
|
||||
@grep -E "^[a-zA-Z_-]+:.*?## .*$$" "$(firstword $(MAKEFILE_LIST))" \
|
||||
| sort \
|
||||
| awk -v GREEN="$(GREEN)" -v RESET="$(RESET)" -v GRAY="$(GRAY)" 'BEGIN {FS=":.*?## "} {printf " %smake %-15s%s %s%s\n", GREEN, $$1, RESET, GRAY, $$2}'
|
||||
|
||||
clean: clean-paper ## Remove all auxiliary files (calls clean-paper)
|
||||
|
||||
@@ -33,10 +41,53 @@ clean-paper: ## Remove LaTeX auxiliary files from the 'paper' directory
|
||||
$(LATEX_DIR)/*.bcf \
|
||||
$(LATEX_DIR)/*.run.xml
|
||||
|
||||
build-thesis: clean-paper ## Build the main thesis PDF (dokumentation.tex) using Docker and latexmk
|
||||
@docker run --rm -v $(PWD)/$(LATEX_DIR):/data -w /data $(LATEX_CONTAINER) \
|
||||
latexmk -pdf $(THESIS_SRC)
|
||||
build-thesis: clean-paper ## Build the main thesis PDF (dokumentation.tex) using DockerJa, and latexmk
|
||||
@docker run --rm -v "$(DIRECTORY)/$(LATEX_DIR):/data" -w //data $(LATEX_CONTAINER) latexmk -pdf $(THESIS_SRC)
|
||||
|
||||
build-expose: clean-paper ## Build the expose PDF (expose.tex) using Docker and latexmk
|
||||
@docker run --rm -v $(PWD)/$(LATEX_DIR):/data -w /data $(LATEX_CONTAINER) \
|
||||
latexmk -pdf $(EXPOSE_SRC)
|
||||
@docker run --rm -v "$(DIRECTORY)/$(LATEX_DIR):/data" -w //data $(LATEX_CONTAINER) latexmk -pdf $(EXPOSE_SRC)
|
||||
|
||||
set-shell: ## Set the shell Make should use
|
||||
ifeq ($(LOCAL_SHELL),)
|
||||
@echo "Usage: make set-shell LOCAL_SHELL=<path to shell> [LOCAL_SHELLFLAGS='<flags>']"
|
||||
@echo "Example: make set-shell LOCAL_SHELL=\"C:/Progra~1/Git/usr/bin/bash.exe\" LOCAL_SHELLFLAGS=\"--login -i -c\""
|
||||
else
|
||||
@echo "LOCAL_SHELL parameter detected, updating .env..."
|
||||
@if grep -q '^SHELL=' .env 2>/dev/null; then \
|
||||
sed -i 's|^SHELL=.*|SHELL=$(LOCAL_SHELL)|' .env; \
|
||||
echo "Updated SHELL in .env"; \
|
||||
else \
|
||||
echo "SHELL=$(LOCAL_SHELL)" >> .env; \
|
||||
echo "Added SHELL to .env"; \
|
||||
fi
|
||||
ifneq ($(LOCAL_SHELLFLAGS),)
|
||||
@echo "LOCAL_SHELLFLAGS parameter detected, updating .env..."
|
||||
@if grep -q '^SHELLFLAGS=' .env 2>/dev/null; then \
|
||||
sed -i 's|^SHELLFLAGS=.*|SHELLFLAGS=$(LOCAL_SHELLFLAGS)|' .env; \
|
||||
echo "Updated SHELLFLAGS in .env"; \
|
||||
else \
|
||||
echo "SHELLFLAGS=$(LOCAL_SHELLFLAGS)" >> .env; \
|
||||
echo "Added SHELLFLAGS to .env"; \
|
||||
fi
|
||||
endif
|
||||
endif
|
||||
|
||||
set-directory: ## Set the project directory Make should use
|
||||
ifeq ($(LOCAL_DIRECTORY),)
|
||||
@echo "Usage: make set-directory LOCAL_DIRECTORY=<path to project>"
|
||||
else
|
||||
@echo "LOCAL_DIRECTORY parameter detected, updating .env..."
|
||||
@if grep -q '^DIRECTORY=' .env 2>/dev/null; then \
|
||||
sed -i 's|^DIRECTORY=.*|DIRECTORY=$(LOCAL_DIRECTORY)|' .env; \
|
||||
echo "Updated DIRECTORY in .env"; \
|
||||
else \
|
||||
echo "DIRECTORY=$(LOCAL_DIRECTORY)" >> .env; \
|
||||
echo "Added DIRECTORY to .env"; \
|
||||
fi
|
||||
endif
|
||||
|
||||
check-variables: ## Checks which variables Make is using (SHELL, SHELLFLAGS, DIRECTORY)
|
||||
@echo "---- Makefile Variables Check ----"
|
||||
@echo "SHELL = $(SHELL)"
|
||||
@echo "SHELLFLAGS = $(SHELLFLAGS)"
|
||||
@echo "DIRECTORY = $(DIRECTORY)"
|
41
README.md
41
README.md
@@ -27,6 +27,47 @@ make build-thesis
|
||||
make build-expose
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Windwows-specific notes
|
||||
|
||||
- On **Windows**, you may need to adjust the shell used by Make, especially if you are running PowerShell.
|
||||
- It is recommended to use **Git Bash** as the shell for full compatibility.
|
||||
- You may also need to adjust the `DIRECTORY` variable in `.env` if Docker requires a Windows-style path (e.g., `C:/Users/...`).
|
||||
|
||||
|
||||
#### Setting shell and directory
|
||||
|
||||
You can set the shell and project directory with Make targets:
|
||||
```
|
||||
make set-shell LOCAL_SHELL="C:/Program Files/Git/usr/bin/bash.exe" LOCAL_SHELLFLAGS="--login -i -c"
|
||||
make set-directory LOCAL_DIRECTORY="C:/users/admin/project"
|
||||
```
|
||||
- `set-shell` updates `SHELL` and `SHELLFLAGS` in `.env`.
|
||||
You can run it like this:
|
||||
- `set-directory` updates `DIRECTORY` in `.env`.
|
||||
|
||||
#### Checking variables
|
||||
|
||||
You can check which variables Make is using:
|
||||
```
|
||||
make check-variables
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Manual `.env` setup
|
||||
|
||||
If nothing works yet, you can manually create or edit `.env` in the project root:
|
||||
|
||||
```text
|
||||
SHELL=C:/Program Files/Git/usr/bin/bash.exe
|
||||
SHELLFLAGS=--login -i -c
|
||||
DIRECTORY=C:/users/admin/project
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Project Structure
|
||||
<pre>
|
||||
.
|
||||
|
Reference in New Issue
Block a user