From d38f82f6462af4e5aad6a2c776f5c00ce5b13c87 Mon Sep 17 00:00:00 2001 From: Linnnus Date: Thu, 1 Feb 2024 22:59:38 +0100 Subject: feat: initial commit Here is a small overview of the state of the project at this first commit. I have basic Git Repo -> HTML working, and a plan for how setting up an actual server would work (mainly, NGINX + a git hook to rebuild). The main thing I'm working on right now is parsing WikiCreole, though I am starting to wonder if this is the right langauge. WikiCreole is pretty irregular and has a lot of edge cases (e.g. around emphasis). --- Makefile | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 Makefile (limited to 'Makefile') diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..afc9dda --- /dev/null +++ b/Makefile @@ -0,0 +1,47 @@ +.POSIX: +.PHONY: all install uninstall clean + +CC := cc +CFLAGS := -W -O $(shell pkg-config --cflags libgit2) +CFLAGS += -g3 -O0 -fsanitize=address,undefined -fsanitize-trap +CFLAGS += -Wall -Wextra -Wconversion -Wdouble-promotion \ + -Wno-unused-parameter -Wno-unused-function -Wno-sign-conversion +LDLIBS := -lm $(shell pkg-config --libs libgit2) +PREFIX ?= /usr/local + +all: build/simplewiki + +install: build/simplewiki + mkdir -p $(PREFIX)/bin + mkdir -p $(PREFIX)/share/man/man1 + cp -f build/simplewiki $(PREFIX)/bin + gzip $(PREFIX)/share/man/man1/simplewiki.1.gz + +uninstall: + rm -f $(PREFIX)/bin/simplewiki + rm -f $(PREFIX)/share/man/man1/simplewiki.1.gz + rmdir $(PREFIX)/bin >/dev/null 2>&1 || true + rmdir $(PREFIX)/share/man/man1 >/dev/null 2>&1 || true + +build/simplewiki: build/main.o build/die.o build/arena.o build/strutil.o build/creole.o + $(CC) $(LDFLAGS) -o build/simplewiki $^ $(LDLIBS) + +build/creole-test: build/creole-test.o build/creole.o + $(CC) -o $@ $^ + +build/creole-test.o: src/creole-test.c +build/main.o: src/main.c src/arena.h src/die.h src/strutil.h src/creole.h +build/arena.o: src/arena.c src/arena.h +build/die.o: src/die.c src/die.h +build/strutil.o: src/strutil.c src/strutil.h src/arena.h +build/creole.o: src/creole.c + +build/%.o: src/%.c | build/ + $(CC) $(CFLAGS) -c -o $@ $< + +build/: + mkdir -p build/ + +clean: + rm -f build/ + -- cgit v1.2.3