aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarry Jeffery <harry@exec64.co.uk>2015-11-11 15:22:41 +0000
committerHarry Jeffery <harry@exec64.co.uk>2015-11-11 15:22:41 +0000
commit8b527949b0a74a37079210a6fc8fabbd576432eb (patch)
treecfa44059678e1ec1b13a700b325249856437e182
parentd1f0e07abd9bbb72ca825fe8e2fe9fa12cc6746f (diff)
downloadimv-8b527949b0a74a37079210a6fc8fabbd576432eb.tar.gz
Update makefile to use a build directory
-rw-r--r--Makefile14
-rw-r--r--src/image.c (renamed from image.c)0
-rw-r--r--src/image.h (renamed from image.h)0
-rw-r--r--src/main.c (renamed from main.c)0
-rw-r--r--src/navigator.c (renamed from navigator.c)0
-rw-r--r--src/navigator.h (renamed from navigator.h)0
-rw-r--r--src/texture.c (renamed from texture.c)0
-rw-r--r--src/texture.h (renamed from texture.h)0
-rw-r--r--src/viewport.c (renamed from viewport.c)0
-rw-r--r--src/viewport.h (renamed from viewport.h)0
10 files changed, 12 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index edfbdc9..b05d4e4 100644
--- a/Makefile
+++ b/Makefile
@@ -6,16 +6,26 @@ CFLAGS = -W -Wall -std=gnu11 `sdl2-config --cflags`
LDFLAGS = `sdl2-config --libs` -lfreeimage
TARGET = imv
-OBJECTS = main.o image.o texture.o navigator.o viewport.o
+BUILDDIR = build
+
+SOURCES = $(wildcard src/*.c)
+OBJECTS = $(patsubst src/%.c,$(BUILDDIR)/%.o,$(SOURCES))
$(TARGET): $(OBJECTS)
$(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
-debug: CFLAGS += -DDEBUG -g
+debug: CFLAGS += -DDEBUG -g -pg
debug: $(TARGET)
+$(BUILDDIR)/%.o: src/%.c $(BUILDDIR)
+ $(CC) -c $(CFLAGS) -o $@ $<
+
+$(BUILDDIR):
+ mkdir -p $(BUILDDIR)
+
clean:
$(RM) $(TARGET) $(OBJECTS)
+ rmdir $(BUILDDIR)
install: $(TARGET)
install -m 0755 $(TARGET) $(prefix)/bin
diff --git a/image.c b/src/image.c
index 8516bf5..8516bf5 100644
--- a/image.c
+++ b/src/image.c
diff --git a/image.h b/src/image.h
index d36dab4..d36dab4 100644
--- a/image.h
+++ b/src/image.h
diff --git a/main.c b/src/main.c
index 2efeec3..2efeec3 100644
--- a/main.c
+++ b/src/main.c
diff --git a/navigator.c b/src/navigator.c
index 408c53c..408c53c 100644
--- a/navigator.c
+++ b/src/navigator.c
diff --git a/navigator.h b/src/navigator.h
index 1bccff6..1bccff6 100644
--- a/navigator.h
+++ b/src/navigator.h
diff --git a/texture.c b/src/texture.c
index 7dd6157..7dd6157 100644
--- a/texture.c
+++ b/src/texture.c
diff --git a/texture.h b/src/texture.h
index 4f805a2..4f805a2 100644
--- a/texture.h
+++ b/src/texture.h
diff --git a/viewport.c b/src/viewport.c
index 1630604..1630604 100644
--- a/viewport.c
+++ b/src/viewport.c
diff --git a/viewport.h b/src/viewport.h
index 2cff15c..2cff15c 100644
--- a/viewport.h
+++ b/src/viewport.h