summary refs log tree commit diff
path: root/bin/Makefile
diff options
context:
space:
mode:
authorJune McEnroe <programble@gmail.com>2018-02-09 15:14:33 -0500
committerJune McEnroe <programble@gmail.com>2018-02-09 15:14:33 -0500
commit3d6cfca2326fe21c90668e02794a81d2ed7615de (patch)
treec1055d70ed6d310a46e945b8270cf909314d9ace /bin/Makefile
parentAdd janky X11 graphics frontend (diff)
downloadsrc-3d6cfca2326fe21c90668e02794a81d2ed7615de.tar.gz
src-3d6cfca2326fe21c90668e02794a81d2ed7615de.zip
Move gfx frontends around to simplify build
I forgot that you can expand variables inside variables names in make.
Certainly makes some fun things possible.
Diffstat (limited to 'bin/Makefile')
-rw-r--r--bin/Makefile31
1 files changed, 10 insertions, 21 deletions
diff --git a/bin/Makefile b/bin/Makefile
index 5801ec74..2a4658f1 100644
--- a/bin/Makefile
+++ b/bin/Makefile
@@ -1,36 +1,25 @@
-ANY_BINS = atch dtch hnel pbcopy pbd pbpaste wake xx
+ANY_BINS = atch dtch gfxx hnel pbcopy pbd pbpaste wake xx
 BSD_BINS = jrp klon typo watch
-MAC_BINS = gfxx-cocoa gfxx
-LIN_BINS = bri fbatt fbclock gfxx-fb gfxx
-ALL_BINS = $(ANY_BINS) $(BSD_BINS) $(MAC_BINS) $(LIN_BINS) gfxx-x11
+LIN_BINS = bri fbatt fbclock
+ALL_BINS = $(ANY_BINS) $(BSD_BINS) $(LIN_BINS)
+GFX = none
 
 CFLAGS += -Wall -Wextra -Wpedantic
 LDLIBS = -lcurses -ledit -lutil -lz
+LDLIBS_cocoa = $(LDLIBS) -framework Cocoa
+LDLIBS_x11 = $(LDLIBS) -lX11
 
 any: .gitignore tags $(ANY_BINS)
 
 bsd: any $(BSD_BINS)
 
-mac: bsd $(MAC_BINS)
-
 linux: any $(LIN_BINS)
 
 atch: dtch
 	ln -f dtch atch
 
-gfxx-cocoa: gfxx.o gfcocoa.o
-	$(CC) $(LDFLAGS) gfxx.o gfcocoa.o $(LDLIBS) -framework Cocoa -o $@
-
-gfxx-fb: gfxx.o gfb.o
-	$(CC) $(LDFLAGS) gfxx.o gfb.o $(LDLIBS) -o $@
-
-gfxx-x11: gfxx.o gfx11.o
-	$(CC) $(LDFLAGS) gfxx.o gfx11.o $(LDLIBS) -lX11 -o $@
-
-gfxx:
-	[ -f gfxx-fb ] && ln -s -f gfxx-fb gfxx || true
-	[ -f gfxx-x11 ] && ln -s -f gfxx-x11 gfxx || true
-	[ -f gfxx-cocoa ] && ln -s -f gfxx-cocoa gfxx || true
+gfxx: gfxx.o gfx/$(GFX).o
+	$(CC) $(LDFLAGS) gfxx.o gfx/$(GFX).o $(LDLIBS_$(GFX)) -o $@
 
 pbcopy pbpaste: pbd
 	ln -f pbd $@
@@ -40,7 +29,7 @@ setuid: bri
 	chmod u+s bri
 
 clean:
-	rm -f *.o $(ALL_BINS)
+	rm -f *.o gfx/*.o $(ALL_BINS)
 
 link:
 	ln -s -f $(ALL_BINS:%=$(PWD)/%) ~/.bin
@@ -54,4 +43,4 @@ unlink:
 tags: *.c
 	ctags *.c
 
-.PHONY: any bsd mac linux setuid clean link unlink
+.PHONY: any bsd linux setuid clean link unlink