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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
APP_ID = org.gnunet.Messenger
RESOURCES_DIR = resources/
SOURCE_DIR = src/
INSTALL_DIR ?= /usr/local/
BINARY = messenger-gtk
SOURCES = messenger_gtk.c\
application.c\
bindings.c\
contact.c\
event.c\
file.c\
resources.c\
chat/messenger.c\
ui/account_entry.c\
ui/accounts.c\
ui/chat_entry.c\
ui/chat.c\
ui/contact_entry.c\
ui/contacts.c\
ui/delete_messages.c\
ui/file_load_entry.c\
ui/invite_contact.c\
ui/message.c\
ui/messenger.c\
ui/new_account.c\
ui/new_contact.c\
ui/new_group.c\
ui/new_platform.c\
ui/picker.c\
ui/send_file.c\
ui/settings.c
HEADERS = util.h
RESOURCES = css.gresource.xml\
ui.gresource.xml
LIBRARIES = gnunetchat
PACKAGES = gnunetutil libhandy-1 gtk+-3.0 libnotify zbar libqrencode
INCLUDES = submodules/gnome-characters/lib
GNU_CC ?= gcc
GNU_LD ?= gcc
GNU_RM ?= rm
GLIB_COMPILE_RESOURCES ?= glib-compile-resources
CFLAGS += -pedantic -Wall -Wextra -ggdb3 -Wno-overlength-strings
LDFLAGS +=
DEBUGFLAGS = -O0 -D _DEBUG
RELEASEFLAGS = -O2 -D NDEBUG
ICON_SIZES = 32\
64\
128\
256\
512
APPICON_DIR = $(addprefix $(RESOURCES_DIR), icon/)
RESOURCES_FILES = $(addprefix $(RESOURCES_DIR), $(RESOURCES))
SOURCE_FILES = $(RESOURCES_FILES:%.gresource.xml=%.c)\
$(addprefix $(SOURCE_DIR), $(SOURCES))
RESOURCES_HEADERS = $(RESOURCES_FILES:%.gresource.xml=%.h)
HEADER_FILES = $(addprefix $(SOURCE_DIR), $(HEADERS))
OBJECT_FILES = $(SOURCE_FILES:%.c=%.o)
LIBRARY_FLAGS = $(addprefix -l, $(LIBRARIES))
PACKAGE_FLAGS = $(shell pkg-config --cflags --libs $(PACKAGES))
INCLUDE_FLAGS = $(addprefix -I, $(INCLUDES))
all: $(BINARY)
%.c: %.gresource.xml
$(GLIB_COMPILE_RESOURCES) --sourcedir=$(RESOURCES_DIR) $< --generate-source
$(GLIB_COMPILE_RESOURCES) --sourcedir=$(RESOURCES_DIR) $< --generate-header
debug: CFLAGS += $(DEBUGFLAGS)
debug: $(BINARY)
release: CFLAGS += $(RELEASEFLAGS)
release: $(BINARY)
%.o: %.c
$(GNU_CC) $(CFLAGS) -c $< -o $@ $(LIBRARY_FLAGS) $(PACKAGE_FLAGS) $(INCLUDE_FLAGS)
$(BINARY): $(OBJECT_FILES)
$(GNU_LD) $(LDFLAGS) $^ -o $@ $(LIBRARY_FLAGS) $(PACKAGE_FLAGS)
.PHONY: mobile
mobile: $(BINARY)
./$(BINARY) --mobile
.PHONY: install
define install-icon
install -Dm644 $(addprefix $(APPICON_DIR), full_color_$(1).png) $(addprefix $(INSTALL_DIR), share/icons/hicolor/$(1)x$(1)/apps/$(APP_ID).png)
endef
install:
install -Dm755 $(BINARY) $(addprefix $(INSTALL_DIR), bin/)
$(foreach SIZE,$(ICON_SIZES),$(call install-icon,$(SIZE));)
install -Dm644 $(addprefix $(APPICON_DIR), full_color.svg) $(addprefix $(INSTALL_DIR), share/icons/hicolor/scalable/apps/$(APP_ID).svg)
desktop-file-install --dir=$(addprefix $(INSTALL_DIR), share/applications/) $(addprefix $(RESOURCES_DIR), $(APP_ID).desktop)
.PHONY: uninstall
define uninstall-icon
$(GNU_RM) -f $(addprefix $(INSTALL_DIR), share/icons/hicolor/$(1)x$(1)/apps/$(APP_ID).png)
endef
uninstall:
$(GNU_RM) -f $(addsuffix $(BINARY), $(addprefix $(INSTALL_DIR), bin/))
$(foreach SIZE,$(ICON_SIZES),$(call uninstall-icon,$(SIZE));)
$(GNU_RM) -f $(addprefix $(INSTALL_DIR), share/icons/hicolor/scalable/apps/$(APP_ID).svg)
$(GNU_RM) -f $(addsuffix $(APP_ID).desktop, $(addprefix $(INSTALL_DIR), share/applications/))
.PHONY: clean
clean:
$(GNU_RM) -f $(BINARY)
$(GNU_RM) -f $(OBJECT_FILES)
$(GNU_RM) -f $(RESOURCES_HEADERS)
|