aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2021-09-18 10:38:09 +0200
committerJohn Ankarström <john@ankarstrom.se>2021-09-18 10:38:09 +0200
commit0292e86cf884a26108a59d81d69cee83b54f4c88 (patch)
tree3f5b30fe172013802955213503a5827616be6fec /Makefile
parentae9b583b9575679f129680a0f56163fdb6590052 (diff)
downloadcforum-0292e86cf884a26108a59d81d69cee83b54f4c88.tar.gz
Clean up database code
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile16
1 files changed, 12 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index fae0385..38d7adf 100644
--- a/Makefile
+++ b/Makefile
@@ -6,13 +6,21 @@ TPL = $(shell ls t/*.t | sed 's/$$/c/')
.SUFFIXES: .t .tc
-cforum: $(C) $(H) $(TPL)
- $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o cforum $(C)
+all: cforum README
clean:
rm cforum
rm $(TPL)
+cforum: $(C) $(H) $(TPL)
+ $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o cforum $(C)
+
+README: .README
+ cp .README README
+
+.README: $(C) $(H) $(TPL)
+ <README >.README awk '/^ / {if(!i++){print;system($$0"|sed s/^/\\ /")}exit} {print}'
+
.t.tc: mktpl/mktpl
<$< mktpl/mktpl >$@
@@ -24,5 +32,5 @@ db:
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.');"
sqlite3 db "INSERT INTO posts values(1, 1, 1462138896, NULL, 'Re: Hello World!', 'This is the second post!');"
- sqlite3 db "CREATE TABLE attachments(post INT NOT NULL, name NOT NULL, description, mime NOT NULL, data BLOB, FOREIGN KEY (post) REFERENCES posts(oid));"
- sqlite3 db "$$(printf "INSERT INTO attachments values(1, 'example', 'Some example shell code.', 'text/plain', '#!/bin/sh\necho Hello World!');")" \ No newline at end of file
+ sqlite3 db "CREATE TABLE atts(post INT NOT NULL, name NOT NULL, description, mime NOT NULL, data BLOB, FOREIGN KEY (post) REFERENCES posts(oid));"
+ sqlite3 db "$$(printf "INSERT INTO atts values(1, 'example', 'Some example shell code.', 'text/plain', '#!/bin/sh\necho Hello World!');")" \ No newline at end of file