-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
52 lines (46 loc) · 1.57 KB
/
Makefile
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
VERSION := $(shell cat VERSION)
CFLAGS = `pkg-config --cflags gtk+-3.0` -Dpver=\"$(VERSION)\"
CC = cc
LIBS = `pkg-config --libs gtk+-3.0`
SRC = sglauncher.c
OBJ = $(SRC:.c=.o)
EXE = sglauncher
LOCALEDIR = po
LOCALE_INSTALL_DIR = $(PREFIX)/share/locale
LANGUAGES = es
DOMAIN = $(EXE)
PREFIX = /usr
BIN_DIR = $(PREFIX)/bin
APP_DIR = $(PREFIX)/share/applications
all: $(EXE) compile-locales
sglauncher: sglauncher.o
$(CC) $(CFLAGS) -o $@ $< $(LIBS) -lm
compile-locales:
xgettext --language=C --keyword=_ --output=po/messages.pot *.c *.h
@for lang in $(LANGUAGES); do \
mkdir -p $(LOCALEDIR)/$$lang/LC_MESSAGES; \
echo "Updating .po file for locale: $$lang"; \
msgmerge --update $(LOCALEDIR)/$$lang/$(DOMAIN).po po/messages.pot; \
echo "Compiling locale: $$lang"; \
msgfmt $(LOCALEDIR)/$$lang/$(DOMAIN).po --output-file=$(LOCALEDIR)/$$lang/LC_MESSAGES/$(DOMAIN).mo --verbose; \
done
debug: sglauncher.o
$(CC) $(CFLAGS) -o $@ $< $(LIBS) -lm -g
test:
./$(EXE)
install:
install -Dvm755 $(EXE) $(BIN_DIR)/$(EXE)
install -Dvm644 $(EXE)-cfg.desktop $(APP_DIR)/$(EXE)-cfg.desktop
install -Dvm644 icons/$(EXE).svg $(PREFIX)/share/icons/hicolor/48x48/apps/$(EXE).svg
@for lang in $(LANGUAGES); do \
install -Dvm644 $(LOCALEDIR)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(LOCALE_INSTALL_DIR)/$$lang/LC_MESSAGES/$(DOMAIN).mo; \
done
uninstall:
rm -v $(BIN_DIR)/$(EXE)
rm -v $(APP_DIR)/$(EXE)-cfg.desktop
rm -v $(PREFIX)/share/icons/hicolor/64x64/apps/sglauncher.svg
@for lang in $(LANGUAGES); do \
rm -f $(LOCALE_INSTALL_DIR)/$$lang/LC_MESSAGES/$(DOMAIN).mo; \
done
clean:
rm -f $(OBJ) $(EXE) debug