2023-03-28 17:11:18 +00:00
|
|
|
# make
|
|
|
|
# make build
|
|
|
|
# (sudo) make install
|
|
|
|
# make format
|
|
|
|
# make clean
|
|
|
|
# make uninstall
|
2023-03-28 16:59:38 +00:00
|
|
|
|
|
|
|
## C compiler
|
2023-05-09 02:48:22 +00:00
|
|
|
CC=gcc # gcc: more options. Also I don't know whether tcc has error messages/debug options.
|
|
|
|
## CC=tcc # tcc: much faster
|
2023-03-28 16:59:38 +00:00
|
|
|
|
|
|
|
## Main file
|
|
|
|
SRC=rose.c
|
|
|
|
|
|
|
|
## Dependencies
|
|
|
|
DEPS='webkit2gtk-4.0'
|
|
|
|
DEBUG= #'-g'
|
|
|
|
|
|
|
|
INCS=`pkg-config --cflags ${DEPS}`
|
|
|
|
LIBS=`pkg-config --libs ${DEPS}`
|
|
|
|
|
2023-03-28 17:11:18 +00:00
|
|
|
## Optional adblocking
|
|
|
|
## depends on https://github.com/jun7/wyebadblock
|
2023-05-04 02:14:46 +00:00
|
|
|
ADBLOCK=#'-L/usr/lib/wyebrowser/adblock.so'
|
2023-03-28 17:11:18 +00:00
|
|
|
|
|
|
|
## Plugins
|
2023-05-14 03:50:14 +00:00
|
|
|
LIBRE_REDIRECT=./plugins/libre_redirect/libre_redirect.c ./plugins/libre_redirect/str_replace_start.c ./plugins/libre_redirect/str_init.c
|
2023-03-28 17:11:18 +00:00
|
|
|
CUSTOM_STYLES=./plugins/style/style.c
|
2023-05-14 03:24:52 +00:00
|
|
|
READABILITY=./plugins/readability/readability.c
|
|
|
|
SHORTCUTS=./plugins/shortcuts/shortcuts.c
|
2023-03-28 16:59:38 +00:00
|
|
|
|
|
|
|
STAND_IN=./plugins/stand_in/stand_in.c # gives function definitions for the above, which do nothing
|
|
|
|
|
2023-05-14 03:24:52 +00:00
|
|
|
PLUGS=$(LIBRE_REDIRECT) $(READABILITY) $(CUSTOM_STYLES) $(SHORTCUTS)
|
2023-03-28 16:59:38 +00:00
|
|
|
# PLUGS=$(STAND_IN)
|
|
|
|
# Note that if you want some plugins but not others,
|
|
|
|
# You should edit the stand_in.c file
|
|
|
|
|
|
|
|
# CONFIG
|
|
|
|
CONFIG=config.h
|
|
|
|
# cp -f config.def.h config.h
|
|
|
|
|
2023-03-28 17:11:18 +00:00
|
|
|
## Formatter
|
|
|
|
STYLE_BLUEPRINT=webkit
|
|
|
|
FORMATTER=clang-format -i -style=$(STYLE_BLUEPRINT)
|
|
|
|
## Commands
|
|
|
|
|
2023-03-29 04:07:25 +00:00
|
|
|
## Hardcoded paths
|
|
|
|
## Cache
|
|
|
|
USER=`whoami`
|
|
|
|
DEFAULT_CACHE_DIR=/home/loki/.cache/rose
|
|
|
|
CURRENT_CACHE_DIR=/home/$(USER)/.cache/rose
|
|
|
|
## dir
|
2023-03-29 04:27:02 +00:00
|
|
|
DEFAULT_DIR=/home/loki/Documents/core/software/fresh/C/rose-browser/rosenrot
|
2023-03-29 04:07:25 +00:00
|
|
|
CURRENT_DIR=`pwd`
|
|
|
|
|
2023-03-28 16:59:38 +00:00
|
|
|
build: $(SRC) $(PLUGS) $(CONFIG)
|
2023-04-21 23:19:11 +00:00
|
|
|
# Recompute constants
|
2023-04-22 01:31:11 +00:00
|
|
|
cd plugins/readability/ && sh recompute_READABILITY_N.sh
|
|
|
|
cd plugins/style && sh recompute_STYLE_N.sh
|
2023-03-29 04:07:25 +00:00
|
|
|
# Make cache
|
|
|
|
mkdir -p $(CURRENT_CACHE_DIR)
|
|
|
|
# Hardcode cache path
|
|
|
|
find $(CURRENT_DIR) -type f -not -path "*.git*" -not -path "*makefile*" -exec \
|
|
|
|
sed -i "s|$(DEFAULT_CACHE_DIR)|$(CURRENT_CACHE_DIR)|g" {} +
|
|
|
|
# Hardcode git repository path
|
|
|
|
find $(CURRENT_DIR) -type f -not -path "*.git*" -not -path "*makefile*" -exec \
|
|
|
|
sed -i "s|$(DEFAULT_DIR)|$(CURRENT_DIR)|g" {} +
|
|
|
|
# Compile rosenrot
|
2023-05-04 02:14:46 +00:00
|
|
|
GIO_MODULE_DIR=/usr/lib/x86_64-linux-gnu/gio/modules/
|
2023-03-28 16:59:38 +00:00
|
|
|
$(CC) $(DEBUG) $(INCS) $(PLUGS) $(SRC) -o rose $(LIBS) $(ADBLOCK)
|
|
|
|
|
2023-05-09 02:48:22 +00:00
|
|
|
inspect: build
|
|
|
|
GTK_DEBUG=interactive ./rose
|
|
|
|
|
2023-03-28 16:59:38 +00:00
|
|
|
install: rose
|
2023-05-04 02:14:46 +00:00
|
|
|
GIO_MODULE_DIR=/usr/lib/x86_64-linux-gnu/gio/modules/
|
2023-03-28 16:59:38 +00:00
|
|
|
cp -f rose /usr/bin
|
|
|
|
mkdir -p /usr/share/themes/rose
|
|
|
|
cp style.css /usr/share/themes/rose/
|
|
|
|
cp rose-mklink /usr/bin
|
|
|
|
|
2023-03-28 17:44:54 +00:00
|
|
|
uninstall:
|
|
|
|
rm -r /usr/share/themes/rose
|
|
|
|
rm /usr/bin/rose
|
|
|
|
rm /usr/bin/rose-mklink
|
2023-03-29 04:07:25 +00:00
|
|
|
rm $(CACHE_DIR)
|
2023-03-28 17:44:54 +00:00
|
|
|
|
|
|
|
clean:
|
|
|
|
rm rose
|
2023-03-29 04:07:25 +00:00
|
|
|
rm $(CACHE_DIR)
|
2023-03-28 17:44:54 +00:00
|
|
|
|
2023-03-28 17:11:18 +00:00
|
|
|
format: $(SRC) $(PLUGS)
|
|
|
|
$(FORMATTER) $(SRC) $(PLUGS)
|
|
|
|
|