summaryrefslogtreecommitdiff
path: root/Makefile
blob: 5cacdd5b098e47e3795ddf8d6781a0b3781d4e67 (plain)
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
V=$(shell git describe --exact-match)

PREFIX = /usr/local
MANDIR = $(PREFIX)/share/man

IN_PROGS = \
	archco \
	arch-nspawn \
	archrelease \
	archbuild \
	checkpkg \
	commitpkg \
	crossrepomove\
	finddeps \
	find-libdeps \
	lddd \
	makerepropkg \
	mkarchroot \
	makechrootpkg \
	offload-build \
	rebuildpkgs \
	sogrep

BINPROGS = \
	$(IN_PROGS)

GENERATED_CONFIGFILES = \
	pacman-extra-armv6h.conf \
	pacman-extra-i486.conf \
	pacman-extra-i686.conf \
	pacman-extra-pentium4.conf \
	pacman-testing-armv6h.conf \
	pacman-testing-i486.conf \
	pacman-testing-i686.conf \
	pacman-testing-pentium4.conf \
	pacman-staging-armv6h.conf \
	pacman-staging-i486.conf \
	pacman-staging-i686.conf \
	pacman-staging-pentium4.conf \
	pacman-staging-with-build-support-i486.conf \
	pacman-staging-with-build-support-i686.conf \
	pacman-staging-with-build-support-pentium4.conf \
	pacman-kde-unstable-armv6h.conf \
	pacman-kde-unstable-i486.conf \
	pacman-kde-unstable-i686.conf \
	pacman-kde-unstable-pentium4.conf \
	pacman-gnome-unstable-armv6h.conf \
	pacman-gnome-unstable-i486.conf \
	pacman-gnome-unstable-i686.conf \
	pacman-gnome-unstable-pentium4.conf \
	pacman-archlinuxewe-armv6h.conf \
	pacman-archlinuxewe-i486.conf \
	pacman-archlinuxewe-i686.conf \
	pacman-archlinuxewe-pentium4.conf \
	makepkg-armv6h.conf \
	makepkg-i486.conf \
	makepkg-i686.conf \
	makepkg-pentium4.conf

CONFIGFILES = \
	makepkg-x86_64.conf \
	pacman-extra.conf \
	pacman-testing.conf \
	pacman-staging.conf \
	pacman-multilib.conf \
	pacman-multilib-testing.conf \
	pacman-multilib-staging.conf \
	pacman-kde-unstable.conf \
	pacman-gnome-unstable.conf \
	pacman-archlinuxewe.conf \
	$(GENERATED_CONFIGFILES)

SETARCH_ALIASES = \
	armv6h \
	pentium4

COMMITPKG_LINKS = \
	extrapkg \
	testingpkg \
	stagingpkg \
	communitypkg \
	community-testingpkg \
	community-stagingpkg \
	multilibpkg \
	multilib-testingpkg \
	multilib-stagingpkg \
	kde-unstablepkg \
	gnome-unstablepkg

ARCHBUILD_LINKS = \
	extra-armv6h-build \
	extra-i486-build \
	extra-i686-build \
	extra-pentium4-build \
	extra-x86_64-build \
	testing-armv6h-build \
	testing-i486-build \
	testing-i686-build \
	testing-pentium4-build \
	testing-x86_64-build \
	staging-armv6h-build \
	staging-i486-build \
	staging-i686-build \
	staging-pentium4-build \
	staging-x86_64-build \
	staging-with-build-support-i486-build \
	staging-with-build-support-i686-build \
	staging-with-build-support-pentium4-build \
	multilib-build \
	multilib-testing-build \
	multilib-staging-build \
	kde-unstable-armv6h-build \
	kde-unstable-i486-build \
	kde-unstable-i686-build \
	kde-unstable-pentium4-build \
	kde-unstable-x86_64-build \
	gnome-unstable-armv6h-build \
	gnome-unstable-i486-build \
	gnome-unstable-i686-build \
	gnome-unstable-pentium4-build \
	gnome-unstable-x86_64-build \
	archlinuxewe-armv6h-build \
	archlinuxewe-i486-build \
	archlinuxewe-i686-build \
	archlinuxewe-pentium4-build \
	archlinuxewe-x86_64-build

