-
Notifications
You must be signed in to change notification settings - Fork 106
Expand file tree
/
Copy pathMakefile
More file actions
155 lines (136 loc) · 4.75 KB
/
Copy pathMakefile
File metadata and controls
155 lines (136 loc) · 4.75 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
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
PACKAGE = ddccontrol-db
INSTALL = install
INSTALL_DATA = $(INSTALL) -m 644
MKDIR_P = mkdir -p
MSGFMT = msgfmt
XGETTEXT = xgettext
MSGMERGE = msgmerge
PERL = perl
DDCCONTROL = ddccontrol
all: db/options.xml
@set -e; \
. ./build-aux/make-config.sh; \
load_build_config; \
targets=; \
for language in `selected_languages`; do \
targets="$$targets po/$$language.gmo"; \
done; \
if test -n "$$targets"; then $(MAKE) $$targets; fi
.SUFFIXES: .po .gmo
.po.gmo:
$(MSGFMT) --check -o "$@" "$<"
db/options.xml: db/options.xml.in VERSION
@set -e; \
version=`sed -n '1p' VERSION`; \
tmp="$@.tmp"; \
awk -v version="$$version" 'NR == 1 { print; print "<!---Do not edit this file, edit options.xml.in instead.-->"; next } { gsub(/\$$DATE/, version); print }' db/options.xml.in > "$$tmp"; \
mv "$$tmp" "$@"
install: all
@set -e; \
. ./build-aux/make-config.sh; \
load_build_config; \
$(MKDIR_P) "$$destdir_value$$dbdir_value/monitor"; \
$(INSTALL_DATA) db/options.xml "$$destdir_value$$dbdir_value/options.xml"; \
$(INSTALL_DATA) db/monitor/*.xml "$$destdir_value$$dbdir_value/monitor/"; \
for language in `selected_languages`; do \
directory="$$destdir_value$$localedir_value/$$language/LC_MESSAGES"; \
$(MKDIR_P) "$$directory"; \
$(INSTALL_DATA) "po/$$language.gmo" "$$directory/$(PACKAGE).mo"; \
done
uninstall:
@set -e; \
. ./build-aux/make-config.sh; \
load_build_config; \
rm -f "$$destdir_value$$dbdir_value/options.xml"; \
for file in db/monitor/*.xml; do \
rm -f "$$destdir_value$$dbdir_value/monitor/$${file##*/}"; \
done; \
for language in `selected_languages`; do \
rm -f "$$destdir_value$$localedir_value/$$language/LC_MESSAGES/$(PACKAGE).mo"; \
done; \
rmdir "$$destdir_value$$dbdir_value/monitor" "$$destdir_value$$dbdir_value" 2>/dev/null || :
check: all check-version
check-version: db/options.xml
@set -e; \
version=`sed -n '1p' VERSION`; \
case "$$version" in \
[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]) ;; \
*) echo "VERSION must use YYYYMMDD format, got '$$version'" >&2; exit 1 ;; \
esac; \
grep -q "<options date=\"$$version\" dbversion=\"3\">" db/options.xml || { \
echo "db/options.xml does not contain version $$version" >&2; \
exit 1; \
}
check-db: db/options.xml
@set -e; \
command -v "$(DDCCONTROL)" >/dev/null 2>&1 || { \
echo "$(DDCCONTROL) is required for make check-db" >&2; \
exit 1; \
}; \
for file in db/monitor/*.xml; do \
if ! grep -q NOCHECKDB "$$file"; then \
name=$${file##*/}; \
name=$${name%.xml}; \
$(DDCCONTROL) -b db -v -v -i "$$name"; \
fi; \
done
db/options.xml.h: db/options.xml xml2h.pl
$(PERL) xml2h.pl db/options.xml
update-po: db/options.xml.h
@set -e; \
. ./build-aux/make-config.sh; \
load_build_config; \
version=`sed -n '1p' VERSION`; \
$(XGETTEXT) --from-code=UTF-8 --keyword=_ --keyword=N_ \
--package-name="$(PACKAGE)" --package-version="$$version" \
--msgid-bugs-address="ddccontrol-devel@lists.sourceforge.net" \
-o po/$(PACKAGE).pot db/options.xml.h; \
for language in `selected_languages`; do \
$(MSGMERGE) --update --backup=none "po/$$language.po" po/$(PACKAGE).pot; \
done
distdir: all
@set -e; \
. ./build-aux/make-config.sh; \
load_build_config; \
targets=; \
for language in `available_languages`; do \
targets="$$targets po/$$language.gmo"; \
done; \
if test -n "$$targets"; then $(MAKE) $$targets; fi; \
version=`sed -n '1p' VERSION`; \
dist_name="$(PACKAGE)-$$version"; \
dist_root=build/dist; \
dist_directory="$$dist_root/$$dist_name"; \
rm -rf "$$dist_root"; \
$(MKDIR_P) "$$dist_directory"; \
git ls-files --cached | \
while IFS= read -r file; do test ! -e "$$file" || printf '%s\n' "$$file"; done \
> build/dist-files; \
COPYFILE_DISABLE=1 tar --no-xattrs -cf - -T build/dist-files | \
COPYFILE_DISABLE=1 tar --no-xattrs -xf - -C "$$dist_directory"; \
$(INSTALL_DATA) db/options.xml "$$dist_directory/db/options.xml"; \
for language in `available_languages`; do \
$(INSTALL_DATA) "po/$$language.gmo" "$$dist_directory/po/"; \
done
dist-gzip: distdir
@set -e; \
version=`sed -n '1p' VERSION`; \
dist_name="$(PACKAGE)-$$version"; \
COPYFILE_DISABLE=1 tar --no-xattrs -C build/dist -czf "$$PWD/$$dist_name.tar.gz" "$$dist_name"
dist-bzip2: distdir
@set -e; \
version=`sed -n '1p' VERSION`; \
dist_name="$(PACKAGE)-$$version"; \
COPYFILE_DISABLE=1 tar --no-xattrs -C build/dist -cjf "$$PWD/$$dist_name.tar.bz2" "$$dist_name"
dist-xz: distdir
@set -e; \
version=`sed -n '1p' VERSION`; \
dist_name="$(PACKAGE)-$$version"; \
COPYFILE_DISABLE=1 tar --no-xattrs -C build/dist -cJf "$$PWD/$$dist_name.tar.xz" "$$dist_name"
dist: dist-gzip dist-bzip2 dist-xz
clean:
rm -f db/options.xml db/options.xml.h po/*.gmo po/$(PACKAGE).pot
rm -rf build
distclean: clean
rm -f config.sh config.mk
rm -f $(PACKAGE)-*.tar.gz $(PACKAGE)-*.tar.bz2 $(PACKAGE)-*.tar.xz