blob: f002847a52a45247b61898e6484b9b0a25cdce69 (
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
.PHONY: clean check install uninstall
PREFIX ?= /usr
CFLAGS ?= -W -Wall -Wpedantic
CFLAGS += -std=gnu11 $(shell sdl2-config --cflags)
LDFLAGS += $(shell sdl2-config --libs) -lfreeimage -lSDL2_ttf -lfontconfig -lpthread
TARGET = imv
BUILDDIR = build
SOURCES = $(wildcard src/*.c)
OBJECTS = $(patsubst src/%.c,$(BUILDDIR)/%.o,$(SOURCES))
TESTS = $(patsubst test/%.c,test_%,$(wildcard test/*.c))
VERSION = "v1.2.0"
CFLAGS += -DIMV_VERSION=\"$(VERSION)\"
$(TARGET): $(OBJECTS)
@echo "LINKING $@"
@$(CC) -o $@ $^ $(LDLIBS) $(LDFLAGS)
debug: CFLAGS += -DDEBUG -g -pg
debug: $(TARGET)
$(BUILDDIR)/%.o: src/%.c
@mkdir -p $(BUILDDIR)
@echo "COMPILING $@"
@$(CC) -c $(CFLAGS) -o $@ $<
test_%: test/%.c src/%.c
@echo "BUILDING $@"
@$(CC) -o $@ -Isrc -W -Wall -std=gnu11 -lcmocka $^
check: $(TESTS)
@echo "RUNNING TESTS"
@for t in "$(TESTS)"; do ./$$t; done
clean:
@$(RM) $(TARGET) $(OBJECTS) $(TESTS)
install: $(TARGET)
install -D -m 0755 $(TARGET) $(DESTDIR)$(PREFIX)/bin/imv
install -D -m 0644 doc/imv.1 $(DESTDIR)$(PREFIX)/share/man/man1/imv.1
install -D -m 0644 files/imv.desktop $(DESTDIR)$(PREFIX)/share/applications/imv.desktop
uninstall:
$(RM) $(DESTDIR)$(PREFIX)/bin/imv
$(RM) $(DESTDIR)$(PREFIX)/share/man/man1/imv.1
$(RM) $(DESTDIR)$(PREFIX)/share/applications/imv.desktop
|