summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2014-08-06 12:31:35 -0400
committerTavian Barnes <tavianator@tavianator.com>2014-08-06 12:31:35 -0400
commitb72e0da99ef6c379bb95c637a83496ebd1aa3284 (patch)
treeb66273ad026b309fe1f937220e1a2b516abc5d13
parent1f690e899155f6c1b888fa1262fde28e468694e7 (diff)
downloadkd-forest-b72e0da99ef6c379bb95c637a83496ebd1aa3284.tar.xz
Allow parallel compilation.
-rw-r--r--.gitignore1
-rw-r--r--Makefile16
2 files changed, 12 insertions, 5 deletions
diff --git a/.gitignore b/.gitignore
index 4059c54..aea0ddb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
+*.o
/kd-forest
*.png
*.mkv
diff --git a/Makefile b/Makefile
index 3814c14..5a9f5dd 100644
--- a/Makefile
+++ b/Makefile
@@ -15,13 +15,20 @@ LDFLAGS ?= -Wl,-O1,--sort-common,--as-needed,-z,relro
LIBS ?= -lm -lpng
RM ?= rm -f
-kd-forest: kd-forest.c kd-forest.h util.c util.h color.c color.h main.c
- $(CC) $(CFLAGS) $(LDFLAGS) kd-forest.c util.c color.c main.c $(LIBS) -o kd-forest
+HEADERS = color.h kd-forest.h util.h
+
+kd-forest: color.o kd-forest.o main.o util.o
+ $(CC) $(CFLAGS) $(LDFLAGS) $^ $(LIBS) -o kd-forest
+
+%.o: %.c $(HEADERS)
+ $(CC) $(CFLAGS) -c $< -o $@
+
+image: kd-forest.png
kd-forest.png: kd-forest
./kd-forest -b 24 -s -c Lab -o kd-forest.png
-image: kd-forest.png
+anim: kd-forest.mkv
kd-forest.mkv: kd-forest
$(RM) kd-forest.mkv
@@ -30,9 +37,8 @@ kd-forest.mkv: kd-forest
./kd-forest -b 20 -s -c Lab -a -o frames
ffmpeg -r 60 -i frames/%04d.png -c:v libx264 -preset veryslow -qp 0 kd-forest.mkv
-anim: kd-forest.mkv
-
clean:
+ $(RM) *.o
$(RM) kd-forest
$(RM) -r frames