summary refs log tree commit diff
path: root/gfx
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--gfx/.gitignore4
-rw-r--r--gfx/Makefile31
-rw-r--r--gfx/brot.c (renamed from bin/brot.c)2
-rw-r--r--gfx/cocoa.m (renamed from bin/gfx/cocoa.m)0
-rw-r--r--gfx/fb.c (renamed from bin/gfx/fb.c)0
-rw-r--r--gfx/gfx.h (renamed from bin/gfx/gfx.h)0
-rw-r--r--gfx/gfxx.c (renamed from bin/gfxx.c)2
-rw-r--r--gfx/x11.c (renamed from bin/gfx/x11.c)0
8 files changed, 37 insertions, 2 deletions
diff --git a/gfx/.gitignore b/gfx/.gitignore
new file mode 100644
index 00000000..cdff2c2e
--- /dev/null
+++ b/gfx/.gitignore
@@ -0,0 +1,4 @@
+*.o
+tags
+brot
+gfxx
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/%)
diff --git a/bin/brot.c b/gfx/brot.c
index cd520cb9..64efde4b 100644
--- a/bin/brot.c
+++ b/gfx/brot.c
@@ -26,7 +26,7 @@
 #include <time.h>
 #include <unistd.h>
 
-#include "gfx/gfx.h"
+#include "gfx.h"
 
 #define RGB(r, g, b) ((uint32_t)(r) << 16 | (uint32_t)(g) << 8 | (uint32_t)(b))
 #define GRAY(n) RGB(n, n, n)
diff --git a/bin/gfx/cocoa.m b/gfx/cocoa.m
index 3df6c62a..3df6c62a 100644
--- a/bin/gfx/cocoa.m
+++ b/gfx/cocoa.m
diff --git a/bin/gfx/fb.c b/gfx/fb.c
index e1ef5e82..e1ef5e82 100644
--- a/bin/gfx/fb.c
+++ b/gfx/fb.c
diff --git a/bin/gfx/gfx.h b/gfx/gfx.h
index 715ec08c..715ec08c 100644
--- a/bin/gfx/gfx.h
+++ b/gfx/gfx.h
diff --git a/bin/gfxx.c b/gfx/gfxx.c
index 4f67318c..576e895d 100644
--- a/bin/gfxx.c
+++ b/gfx/gfxx.c
@@ -29,7 +29,7 @@
 #include <unistd.h>
 #include <zlib.h>
 
-#include "gfx/gfx.h"
+#include "gfx.h"
 
 #define MAX(a, b) ((a) > (b) ? (a) : (b))
 #define MASK(b) ((1 << (b)) - 1)
diff --git a/bin/gfx/x11.c b/gfx/x11.c
index eae926c2..eae926c2 100644
--- a/bin/gfx/x11.c
+++ b/gfx/x11.c