summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorthe xhr <xhr@giessen.ccc.de>2021-08-24 21:22:29 +0200
committerthe xhr <xhr@giessen.ccc.de>2021-08-24 21:22:29 +0200
commitf224a3fe688bf2ae4c108d6b4359df4d8f03db99 (patch)
tree1d9d6fdce5671be7ae5754f51c6ef5b47bf7f0c1 /Makefile
parent0f9f2d04f9c340c761a9c900fac1c225b5a05419 (diff)
Initial commit of twind - a small and simple gemini daemon
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile49
1 files changed, 49 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..20824e6
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,49 @@
+CC = cc
+
+#CFLAGS = -g3 -ggdb
+CFLAGS = -O2
+
+CFLAGS += -pipe -fPIE -fdiagnostics-color -Wno-unknown-warning-option -Wpedantic
+CFLAGS += -Wall -Werror-implicit-function-declaration -Wno-format-truncation
+CFLAGS += -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations
+CFLAGS += -Wshadow -Wpointer-arith -Wcast-qual -Wsign-compare
+CFLAGS += -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Werror=format-security
+LDADD = -Wl,-z,now -Wl,-z,relro -pie -lssl -lcrypto -lpthread
+
+BIN = twind
+OBJS = twind.o gemini.o log.o request.o mime.o util.o
+
+INSTALL ?= install -p
+
+PREFIX ?= /usr/local
+SBIN ?= $(PREFIX)/sbin
+MAN ?= $(PREFIX)/man
+GEMINIDIR ?= /var/twind
+CONFDIR ?= /etc/twind
+
+UID = 4000
+
+all: $(BIN)
+
+install: all
+ $(INSTALL) -d -m 755 -o root $(MAN)/man8
+ $(INSTALL) -d -m 750 -o root $(CONFDIR)
+ $(INSTALL) -d -m 755 -o root $(GEMINIDIR)
+ $(INSTALL) -d -m 755 -o _twind -g _twind $(GEMINIDIR)/logs
+ $(INSTALL) -m 644 -o root twind.8 $(MAN)/man8
+ $(INSTALL) -m 755 -o root twind $(SBIN)
+
+user:
+ @useradd -d $(GEMINIDIR) -s /sbin/nologin -u $(UID) _twind
+
+setuptls:
+ @openssl req -x509 -newkey rsa:4096 -sha256 -days 365 -nodes -keyout $(CONFDIR)/twind.key.pem -new -subj /CN=$(HN) -out $(CONFDIR)/twind.cert.pem -addext subjectAltName=DNS:$(HN)
+
+$(BIN): $(OBJS)
+ $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LDADD)
+
+.c.o:
+ $(CC) $(CFLAGS) -o $@ -c $<
+
+clean:
+ rm -f $(BIN) $(OBJS)
generated by cgit on OpenBSD