rosenrot/makefile

44 lines
1.1 KiB
Makefile
Raw Normal View History

# C compiler
CC=gcc # alternatives: tcc, clang, zig cc
2023-03-28 16:59:38 +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}`
# Code
SRC=rosenrot.c
CONFIG=config.h
2023-03-28 17:11:18 +00:00
## Formatter
2024-03-23 21:10:59 +00:00
STYLE_BLUEPRINT="{BasedOnStyle: webkit, AllowShortIfStatementsOnASingleLine: true, IndentCaseLabels: true, AllowShortEnumsOnASingleLine: true}"
2023-03-28 17:11:18 +00:00
FORMATTER=clang-format -i -style=$(STYLE_BLUEPRINT)
2024-03-24 00:51:55 +00:00
build: $(SRC) $(CONFIG) user_cache
$(CC) $(INCS) $(SRC) -o rosenrot $(LIBS) $(ADBLOCK)
user_cache:
@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"
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" {} +
@echo
2024-03-24 00:51:55 +00:00
install: rosenrot
cp -f rosenrot /usr/bin
2023-03-28 16:59:38 +00:00
2023-03-28 17:44:54 +00:00
uninstall:
rm /usr/bin/rosenrot
rm $(USER_CACHE_DIR)
2023-03-28 17:44:54 +00:00
clean:
rm rosenrot
rm $(USER_CACHE_DIR)
2023-03-28 17:44:54 +00:00
2024-02-11 14:56:53 +00:00
format: $(SRC) $(PLUGINS)
$(FORMATTER) $(SRC) $(PLUGINS) $(rosenrot.h)
2024-03-12 17:16:29 +00:00
lint:
2024-03-24 00:51:55 +00:00
clang-tidy $(SRC) -- -Wall $(INCS) -o rosenrot $(LIBS)