CROSSREPOMOVE_LINKS = \
	extra2community \
	community2extra

BASHCOMPLETION_LINKS = \
	archco \
	communityco


MANS = \
	doc/lddd.1 \
	doc/checkpkg.1 \
	doc/offload-build.1 \
	doc/sogrep.1 \
	doc/makerepropkg.1 \
	doc/mkarchroot.1 \
	doc/find-libdeps.1 \
	doc/find-libprovides.1


all: $(GENERATED_CONFIGFILES) $(BINPROGS) bash_completion zsh_completion man
man: $(MANS)

edit = sed -e "s|@pkgdatadir[@]|$(PREFIX)/share/devtools|g"

makepkg-armv6h.conf: makepkg-x86_64.conf
	@echo "GEN $@"
	@sed " s/^CARCH=.*\$$/CARCH=\"armv6h\"/g; \
		s/^CHOST=.*\$$/CHOST=\"armv6l-unknown-linux-gnueabihf\"/g; \
		s/^\(C\(XX\)\?FLAGS=\).*\$$/\1\"-march=armv6 -mfloat-abi=hard -mfpu=vfp -O2 -pipe -fstack-protector-strong -fno-plt\"/g; \
	" "$<" > "$@"

makepkg-i486.conf: makepkg-x86_64.conf
	@echo "GEN $@"
	@sed 's,\(["=]\)x86[-_]64\([-" ]\),\1i486\2,g' "$<" > "$@"

makepkg-i686.conf: makepkg-x86_64.conf
	@echo "GEN $@"
	@sed 's,\(["=]\)x86[-_]64\([-" ]\),\1i686\2,g' "$<" > "$@"

makepkg-pentium4.conf: makepkg-i686.conf
	@echo "GEN $@"
	@sed '/^CHOST=/ ! s,\(["=]\)i686\([-" ]\),\1pentium4\2,g' "$<" > "$@"

pacman-archlinuxewe-i486.conf: pacman-archlinuxewe.conf
	@echo "GEN $@"
	@sed " \
	/\[\(community-\)\?testing\]/{ N; s/#//g; }; \
	/^Architecture = / s/^.*\$$/Architecture = i486/; \
	" "$<" > "$@"

pacman-archlinuxewe-i686.conf: pacman-archlinuxewe.conf
	@echo "GEN $@"
	@sed " \
	/\[\(community-\)\?testing\]/{ N; s/#//g; }; \
	/^Architecture = / s/^.*\$$/Architecture = i686/; \
	" "$<" > "$@"

pacman-archlinuxewe-pentium4.conf: pacman-archlinuxewe.conf
	@echo "GEN $@"
	@sed " \
	/\[\(community-\)\?testing\]/{ N; s/#//g; }; \
	/^Architecture = / s/^.*\$$/Architecture = pentium4/; \
	" "$<" > "$@"

pacman-%-armv6h.conf: pacman-%.conf
	@echo "GEN $@"
	@sed " \
	/^Architecture = / s/^.*\$$/Architecture = armv6h/; \
	" "$<" > "$@"

pacman-%-i486.conf: pacman-%.conf
	@echo "GEN $@"
	@sed " \
	/^Architecture = / s/^.*\$$/Architecture = i486/; \
	" "$<" > "$@"

pacman-%-i686.conf: pacman-%.conf
	@echo "GEN $@"
	@sed " \
	/^Architecture = / s/^.*$$/Architecture = i686/ \
	" "$<" > "$@"

pacman-%-pentium4.conf: pacman-%.conf
	@echo "GEN $@"
	@sed " \
	/^Architecture = / s/^.*$$/Architecture = pentium4/ \
	" "$<" > "$@"

%: %.in Makefile lib/common.sh
	@echo "GEN $@"
	@$(RM) "$@"
	@{ echo -n 'm4_changequote([[[,]]])'; cat $@.in; } | m4 -P | $(edit) >$@
	@chmod a-w "$@"
	@chmod +x "$@"
	@bash -O extglob -n "$@"

