aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 0b7843a0237db639cd01f4a54328f795b09b3120 (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
.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))

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

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
	install -m 0644 doc/imv.1 $(prefix)/share/man/man1