aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile56
1 files changed, 48 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index d7710e9..dbb4e39 100644
--- a/Makefile
+++ b/Makefile
@@ -1,12 +1,14 @@
1 1
2SOURCE_DIR = src/ 2RESOURCES_DIR = resources/
3INSTALL_DIR ?= /usr/local/ 3SOURCE_DIR = src/
4INSTALL_DIR ?= /usr/local/
4 5
5BINARY = messenger-gtk 6BINARY = messenger-gtk
6SOURCES = messenger_gtk.c\ 7SOURCES = messenger_gtk.c\
7 application.c\ 8 application.c\
8 contact.c\ 9 contact.c\
9 event.c\ 10 event.c\
11 resources.c\
10 chat/messenger.c\ 12 chat/messenger.c\
11 ui/chat.c\ 13 ui/chat.c\
12 ui/chat_entry.c\ 14 ui/chat_entry.c\
@@ -23,8 +25,11 @@ SOURCES = messenger_gtk.c\
23 ui/profile_entry.c\ 25 ui/profile_entry.c\
24 ui/send_file.c\ 26 ui/send_file.c\
25 ui/settings.c 27 ui/settings.c
26 28
27HEADERS = 29HEADERS = util.h
30
31RESOURCES = css.gresource.xml\
32 ui.gresource.xml
28 33
29LIBRARIES = gnunetchat 34LIBRARIES = gnunetchat
30PACKAGES = gnunetutil libhandy-1 gtk+-3.0 libnotify zbar libqrencode 35PACKAGES = gnunetutil libhandy-1 gtk+-3.0 libnotify zbar libqrencode
@@ -34,21 +39,43 @@ GNU_CC ?= gcc
34GNU_LD ?= gcc 39GNU_LD ?= gcc
35GNU_RM ?= rm 40GNU_RM ?= rm
36 41
37CFLAGS += -pedantic -Wall -Wextra -ggdb3 42GLIB_COMPILE_RESOURCES ?= glib-compile-resources
43
44CFLAGS += -pedantic -Wall -Wextra -ggdb3 -Wno-overlength-strings
38LDFLAGS += 45LDFLAGS +=
39 46
40DEBUGFLAGS = -O0 -D _DEBUG 47DEBUGFLAGS = -O0 -D _DEBUG
41RELEASEFLAGS = -O2 -D NDEBUG 48RELEASEFLAGS = -O2 -D NDEBUG
42 49
43SOURCE_FILES = $(addprefix $(SOURCE_DIR), $(SOURCES)) 50ICON_SIZES = 32\
44OBJECT_FILES = $(SOURCE_FILES:%.c=%.o) 51 64\
52 128\
53 256\
54 512
55
56APPICON_DIR = $(addprefix $(RESOURCES_DIR), icon/)
57
58RESOURCES_FILES = $(addprefix $(RESOURCES_DIR), $(RESOURCES))
59
60SOURCE_FILES = $(RESOURCES_FILES:%.gresource.xml=%.c)\
61 $(addprefix $(SOURCE_DIR), $(SOURCES))
62
63RESOURCES_HEADERS = $(RESOURCES_FILES:%.gresource.xml=%.h)
64
45HEADER_FILES = $(addprefix $(SOURCE_DIR), $(HEADERS)) 65HEADER_FILES = $(addprefix $(SOURCE_DIR), $(HEADERS))
66
67OBJECT_FILES = $(SOURCE_FILES:%.c=%.o)
68
46LIBRARY_FLAGS = $(addprefix -l, $(LIBRARIES)) 69LIBRARY_FLAGS = $(addprefix -l, $(LIBRARIES))
47PACKAGE_FLAGS = $(shell pkg-config --cflags --libs $(PACKAGES)) 70PACKAGE_FLAGS = $(shell pkg-config --cflags --libs $(PACKAGES))
48INCLUDE_FLAGS = $(addprefix -I, $(INCLUDES)) 71INCLUDE_FLAGS = $(addprefix -I, $(INCLUDES))
49 72
50all: $(BINARY) 73all: $(BINARY)
51 74
75%.c: %.gresource.xml
76 $(GLIB_COMPILE_RESOURCES) --sourcedir=$(RESOURCES_DIR) $< --generate-source
77 $(GLIB_COMPILE_RESOURCES) --sourcedir=$(RESOURCES_DIR) $< --generate-header
78
52debug: CFLAGS += $(DEBUGFLAGS) 79debug: CFLAGS += $(DEBUGFLAGS)
53debug: $(BINARY) 80debug: $(BINARY)
54 81
@@ -68,16 +95,29 @@ mobile: $(BINARY)
68 95
69.PHONY: install 96.PHONY: install
70 97
98define install-icon
99 install -Dm644 $(addprefix $(APPICON_DIR), full_color_$(1).png) $(addprefix $(INSTALL_DIR), share/icons/hicolor/$(1)x$(1)/apps/$(BINARY).png)
100endef
101
71install: 102install:
72 install -m 755 $(BINARY) $(addprefix $(INSTALL_DIR), bin/) 103 install -Dm755 $(BINARY) $(addprefix $(INSTALL_DIR), bin/)
104 $(foreach SIZE,$(ICON_SIZES),$(call install-icon,$(SIZE));)
105 install -Dm644 $(addprefix $(RESOURCES_DIR), $(BINARY).desktop) $(addprefix $(INSTALL_DIR), share/applications/)
73 106
74.PHONY: uninstall 107.PHONY: uninstall
75 108
109define uninstall-icon
110 $(GNU_RM) -f $(addprefix $(INSTALL_DIR), share/icons/hicolor/$(1)x$(1)/apps/$(BINARY).png)
111endef
112
76uninstall: 113uninstall:
77 $(GNU_RM) -f $(addsuffix $(BINARY), $(addprefix $(INSTALL_DIR), bin/)) 114 $(GNU_RM) -f $(addsuffix $(BINARY), $(addprefix $(INSTALL_DIR), bin/))
115 $(foreach SIZE,$(ICON_SIZES),$(call uninstall-icon,$(SIZE)))
116 $(GNU_RM) -f $(addsuffix $(BINARY).desktop, $(addprefix $(INSTALL_DIR), share/applications/))
78 117
79.PHONY: clean 118.PHONY: clean
80 119
81clean: 120clean:
82 $(GNU_RM) -f $(BINARY) 121 $(GNU_RM) -f $(BINARY)
83 $(GNU_RM) -f $(OBJECT_FILES) 122 $(GNU_RM) -f $(OBJECT_FILES)
123 $(GNU_RM) -f $(RESOURCES_HEADERS)