From 7fffb463b4cea676978444cc88344b20ace767c7 Mon Sep 17 00:00:00 2001 From: quak Date: Sun, 2 Feb 2025 16:56:49 +0100 Subject: [PATCH] adjusted makefile to support multifile sources --- Makefile | 39 +++++++++++++++++++++++++++----------- git.md | 3 +-- linux.txt | 5 +++++ linux/commands.md | 4 ++-- linux.md => linux/linux.md | 1 + linux/permissions.md | 4 ++-- linux/setup.md | 7 ++++--- linux/terminal.md | 34 ++++++++++----------------------- 8 files changed, 53 insertions(+), 44 deletions(-) create mode 100644 linux.txt rename linux.md => linux/linux.md (99%) diff --git a/Makefile b/Makefile index 80e2716..60bcaf8 100644 --- a/Makefile +++ b/Makefile @@ -1,20 +1,37 @@ -OUT_DIR = ./output -SRC_FILES = $(wildcard *.md) -OUT_FILES = $(SRC_FILES:.md=.pdf) -TARGETS = $(SRC_FILES:.md=) +OUTPUT := output +SINGLE := $(wildcard *.md) +MULTI := $(wildcard *.txt) +TARGET_S := $(SINGLE:.md=) +TARGET_M := $(MULTI:.txt=) -PANDOC_OPT = --standalone +PANDOC_OPT = --standalone \ +-V linkcolor:blue \ +-V geometry:a4paper \ +-V geometry:margin=2cm \ +-V monofont="JetBrainsMono Nerd Font" \ +--pdf-engine=xelatex -.PHONY: all clean test +.PHONY: all clean out_dir test $(DIRECTORIES) -all: $(TARGETS) +all: $(TARGET_S) $(TARGETS_M) clean: - rm -f $(OUT_DIR)/* + rm -f $(OUTPUT)/* -$(TARGETS): %: $(OUT_DIR)/%.pdf +test: + @echo "test test :)" + @echo "$(MULTI)" + +$(TARGET_S): out_dir + @pandoc $(PANDOC_OPT) $@.md -o $(OUTPUT)/$@.pdf + +$(TARGET_M): out_dir + @pandoc $(PANDOC_OPT) $(shell cat $@.txt | xargs) -o $(OUTPUT)/$@.pdf + +out_dir: + @if [[ ! -d $(OUTPUT) ]]; then\ + mkdir $(OUTPUT);\ + fi -$(OUT_DIR)/%.pdf: %.md - pandoc $(PANDOC_OPT) $^ -o $@ diff --git a/git.md b/git.md index 7449d3a..931a1e6 100644 --- a/git.md +++ b/git.md @@ -3,7 +3,6 @@ ## Table of contents - [glossary](#glossary) -- [terminology](#terminology) - [branches](#branches) - [create a branch](#create-a-branch) - [submodules](#submodules) @@ -13,7 +12,7 @@ - [merge](#merge) - [rebase](#rebase) -## terminology +## glossary | term | description | | :--- | :---------- | diff --git a/linux.txt b/linux.txt new file mode 100644 index 0000000..8f62054 --- /dev/null +++ b/linux.txt @@ -0,0 +1,5 @@ +./linux/linux.md +./linux/setup.md +./linux/commands.md +./linux/permissions.md +./linux/terminal.md diff --git a/linux/commands.md b/linux/commands.md index 3439f5e..a1ab854 100644 --- a/linux/commands.md +++ b/linux/commands.md @@ -1,9 +1,9 @@ -# Linux commands +## Linux commands - [Linux commands](#linux-commands) - [combine commands with *xargs*](#combine-commands-with-xargs) -## combine commands with *xargs* +### combine commands with *xargs* Some commands (e.g. `chmod`) can't handle input via pipe and require the input as arguments. `xargs` takes the standard input as list of arguments seperated by spaces or newlines and executes the given command with the input parsed to a list of arguments. diff --git a/linux.md b/linux/linux.md similarity index 99% rename from linux.md rename to linux/linux.md index dee1805..e581118 100644 --- a/linux.md +++ b/linux/linux.md @@ -6,3 +6,4 @@ This document collects knowledge, tips and tricks on all things Linux, that don' - [Linux commands](linux/commands.md) - [Permissions](linux/permissions.md) - [Terminal](linux/terminal.md) + diff --git a/linux/permissions.md b/linux/permissions.md index 54574f7..986e77c 100644 --- a/linux/permissions.md +++ b/linux/permissions.md @@ -1,11 +1,11 @@ -# permissions +## permissions Linux permissions are ordered as follows: - owner - group - others -## octal permissions +### octal permissions In octal representation the actions (read, write, execute) have the values: - read = 4 diff --git a/linux/setup.md b/linux/setup.md index 5b5f6e4..5badcf5 100644 --- a/linux/setup.md +++ b/linux/setup.md @@ -1,7 +1,7 @@ -# Setup and Configuration +## Setup and Configuration -## Locales and Keyboard Layouts +### Locales and Keyboard Layouts Use `localectl` to display and configure locales and keyboard layout: @@ -11,7 +11,8 @@ localectl status ``` -### configure layout 'US intl. with deadkeys' +#### configure layout 'US intl. with deadkeys' + To configure `US intl. with deadkeys`, set the following values: ```sh X11 Layout: us diff --git a/linux/terminal.md b/linux/terminal.md index 75636fa..3fbbccd 100644 --- a/linux/terminal.md +++ b/linux/terminal.md @@ -1,16 +1,16 @@ -# Terminal +## Terminal - [ANSI escape sequences](#ansi-escape-sequences) -## ANSI escape sequences +### ANSI escape sequences Ansi escape sequences are used to format output in a terminal. They **are prefixed with an escape character**, which can be written in a few ways: - Ctrl-Key `^[` - Octal `\033` (\0 for octal) -- Hexadecimal `\x1B` (\x for hexadecimal) -- Unicode `\u001b +- Hexadecimal `\x1B` (\\x for hexadecimal) +- Unicode `\u001b` The sequences is started with a `[` followed by the command and arguments. Arguments are separated with `;`. **Sequences are terminated with `m`.** @@ -20,7 +20,7 @@ The sequences is started with a `[` followed by the command and arguments. Argum ``` For the following tables we define `ESC = \x1B` -### Text Style +#### Text Style | ESC Code Sequence | Reset Sequence | Description | | :---------------- | :------------- | :---------- | @@ -39,12 +39,12 @@ For the following tables we define `ESC = \x1B` > **Note:** Both dim and bold modes are reset with the `ESC[22m` sequence. The `ESC[21m` sequence is a non-specified sequence for double underline mode and only works in some terminals and is reset with `ESC[24m`. -### Color codes +#### Color codes Most terminals support 8 and 16 colors, as well as 256 (8-bit) colors. These colors are set by the user, but have commonly defined meanings. -#### 8-16 Colors +##### 8-16 Colors | Color Name | Foreground Color Code | Background Color Code | | :--------- | :-------------------- | :-------------------- | @@ -83,7 +83,7 @@ Terminals that support the [aixterm specification](https://sites.ualberta.ca/dep | Bright Cyan | `96` | `106` | | Bright White | `97` | `107` | -#### 256 Colors +##### 256 Colors The following escape codes tells the terminal to use the given color ID: @@ -104,7 +104,7 @@ The final 24 colors (232-255) are grayscale starting from a shade slighly lighte Some emulators interpret these steps as linear increments (`256 / 24`) on all three channels, although some emulators may explicitly define these values. -#### RGB Colors +##### RGB Colors More modern terminals supports [Truecolor](https://en.wikipedia.org/wiki/Color_depth#True_color_.2824-bit.29) (24-bit RGB), which allows you to set foreground and background colors using RGB. @@ -115,19 +115,5 @@ These escape sequences are usually not well documented. | `ESC[38;2;{r};{g};{b}m` | Set foreground color as RGB. | | `ESC[48;2;{r};{g};{b}m` | Set background color as RGB. | -> Note that `;38` and `;48` corresponds to the 16 color sequence and is interpreted by the terminal to set the foreground and background color respectively. Where as `;2` and `;5` sets the color format. - - -#### RGB Colors - -More modern terminals supports [Truecolor](https://en.wikipedia.org/wiki/Color_depth#True_color_.2824-bit.29) (24-bit RGB), which allows you to set foreground and background colors using RGB. - -These escape sequences are usually not well documented. - -| ESC Code Sequence | Description | -| :---------------------- | :--------------------------- | -| `ESC[38;2;{r};{g};{b}m` | Set foreground color as RGB. | -| `ESC[48;2;{r};{g};{b}m` | Set background color as RGB. | - -> Note that `;38` and `;48` corresponds to the 16 color sequence and is interpreted by the terminal to set the foreground and background color respectively. Where as `;2` and `;5` sets the color format. +> Note that `38` and `48` corresponds to the 16 color sequence and is interpreted by the terminal to set the foreground and background color respectively. Where as `;2` and `;5` sets the color format.