summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2018-02-04 19:13:05 -0500
committerJune McEnroe <june@causal.agency>2018-02-04 19:13:05 -0500
commit7076c087ee86f57f7f520554418c7ed540723d0e (patch)
tree7229aad688b57d6ba0aa952969be5b92252f0142
parentAvoid doing excessive work in gfxx (diff)
downloadsrc-7076c087ee86f57f7f520554418c7ed540723d0e.tar.gz
src-7076c087ee86f57f7f520554418c7ed540723d0e.zip
Set up Makefile for gfxx-cocoa or gfxx-fb
-rw-r--r--bin/.gitignore3
-rw-r--r--bin/Makefile25
2 files changed, 21 insertions, 7 deletions
diff --git a/bin/.gitignore b/bin/.gitignore
index 24c3bf6c..354e7720 100644
--- a/bin/.gitignore
+++ b/bin/.gitignore
@@ -11,7 +11,10 @@ jrp
 klon
 typo
 watch
+gfxx-cocoa
+gfxx
 bri
 fbatt
 fbclock
+gfxx-fb
 gfxx
diff --git a/bin/Makefile b/bin/Makefile
index c7e44d87..78e422bc 100644
--- a/bin/Makefile
+++ b/bin/Makefile
@@ -1,21 +1,32 @@
 ANY_BINS = atch dtch hnel pbcopy pbd pbpaste wake xx
 BSD_BINS = jrp klon typo watch
-LIN_BINS = bri fbatt fbclock gfxx
-ALL_BINS = $(ANY_BINS) $(BSD_BINS) $(LIN_BINS)
+MAC_BINS = gfxx-cocoa gfxx
+LIN_BINS = bri fbatt fbclock gfxx-fb gfxx
+ALL_BINS = $(ANY_BINS) $(BSD_BINS) $(MAC_BINS) $(LIN_BINS)
 
 CFLAGS += -Wall -Wextra -Wpedantic
 LDLIBS = -lcurses -ledit -lutil -lz
 
-any: $(ANY_BINS) .gitignore
+any: .gitignore $(ANY_BINS)
 
-bsd: $(ANY_BINS) $(BSD_BINS) .gitignore
+bsd: any $(BSD_BINS)
 
-linux: $(ANY_BINS) $(LIN_BINS) .gitignore
+mac: bsd $(MAC_BINS)
+
+linux: any $(LIN_BINS)
 
 atch: dtch
 	ln -f dtch atch
 
-gfxx: gfxx.o gfb.o
+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:
+	[ -f gfxx-cocoa ] && ln -s gfxx-cocoa gfxx || true
+	[ -f gfxx-fb ] && ln -s gfxx-fb gfxx || true
 
 pbcopy pbpaste: pbd
 	ln -f pbd $@
@@ -25,7 +36,7 @@ setuid: bri
 	chmod u+s bri
 
 clean:
-	rm -f $(ALL_BINS)
+	rm -f *.o $(ALL_BINS)
 
 link:
 	ln -s -f $(ALL_BINS:%=$(PWD)/%) ~/.bin