blob: f3af4a5b6a688675b990786de410a09d574838d7 (
plain) (
blame)
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
52
53
54
55
56
57
58
59
|
SOURCE_DIR = src/
INSTALL_DIR ?= /usr/local/
BINARY = messenger-gtk
SOURCES = messenger_gtk.c\
chat/messenger.c\
ui/messenger.c
HEADERS =
LIBRARIES = gnunetutil gnunetchat
PACKAGES = libhandy-1 gtk+-3.0 libnotify
CC ?= gcc
LD ?= gcc
RM ?= rm
CFLAGS += -pedantic -Wall -Wextra -march=native -ggdb3
LDFLAGS +=
DEBUGFLAGS = -O0 -D _DEBUG
RELEASEFLAGS = -O2 -D NDEBUG -fwhole-program
SOURCE_FILES = $(addprefix $(SOURCE_DIR), $(SOURCES))
OBJECT_FILES = $(SOURCE_FILES:%.c=%.o)
HEADER_FILES = $(addprefix $(SOURCE_DIR), $(HEADERS))
LIBRARY_FLAGS = $(addprefix -l, $(LIBRARIES))
PACKAGE_FLAGS = $(shell pkg-config --cflags --libs $(PACKAGES))
all: $(BINARY)
debug: CFLAGS += $(DEBUGFLAGS)
debug: $(BINARY)
release: CFLAGS += $(RELEASEFLAGS)
release: $(BINARY)
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@ $(LIBRARY_FLAGS) $(PACKAGE_FLAGS)
$(BINARY): $(OBJECT_FILES)
$(LD) $(LDFLAGS) $^ -o $@ $(LIBRARY_FLAGS) $(PACKAGE_FLAGS)
.PHONY: install
install:
install -m 755 $(BINARY) $(addprefix $(INSTALL_DIR), bin/)
.PHONY: uninstall
uninstall:
$(RM) -f $(addsuffix $(BINARY), $(addprefix $(INSTALL_DIR), bin/))
.PHONY: clean
clean:
$(RM) -f $(BINARY)
$(RM) -f $(OBJECT_FILES)
|