summary refs log tree commit diff
path: root/bin/Makefile
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-05-04 17:50:38 -0400
committerJune McEnroe <june@causal.agency>2019-05-04 17:50:38 -0400
commitd2a90f4df164c99a7156dc2385a2b9ebce45ee2d (patch)
treecdafff701a6aeddbe8737f1b40da761d64f9c044 /bin/Makefile
parentAdd relay.1 (diff)
downloadsrc-d2a90f4df164c99a7156dc2385a2b9ebce45ee2d.tar.gz
src-d2a90f4df164c99a7156dc2385a2b9ebce45ee2d.zip
Move relay to bin
Diffstat (limited to 'bin/Makefile')
-rw-r--r--bin/Makefile41
1 files changed, 29 insertions, 12 deletions
diff --git a/bin/Makefile b/bin/Makefile
index 16a5ba9e..528a70b2 100644
--- a/bin/Makefile
+++ b/bin/Makefile
@@ -1,13 +1,22 @@
-PREFIX = ~/.local
-MANDIR = $(PREFIX)/share/man
 GFX = cocoa
+LIBRESSL_PREFIX = /usr/local
+
+PREFIX = ~/.local
+MANIDR = $(PREFIX)/share/man
 
 CFLAGS += -Wall -Wextra -Wpedantic
 LDLIBS = -lm -lutil -lz
+
+CFLAGS_tls = $(CFLAGS) -I$(LIBRESSL_PREFIX)/include
+LDFLAGS_tls = $(LDFLAGS) -L$(LIBRESSL_PREFIX)/lib
+LDLIBS_tls = $(LDLIBS) -ltls
+
 LDLIBS_cocoa = $(LDLIBS) -framework Cocoa
 LDLIBS_fb = $(LDLIBS)
 LDLIBS_x11 = $(LDLIBS) -lX11
 
+-include config.mk
+
 BINS += aes
 BINS += dtch
 BINS += glitch
@@ -32,24 +41,28 @@ LINKS += pbpaste
 BINS_BSD += beef
 BINS_BSD += wat
 
+BINS_GFX += brot
+BINS_GFX += gfxx
+
 BINS_LINUX += bri
 BINS_LINUX += fbatt
 BINS_LINUX += fbclock
 BINS_LINUX += psfed
 
-BINS_GFX += brot
-BINS_GFX += gfxx
+BINS_TLS += relay
 
-BINS_ALL = $(BINS) $(BINS_BSD) $(BINS_LINUX) $(BINS_GFX)
+BINS_ALL = $(BINS) $(BINS_BSD) $(BINS_GFX) $(BINS_LINUX) $(BINS_TLS)
 MAN1_ALL = $(BINS_ALL:%=man1/%.1)
 
 any: .gitignore tags $(BINS) $(LINKS)
 
-bsd: any $(BINS_BSD)
+bsd: $(BINS_BSD)
+
+gfx: $(BINS_GFX)
 
-linux: any $(BINS_LINUX)
+linux: $(BINS_LINUX)
 
-gfx: any $(BINS_GFX)
+tls: $(BINS_TLS)
 
 .o:
 	$(CC) $(LDFLAGS) $< $(LDLIBS) -o $@
@@ -75,22 +88,26 @@ hi: hi.c
 	$(CC) $(CFLAGS) $(LDFLAGS) hi.c $(LDLIBS) -o $@
 	./hi -c
 
+relay: relay.c
+	$(CC) $(CFLAGS_tls) $(LDFLAGS_tls) relay.c $(LDLIBS_tls) -o $@
+
 atch: dtch
 	ln -f dtch atch
 
 open pbcopy pbpaste: pbd
 	ln -f pbd $@
 
-.gitignore: Makefile
-	echo $(BINS_ALL) $(LINKS) tags scheme.h scheme.png '*.o' '*.html' \
-		| tr ' ' '\n' | sort > .gitignore
-
 tags: *.h *.c
 	ctags -w *.h *.c
 
 scheme.png: scheme
 	./scheme -gt > scheme.png
 
+IGNORE = '*.o' '*.html' config.mk tags scheme.h scheme.png $(BINS_ALL) $(LINKS)
+
+.gitignore: Makefile
+	echo $(IGNORE) | tr ' ' '\n' | sort > .gitignore
+
 HTMLS = $(BINS_ALL:%=%.html)
 HTMLS += Makefile.html
 HTMLS += gfx-fb.html