2024-02-11 21:13:53 +00:00
|
|
|
# C compiler
|
2024-03-24 01:45:02 +00:00
|
|
|
# CC=gcc # alternatives: tcc, clang, zig cc
|
|
|
|
CC=tcc
|
2023-03-28 16:59:38 +00:00
|
|
|
|
2024-02-11 21:13:53 +00:00
|
|
|
# Dependencies
|
2024-03-12 16:37:28 +00:00
|
|
|
DEPS='webkit2gtk-4.1'
|
2023-03-28 16:59:38 +00:00
|
|
|
INCS=`pkg-config --cflags ${DEPS}`
|
|
|
|
LIBS=`pkg-config --libs ${DEPS}`
|
|
|
|
|
2024-02-11 21:13:53 +00:00
|
|
|
# Code
|
2024-03-14 18:47:36 +00:00
|
|
|
SRC=rosenrot.c
|
2023-03-28 17:11:18 +00:00
|
|
|
|
2024-03-24 01:24:38 +00:00
|
|
|
## Runtime files
|
|
|
|
MAINTAINER_CACHE_DIR=/home/nuno/.cache/rosenrot
|
|
|
|
USER_CACHE_DIR=/home/`whoami`/.cache/rosenrot
|
2023-03-28 17:11:18 +00:00
|
|
|
|
2024-03-24 01:24:38 +00:00
|
|
|
build: $(SRC) user_cache
|
2024-03-24 00:51:55 +00:00
|
|
|
$(CC) $(INCS) $(SRC) -o rosenrot $(LIBS) $(ADBLOCK)
|
2023-05-09 02:48:22 +00:00
|
|
|
|
2024-03-14 22:31:04 +00:00
|
|
|
user_cache:
|
2024-03-15 00:05:56 +00:00
|
|
|
@if [ `id -u` -eq 0 ]; then echo "can't run make user_cache with sudo, because USER_CACHE_DIR would be /home/root/.cache"; return 1; fi
|
|
|
|
@echo "# Create user cache"
|
2024-03-14 22:31:04 +00:00
|
|
|
mkdir -p $(USER_CACHE_DIR)
|
|
|
|
find . -type f -not -path "*.git*" -not -path "*makefile*" -exec \
|
|
|
|
sed -i "s|$(MAINTAINER_CACHE_DIR)|$(USER_CACHE_DIR)|g" {} +
|
2024-03-15 00:05:56 +00:00
|
|
|
@echo
|
2024-03-14 22:31:04 +00:00
|
|
|
|
2024-03-24 00:51:55 +00:00
|
|
|
install: rosenrot
|
2024-03-14 18:47:36 +00:00
|
|
|
cp -f rosenrot /usr/bin
|
2023-03-28 16:59:38 +00:00
|
|
|
|
2024-03-24 01:45:02 +00:00
|
|
|
depsdebian:
|
|
|
|
sudo apt install tcc make
|
|
|
|
sudo apt install libwebkit2gtk-4.1-dev
|
|
|
|
|
2024-03-24 01:24:38 +00:00
|
|
|
## Additional niceties
|
|
|
|
|
|
|
|
### Formatter
|
|
|
|
STYLE_BLUEPRINT="{BasedOnStyle: webkit, AllowShortIfStatementsOnASingleLine: true, IndentCaseLabels: true, AllowShortEnumsOnASingleLine: true}"
|
|
|
|
FORMATTER=clang-format -i -style=$(STYLE_BLUEPRINT)
|
|
|
|
|
|
|
|
format: $(SRC)
|
|
|
|
$(FORMATTER) $(SRC)
|
|
|
|
|
|
|
|
lint:
|
|
|
|
clang-tidy $(SRC) -- -Wall $(INCS) -o rosenrot $(LIBS)
|
|
|
|
|
|
|
|
### Cleanup functions
|
2023-03-28 17:44:54 +00:00
|
|
|
uninstall:
|
2024-03-14 18:47:36 +00:00
|
|
|
rm /usr/bin/rosenrot
|
2024-03-14 22:31:04 +00:00
|
|
|
rm $(USER_CACHE_DIR)
|
2023-03-28 17:44:54 +00:00
|
|
|
|
|
|
|
clean:
|
2024-03-14 18:47:36 +00:00
|
|
|
rm rosenrot
|
2024-03-14 22:31:04 +00:00
|
|
|
rm $(USER_CACHE_DIR)
|
2023-03-28 17:44:54 +00:00
|
|
|
|