aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: f6fdc96988040f92d474cf57391fb5248a763960 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
.SUFFIXES: .c .t .tc
LDFLAGS += -lsqlite3

C = cforum.c ctl.c db.c err.c query.c
TPL = t/err.tc t/foot.tc t/front.tc t/head.tc t/post.tc t/user.tc

cforum: $(C) $(TPL)
	$(CC) $(CFLAGS) $(LDFLAGS) -o cforum $(C)

.t.tc: mktpl/mktpl
	<$< mktpl/mktpl >$@

db:
	sqlite3 db "CREATE TABLE settings(key, value, PRIMARY KEY (key));"
	sqlite3 db "INSERT INTO settings values('name', 'C Forum');"
	sqlite3 db "CREATE TABLE users(name, full, hash NOT NULL, PRIMARY KEY (name));"
	sqlite3 db "INSERT INTO users values('john', 'John Ankarström', '123');"
	sqlite3 db "CREATE TABLE posts(parent INT, user INT NOT NULL, created INT NOT NULL, edited INT, subject NOT NULL, text NOT NULL, FOREIGN KEY (user) REFERENCES users(oid));"
	sqlite3 db "INSERT INTO posts values(NULL, 1, 1462137896, NULL, 'Hello World!', 'This is the first post.');"