diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -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 |