aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: a30cd0a56bbaa644c04ee8942adb2a326064adbe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
.PHONY: clean install

prefix = /usr

CFLAGS = -W -Wall -std=gnu11 `sdl2-config --cflags`
LDFLAGS = `sdl2-config --libs` -lfreeimage

TARGET = imv
BUILDDIR = build

SOURCES = $(wildcard src/*.c)
OBJECTS = $(patsubst src/%.c,$(BUILDDIR)/%.o,$(SOURCES))

VERSION = "v1.0.0"

CFLAGS += -DIMV_VERSION=\"$(VERSION)\"

$(TARGET): $(OBJECTS)
	@echo "LINKING $@"
	@$(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)

debug: CFLAGS += -DDEBUG -g -pg
debug: $(TARGET)

$(BUILDDIR)/%.o: src/%.c
	@mkdir -p $(BUILDDIR)
	@echo "COMPILING $@"
	@$(CC) -c $(CFLAGS) -o $@ $<

clean:
	@$(RM) $(TARGET) $(OBJECTS)

install: $(TARGET)
	install -D -m 0755 $(TARGET) $(DESTDIR)$(prefix)/bin/$(TARGET)
	install -D -m 0644 doc/imv.1 $(DESTDIR)$(prefix)/share/man/man1/imv.1