From b48a08ff1957561e147568399db88f38f4f497e0 Mon Sep 17 00:00:00 2001 From: "me@ow.nekobit.net" Date: Mon, 17 Jan 2022 02:06:25 +0000 Subject: [PATCH] Compile pages FossilOrigin-Name: 40d7ae05ad3543176e66ed09710b64f5fe38cf52e49f8b3b5cd090c9359eda4d --- .gitignore | 3 ++- Makefile | 12 +++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 9d95beb..8ef8c0f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ file-to-c **/*.cgi -**/*.o \ No newline at end of file +**/*.o +**/*.chtml \ No newline at end of file diff --git a/Makefile b/Makefile index 5066c3c..2cc207e 100644 --- a/Makefile +++ b/Makefile @@ -3,21 +3,31 @@ CFLAGS = -Wall LDFLAGS = -lcurl SRC = $(wildcard src/*.c) OBJ = $(patsubst %.c,%.o,$(SRC)) +PAGES_DIR = static +PAGES = $(wildcard $(PAGES_DIR)/*.html) +PAGES_CMP = $(patsubst %.html,%.chtml,$(PAGES)) DIST = dist/ TARGET = ratfe.cgi all: $(TARGET) -$(TARGET): filec $(OBJ) +$(TARGET): filec $(PAGES_CMP) $(OBJ) $(CC) -o $(DIST)$(TARGET) $(LDFLAGS) $(OBJ) filec: src/file-to-c/main.o $(CC) -o file-to-c $< +%.chtml: %.html + ./file-to-c $< $< > $@ + +$(PAGES_DIR)/index.chtml: $(PAGES_DIR)/index.html + ./file-to-c $< data_index_html > $@ + %.o: %.c $(CC) $(CFLAGS) -c $< -o $@ clean: rm -f $(OBJ) src/file-to-c/main.o + rm -f $(PAGES_CMP) .PHONY: all filec clean