-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
63 lines (43 loc) · 1.82 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
53
54
55
56
57
58
59
60
61
62
63
BASENAME=geanygsantnerutils
CFLAGS=`pkg-config --cflags geany` -fPIC -Wall -pedantic -O3 -DLOCALEDIR=\"\" -DGETTEXT_PACKAGE=\"geany-gsantnerutils\"
LDLIBS=`pkg-config --libs geany`
PLUGINDIR_SYSTEM=`pkg-config --variable=libdir geany`/geany
PLUGINDIR_USER="$${HOME}/.config/geany/plugins"
.PHONY: build rebuild clean install install-link all
######################################################################################################
$(BASENAME).so: $(BASENAME).o $(OBJS)
gcc -shared -o $@ $(LDLIBS) $^
$(BASENAME).o: $(BASENAME).c compile_flags.txt
######################################################################################################
all: clean build install
rebuild: clean build
compile_flags.txt:
echo -xc $(CFLAGS) | tr ' ' '\n' > compile_flags.txt
build:
@echo "\nBuild..."
# $(MAKE) po/$(BASENAME)-de.mo
$(MAKE) $(BASENAME).so
clean:
@echo "\nClean..."
rm -f *.o *.so compile_flags.txt
# Install to system
install-system: build
@echo "\nInstall..."
sudo rm -f "$(PLUGINDIR_SYSTEM)/$(BASENAME).so"
sudo cp "$(BASENAME).so" "$(PLUGINDIR_SYSTEM)"
# Install to home
install: build
@echo "\nInstall..."
mkdir -p "$(PLUGINDIR_USER)"
rm -f "$(PLUGINDIR_USER)/$(BASENAME).so"
cp "$(BASENAME).so" "$(PLUGINDIR_USER)"
######################################################################################################
# Translation
po/$(BASENAME)-de.mo: po/$(BASENAME)-de.po
msgfmt --output-file=$@ $<
po/$(BASENAME)-de.po: po/$(BASENAME).pot
msginit --input=po/$(BASENAME).pot --locale=de --output=po/$(BASENAME)-de.po
msgmerge --update $@ $<
po/$(BASENAME).pot: $(BASENAME).c
xgettext --keyword=_ --language=C --from-code=UTF-8 --add-comments --sort-output -o po/$(BASENAME).pot $(BASENAME).c
######################################################################################################