$(MANS): doc/asciidoc.conf doc/footer.asciidoc

doc/%: doc/%.asciidoc
	a2x --no-xmllint --asciidoc-opts="-f doc/asciidoc.conf" -d manpage -f manpage -D doc $<

clean:
	rm -f $(GENERATED_CONFIGFILES) $(IN_PROGS) bash_completion zsh_completion $(MANS)

install:
	install -dm0755 $(DESTDIR)$(PREFIX)/bin
	install -dm0755 $(DESTDIR)$(PREFIX)/share/devtools/setarch-aliases.d
	install -m0755 ${BINPROGS} $(DESTDIR)$(PREFIX)/bin
	install -m0644 ${CONFIGFILES} $(DESTDIR)$(PREFIX)/share/devtools
	for a in ${SETARCH_ALIASES}; do install -m0644 setarch-aliases.d/$$a $(DESTDIR)$(PREFIX)/share/devtools/setarch-aliases.d; done
	for l in ${COMMITPKG_LINKS}; do ln -sf commitpkg $(DESTDIR)$(PREFIX)/bin/$$l; done
	for l in ${ARCHBUILD_LINKS}; do ln -sf archbuild $(DESTDIR)$(PREFIX)/bin/$$l; done
	for l in ${CROSSREPOMOVE_LINKS}; do ln -sf crossrepomove $(DESTDIR)$(PREFIX)/bin/$$l; done
	ln -sf find-libdeps $(DESTDIR)$(PREFIX)/bin/find-libprovides
	install -Dm0644 bash_completion $(DESTDIR)/usr/share/bash-completion/completions/devtools
	for l in ${BASHCOMPLETION_LINKS}; do ln -sf devtools $(DESTDIR)/usr/share/bash-completion/completions/$$l; done
	install -Dm0644 zsh_completion $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_devtools
	ln -sf archco $(DESTDIR)$(PREFIX)/bin/communityco
	for manfile in $(MANS); do \
		install -Dm644 $$manfile -t $(DESTDIR)$(MANDIR)/man$${manfile##*.}; \
	done;

uninstall:
	for f in ${BINPROGS}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$f; done
	for f in ${CONFIGFILES}; do rm -f $(DESTDIR)$(PREFIX)/share/devtools/$$f; done
	for f in ${SETARCH_ALIASES}; do rm -f $(DESTDIR)$(PREFIX)/share/devtools/setarch-aliases.d/$$f; done
	for l in ${COMMITPKG_LINKS}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$l; done
	for l in ${ARCHBUILD_LINKS}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$l; done
	for l in ${CROSSREPOMOVE_LINKS}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$l; done
	rm $(DESTDIR)/usr/share/bash-completion/completions/devtools
	rm $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_devtools
	rm -f $(DESTDIR)$(PREFIX)/bin/communityco
	rm -f $(DESTDIR)$(PREFIX)/bin/find-libprovides
	for manfile in $(MANS); do \
		rm -f $(DESTDIR)$(MANDIR)/man$${manfile##*.}/$${manfile#doc/}; \
	done;

TODAY=$(shell date +"%Y%m%d")
tag:
	@sed -E "s|^V=[0-9]{8}|V=$(TODAY)|" -i Makefile
	@git commit --gpg-sign --message "Version $(TODAY)" Makefile
	@git tag --sign --message "Version $(TODAY)" $(TODAY)

dist:
	git archive --format=tar --prefix=devtools32-$(V)/ $(V) | gzip -9 > devtools32-$(V).tar.gz
	gpg --detach-sign --use-agent devtools32-$(V).tar.gz

upload:
	scp devtools32-$(V).tar.gz devtools32-$(V).tar.gz.sig sources.archlinux32.org:sources/

check: $(BINPROGS) bash_completion makepkg-x86_64.conf PKGBUILD.proto
	shellcheck $^

.PHONY: all clean install uninstall dist upload check tag
.DELETE_ON_ERROR: