summary refs log tree commit diff
path: root/bin/Makefile
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-01-17 14:50:03 -0500
committerJune McEnroe <june@causal.agency>2019-01-17 14:50:03 -0500
commit547f58947034e590ba4c2adcfcbfed6b8c88d6f3 (patch)
treee6c219f33210e7336244fb18ec7259df492ff917 /bin/Makefile
parentDon't use string functions in ttpre (diff)
downloadsrc-547f58947034e590ba4c2adcfcbfed6b8c88d6f3.tar.gz
src-547f58947034e590ba4c2adcfcbfed6b8c88d6f3.zip
Reorganize bin and Makefile once again
Diffstat (limited to 'bin/Makefile')
-rw-r--r--bin/Makefile93
1 files changed, 48 insertions, 45 deletions
diff --git a/bin/Makefile b/bin/Makefile
index e4bd753b..9ac12f16 100644
--- a/bin/Makefile
+++ b/bin/Makefile
@@ -1,39 +1,43 @@
 PREFIX = ~/.local
-
-BIN += atch
-BIN += dtch
-BIN += glitch
-BIN += hnel
-BIN += modem
-BIN += open
-BIN += pbcopy
-BIN += pbd
-BIN += pbpaste
-BIN += pngo
-BIN += psf2png
-BIN += scheme
-BIN += ttpre
-BIN += wake
-BIN += xx
-
-BIN_BSD += wat
-
-BIN_LINUX += bri
-BIN_LINUX += fbatt
-BIN_LINUX += fbclock
-BIN_LINUX += psfed
-
-BIN_ALL = $(BIN) $(BIN_BSD) $(BIN_LINUX)
-MAN_ALL = $(BIN_ALL:%=man/%.1)
-
-CFLAGS += -Wall -Wextra -Wpedantic
+MANDIR = $(PREFIX)/share/man
+
+BINS += atch
+BINS += dtch
+BINS += glitch
+BINS += hnel
+BINS += modem
+BINS += open
+BINS += pbcopy
+BINS += pbd
+BINS += pbpaste
+BINS += pngo
+BINS += psf2png
+BINS += scheme
+BINS += ttpre
+BINS += wake
+BINS += xx
+
+BINS_BSD += wat
+
+BINS_LINUX += bri
+BINS_LINUX += fbatt
+BINS_LINUX += fbclock
+BINS_LINUX += psfed
+
+BINS_ALL = $(BINS) $(BINS_BSD) $(BINS_LINUX)
+MAN1_ALL = $(BINS_ALL:%=man1/%.1)
+
+CFLAGS += -std=c11 -Wall -Wextra -Wpedantic
 LDLIBS = -lm -lutil -lz
 
-any: .gitignore tags $(BIN)
+any: .gitignore tags $(BINS)
+
+bsd: any $(BINS_BSD)
 
-bsd: any $(BIN_BSD)
+linux: any $(BINS_LINUX)
 
-linux: any $(BIN_LINUX)
+.o:
+	$(CC) $(LDFLAGS) $< $(LDLIBS) -o $@
 
 scheme.h: scheme
 	./scheme -c > scheme.h
@@ -48,32 +52,31 @@ atch: dtch
 open pbcopy pbpaste: pbd
 	ln -f pbd $@
 
-scheme.png: scheme
-	./scheme -t -g > scheme.png
+.gitignore: Makefile
+	echo $(BINS_ALL) tags scheme.h scheme.png '*.o' \
+		| tr ' ' '\n' | sort > .gitignore
 
 tags: *.h *.c
 	ctags -w *.h *.c
 
-.gitignore: Makefile
-	echo '*.o' scheme.h scheme.png tags $(BIN_ALL) \
-		| tr ' ' '\n' \
-		> .gitignore
+scheme.png: scheme
+	./scheme -gt > scheme.png
 
 clean:
-	rm -f *.o scheme.h scheme.png tags $(BIN_ALL)
+	rm -f $(BINS_ALL) tags scheme.h scheme.png *.o
 
-README: man/bin.7
-	mandoc man/bin.7 | col -b -x > README
+README: bin.7
+	mandoc bin.7 | col -bx > README
 
 setuid: bri
 	chown root bri
 	chmod u+s bri
 
 link:
-	mkdir -p $(PREFIX)/bin $(PREFIX)/share/man/man1
-	ln -s -f $(BIN_ALL:%=$(PWD)/%) $(PREFIX)/bin
-	ln -s -f $(MAN_ALL:%=$(PWD)/%) $(PREFIX)/share/man/man1
+	install -d $(PREFIX)/bin $(MANDIR)/man1
+	ln -fs $(BINS_ALL:%=$(PWD)/%) $(PREFIX)/bin
+	ln -fs $(MAN1_ALL:%=$(PWD)/%) $(MANDIR)/man1
 
 unlink:
-	rm -f $(BIN_ALL:%=$(PREFIX)/bin/%)
-	rm -f $(MAN_ALL:man/%=$(PREFIX)/share/man/man1/%)
+	rm -f $(BINS_ALL:%=$(PREFIX)/bin/%)
+	rm -f $(MAN1_ALL:%=$(MANDIR)/%)