summary refs log tree commit diff
path: root/gfx/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'gfx/Makefile')
-rw-r--r--gfx/Makefile31
1 files changed, 31 insertions, 0 deletions
diff --git a/gfx/Makefile b/gfx/Makefile
new file mode 100644
index 00000000..f2ae4bee
--- /dev/null
+++ b/gfx/Makefile
@@ -0,0 +1,31 @@
+BINS = brot gfxx
+GFX ?= cocoa
+
+CFLAGS += -Wall -Wextra -Wpedantic
+LDLIBS = -lm -lz
+LDLIBS_cocoa = -framework Cocoa
+LDLIBS_x11 = -lX11
+
+all: .gitignore tags $(BINS)
+
+.gitignore: Makefile
+	echo '*.o' tags $(BINS) | tr ' ' '\n' > .gitignore
+
+tags: *.h *.c
+	ctags -w *.h *.c
+
+brot: brot.o $(GFX).o
+	$(CC) $(LDFLAGS) brot.o $(GFX).o $(LDLIBS) $(LDLIBS_$(GFX)) -o $@
+
+gfxx: gfxx.o $(GFX).o
+	$(CC) $(LDFLAGS) gfxx.o $(GFX).o $(LDLIBS) $(LDLIBS_$(GFX)) -o $@
+
+clean:
+	rm -f tags *.o $(BINS)
+
+link:
+	mkdir -p ~/.local/bin
+	ln -s -f $(BINS:%=$(PWD)/%) ~/.local/bin
+
+unlink:
+	rm -f $(BINS:%=~/.local/bin/%)