forked from vtrlx/telepipe
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
73 lines (57 loc) · 1.73 KB
/
Makefile
File metadata and controls
73 lines (57 loc) · 1.73 KB
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
PACKAGE = ca.vtrlx.Telepipe
VERSION = 1.0
APPID = $(PACKAGE)
ifdef DEVEL
CFLAGS += -DDEVEL
APPID = $(PACKAGE).Devel
endif
ifdef FLATPAK
CFLAGS += -DFLATPAK
endif
PREFIX ?= /usr/local
CSRCS = $(wildcard *.c)
LSRCS = $(wildcard *.lua)
RESXML = data/telepipe.gresource.xml
RES = $(patsubst %.xml, %, $(RESXML))
POTFILE = po/MESSAGES.pot
POFILES = $(wildcard po/*.po)
MOFILES = \
$(patsubst po/%.po, \
locale/%/LC_MESSAGES/messages.mo, \
$(POFILES))
BIN = telepipe
BYTECODE = $(patsubst %.lua, %.bytecode, $(LSRCS))
LIBS = -llua -ldl -lm
CFLAGS += $(LIBS) -Wl,-E -DPACKAGE="$(APPID)" -DVERSION=$(VERSION) -DPREFIX=$(PREFIX)
DESKTOP_FILE = $(APPID).desktop
ICON = $(APPID).svg
SYMBOLIC = $(APPID)-symbolic.svg
ifndef DEVEL
METAINFO = $(PACKAGE).metainfo.xml
endif
all: $(BIN)
$(BIN): $(CSRCS) $(BYTECODE)
cc -o $@ $(CSRCS) -L$(PREFIX)/lib $(CFLAGS)
%.gresource: %.gresource.xml
glib-compile-resources --target=$@ --sourcedir=data $^
%.bytecode: %.lua
luac -o $@ -- $<
locale/%/LC_MESSAGES/messages.mo: po/%.po
@mkdir -p `dirname $@`
msgfmt $< -o $@
po/%.po: $(POTFILE)
[ -f $@ ] || msginit -i $< -o $@ -l $(patsubst po/%.po,%,$@)
msgmerge -U $@ $<
po/MESSAGES.pot: $(LSRCS) $(CSRCS)
xgettext --from-code utf-8 -o $@ $^
.PHONY: clean install
clean:
rm -f $(BIN) $(BYTECODE)
install: $(BIN) $(RES) $(MOFILES)
install -D -m 0755 -t $(PREFIX)/bin $<
cp -r locale $(PREFIX)/share
install -D -m 0644 -t $(PREFIX)/data $(RES)
install -D -m 0644 -t $(PREFIX)/share/applications $(DESKTOP_FILE)
install -D -m 0644 -t $(PREFIX)/share/icons/hicolor/scalable/apps icons/$(ICON)
install -D -m 0644 -t $(PREFIX)/share/icons/hicolor/symbolic/apps icons/$(SYMBOLIC)
if [ -n "$(METAINFO)" ]; then install -D -m 0644 -t $(PREFIX)/share/metainfo $(METAINFO); fi