CC ?= gcc
CFLAGS ?= -O2 -Wall -Wno-unused-function -I.

.PHONY: all clean

all: yyjson.o index search watch channel captions comments liked subs history
	@echo "Built all ScorpioX YouTube Web routes (HTML, proxies yt-api)"

yyjson.o: yyjson.c yyjson.h
	$(CC) $(CFLAGS) -c -o $@ $<

index: index.c yyjson.o yt_common.h yt_navbar.h yt_cards.h yt_api.h bot_theme.h
	$(CC) $(CFLAGS) -o $@ index.c yyjson.o

search: search.c yyjson.o yt_common.h yt_navbar.h yt_cards.h yt_api.h bot_theme.h
	$(CC) $(CFLAGS) -o $@ search.c yyjson.o

watch: watch.c yyjson.o yt_common.h yt_navbar.h yt_cards.h yt_api.h bot_theme.h
	$(CC) $(CFLAGS) -o $@ watch.c yyjson.o

channel: channel.c yyjson.o yt_common.h yt_navbar.h yt_cards.h yt_api.h bot_theme.h
	$(CC) $(CFLAGS) -o $@ channel.c yyjson.o

captions: captions.c yyjson.o yt_common.h yt_navbar.h yt_cards.h yt_api.h bot_theme.h
	$(CC) $(CFLAGS) -o $@ captions.c yyjson.o

comments: comments.c yyjson.o yt_common.h yt_navbar.h yt_cards.h yt_api.h bot_theme.h
	$(CC) $(CFLAGS) -o $@ comments.c yyjson.o

liked: liked.c yyjson.o yt_common.h yt_navbar.h yt_cards.h yt_api.h bot_theme.h
	$(CC) $(CFLAGS) -o $@ liked.c yyjson.o

subs: subs.c yyjson.o yt_common.h yt_navbar.h yt_cards.h yt_api.h bot_theme.h
	$(CC) $(CFLAGS) -o $@ subs.c yyjson.o

history: history.c yyjson.o yt_common.h yt_navbar.h yt_cards.h yt_api.h bot_theme.h
	$(CC) $(CFLAGS) -o $@ history.c yyjson.o

clean:
	rm -f index search watch channel captions comments liked subs history yyjson.o
