Makefile.am 8.41 KB
Newer Older
1
2
# enforce that all scripts have a --help and --version option
AUTOMAKE_OPTIONS = std-options
Alad Wenter's avatar
Alad Wenter committed
3
AM_INSTALLCHECK_STD_OPTIONS_EXEMPT = \
4
	$(WRAPPER)
5

6
7
SUBDIRS = po

8
9
10
pkgconfigdir = $(datarootdir)/pkgconfig
pkgconfig_DATA = libmakepkg.pc

11
bin_SCRIPTS = \
12
	$(OURSCRIPTS) \
Florian Pritz's avatar
Florian Pritz committed
13
	makepkg-template \
14
	repo-remove \
15
16
	repo-elephant \
	$(WRAPPER)
17
18

OURSCRIPTS = \
19
	makepkg \
20
	pacman-db-upgrade \
21
	pacman-key \
22
	repo-add
23

24
EXTRA_DIST = \
25
	meson.build \
26
	libmakepkg.pc.in \
27
	makepkg.sh.in \
Florian Pritz's avatar
Florian Pritz committed
28
	makepkg-template.pl.in \
29
	pacman-db-upgrade.sh.in \
30
	pacman-key.sh.in \
31
	repo-add.sh.in \
32
	wrapper.sh.in \
33
	$(COMPLETION_DIST) \
34
35
	$(LIBRARY) \
	$(LIBMAKEPKG_DIST)
36
37

LIBRARY = \
Dave Reisner's avatar
Dave Reisner committed
38
	library/human_to_size.sh
39

40
41
42
libmakepkgdir = $(datarootdir)/makepkg

LIBMAKEPKGDIRS = \
43
	buildenv \
44
	executable \
45
	integrity \
46
	lint_config \
47
	lint_package \
48
	lint_pkgbuild \
49
	source \
50
	tidy \
51
52
53
	util

LIBMAKEPKG_IN = \
54
55
56
57
58
59
60
61
62
63
64
	libmakepkg/executable.sh \
	libmakepkg/executable/ccache.sh \
	libmakepkg/executable/checksum.sh \
	libmakepkg/executable/distcc.sh \
	libmakepkg/executable/fakeroot.sh \
	libmakepkg/executable/gpg.sh \
	libmakepkg/executable/gzip.sh \
	libmakepkg/executable/pacman.sh \
	libmakepkg/executable/strip.sh \
	libmakepkg/executable/sudo.sh \
	libmakepkg/executable/vcs.sh \
65
66
67
68
69
	libmakepkg/buildenv.sh \
	libmakepkg/buildenv/buildflags.sh \
	libmakepkg/buildenv/compiler.sh \
	libmakepkg/buildenv/debugflags.sh \
	libmakepkg/buildenv/makeflags.sh \
70
71
72
73
74
	libmakepkg/integrity.sh \
	libmakepkg/integrity/generate_checksum.sh \
	libmakepkg/integrity/generate_signature.sh \
	libmakepkg/integrity/verify_checksum.sh \
	libmakepkg/integrity/verify_signature.sh \
75
	libmakepkg/lint_config.sh \
76
	libmakepkg/lint_config/ext.sh \
77
	libmakepkg/lint_config/paths.sh \
78
	libmakepkg/lint_config/source_date_epoch.sh \
79
	libmakepkg/lint_config/variable.sh \
80
81
	libmakepkg/lint_package.sh \
	libmakepkg/lint_package/build_references.sh \
82
	libmakepkg/lint_package/dotfiles.sh \
83
	libmakepkg/lint_package/file_names.sh \
84
	libmakepkg/lint_package/missing_backup.sh \
85
86
	libmakepkg/lint_pkgbuild.sh \
	libmakepkg/lint_pkgbuild/arch.sh \
87
	libmakepkg/lint_pkgbuild/arch_specific.sh \
88
89
	libmakepkg/lint_pkgbuild/backup.sh \
	libmakepkg/lint_pkgbuild/changelog.sh \
90
91
92
	libmakepkg/lint_pkgbuild/checkdepends.sh \
	libmakepkg/lint_pkgbuild/conflicts.sh \
	libmakepkg/lint_pkgbuild/depends.sh \
93
	libmakepkg/lint_pkgbuild/epoch.sh \
94
	libmakepkg/lint_pkgbuild/fullpkgver.sh \
95
	libmakepkg/lint_pkgbuild/install.sh \
96
	libmakepkg/lint_pkgbuild/makedepends.sh \
97
98
99
	libmakepkg/lint_pkgbuild/optdepends.sh \
	libmakepkg/lint_pkgbuild/options.sh \
	libmakepkg/lint_pkgbuild/package_function.sh \
100
	libmakepkg/lint_pkgbuild/package_function_variable.sh \
101
102
103
104
105
106
107
108
	libmakepkg/lint_pkgbuild/pkgbase.sh \
	libmakepkg/lint_pkgbuild/pkglist.sh \
	libmakepkg/lint_pkgbuild/pkgname.sh \
	libmakepkg/lint_pkgbuild/pkgrel.sh \
	libmakepkg/lint_pkgbuild/pkgver.sh \
	libmakepkg/lint_pkgbuild/provides.sh \
	libmakepkg/lint_pkgbuild/source.sh \
	libmakepkg/lint_pkgbuild/util.sh \
109
	libmakepkg/lint_pkgbuild/variable.sh \
110
111
112
113
114
115
116
	libmakepkg/source.sh \
	libmakepkg/source/bzr.sh \
	libmakepkg/source/file.sh \
	libmakepkg/source/git.sh \
	libmakepkg/source/hg.sh \
	libmakepkg/source/local.sh \
	libmakepkg/source/svn.sh \
117
	libmakepkg/srcinfo.sh \
118
119
120
121
122
123
124
125
	libmakepkg/tidy.sh \
	libmakepkg/tidy/docs.sh \
	libmakepkg/tidy/emptydirs.sh \
	libmakepkg/tidy/libtool.sh \
	libmakepkg/tidy/purge.sh \
	libmakepkg/tidy/staticlibs.sh \
	libmakepkg/tidy/strip.sh \
	libmakepkg/tidy/zipman.sh \
126
	libmakepkg/util.sh \
127
	libmakepkg/util/compress.sh \
128
	libmakepkg/util/config.sh \
Ivy Foster's avatar
Ivy Foster committed
129
	libmakepkg/util/error.sh \
Alad Wenter's avatar
Alad Wenter committed
130
131
	libmakepkg/util/message.sh \
	libmakepkg/util/option.sh \
132
	libmakepkg/util/parseopts.sh \
133
	libmakepkg/util/pkgbuild.sh \
134
	libmakepkg/util/schema.sh \
Alad Wenter's avatar
Alad Wenter committed
135
136
	libmakepkg/util/source.sh \
	libmakepkg/util/util.sh
137
138

LIBMAKEPKG_DIST = \
139
	$(addprefix libmakepkg/, $(addsuffix /meson.build, $(LIBMAKEPKGDIRS))) \
140
141
	$(addsuffix .in, $(LIBMAKEPKG_IN))

142
WRAPPER = \
143
144
145
	makepkg-wrapper \
	pacman-db-upgrade-wrapper \
	pacman-key-wrapper \
146
	repo-add-wrapper
147

148
149
150
151
152
153
154
COMPLETION_IN = \
	completion/bash_completion \
	completion/zsh_completion

COMPLETION_DIST = \
	$(addsuffix .in, $(COMPLETION_IN))

155
# Files that should be removed, but which Automake does not know.
156
MOSTLYCLEANFILES = $(bin_SCRIPTS) $(LIBMAKEPKG_IN) $(COMPLETION_IN) libmakepkg.pc
Allan McRae's avatar
Allan McRae committed
157

158
159
160
clean-local:
	$(AM_V_at)$(RM) -r .lib

161
if USE_GIT_VERSION
162
GIT_VERSION := $(shell sh -c 'git describe --abbrev=4 --dirty | sed s/^v//')
163
164
165
166
167
REAL_PACKAGE_VERSION = $(GIT_VERSION)
else
REAL_PACKAGE_VERSION = $(PACKAGE_VERSION)
endif

168
169
#### Taken from the autoconf scripts Makefile.am ####
edit = sed \
170
	-e 's|@rootdir[@]|$(ROOTDIR)|g' \
171
172
	-e 's|@localedir[@]|$(localedir)|g' \
	-e 's|@sysconfdir[@]|$(sysconfdir)|g' \
Dan McGee's avatar
Dan McGee committed
173
	-e 's|@localstatedir[@]|$(localstatedir)|g' \
Allan McRae's avatar
Allan McRae committed
174
	-e 's|@libmakepkgdir[@]|$(libmakepkgdir)|g' \
175
	-e 's|@pkgdatadir[@]|$(pkgdatadir)|g' \
176
	-e 's|@prefix[@]|$(prefix)|g' \
177
	-e '1s|!/bin/bash|!$(BASH_SHELL)|g' \
178
	-e 's|@PACKAGE_VERSION[@]|$(REAL_PACKAGE_VERSION)|g' \
179
	-e 's|@PACKAGE_BUGREPORT[@]|$(PACKAGE_BUGREPORT)|g' \
Andrew Fyfe's avatar
Andrew Fyfe committed
180
	-e 's|@PACKAGE_NAME[@]|$(PACKAGE_NAME)|g' \
181
	-e 's|@BUILDSCRIPT[@]|$(BUILDSCRIPT)|g' \
Florian Pritz's avatar
Florian Pritz committed
182
	-e 's|@TEMPLATE_DIR[@]|$(TEMPLATE_DIR)|g' \
183
	-e 's|@DEBUGSUFFIX[@]|$(DEBUGSUFFIX)|g' \
184
	-e "s|@INODECMD[@]|$(INODECMD)|g" \
185
	-e "s|@FILECMD[@]|$(FILECMD)|g" \
186
187
	-e 's|@SEDINPLACEFLAGS[@]|$(SEDINPLACEFLAGS)|g' \
	-e 's|@SEDPATH[@]|$(SEDPATH)|g' \
188
	-e 's|@SCRIPTNAME[@]|$@|g' \
189
	-e 's|@configure_input[@]|Generated from $<; do not edit by hand.|g'
190
191
192
193

## All the scripts depend on Makefile so that they are rebuilt when the
## prefix etc. changes. Use chmod -w to prevent people from editing the
## wrong file by accident.
194
$(OURSCRIPTS): %: %.sh.in wrapper.sh.in $(LIBMAKEPKG_IN) Makefile
195
196
197
	$(AM_V_at)$(RM) $@
	$(AM_V_GEN)test -f $(srcdir)/$@.sh.in && m4 -P -I $(srcdir) $(srcdir)/$@.sh.in | $(edit) >$@
	$(AM_V_at)chmod +x,a-w $@
198
	@$(BASH_SHELL) -O extglob -n $@
199

200
201
202
203
204
205
206
$(LIBMAKEPKG_IN): %: %.in Makefile
	$(AM_V_at)$(RM) $@
	$(AM_V_at)$(MKDIR_P) $(dir $@)
	$(AM_V_GEN)test -f $(srcdir)/$@.in && $(edit) $(srcdir)/$@.in >$@
	$(AM_V_at)chmod a-w $@
	@$(BASH_SHELL) -O extglob -n $@

207
$(COMPLETION_IN) libmakepkg.pc: %: %.in Makefile
208
209
210
211
212
213
214
	$(AM_V_at)$(RM) $@
	$(AM_V_at)$(MKDIR_P) $(dir $@)
	$(AM_V_GEN)$(edit) $(srcdir)/$@.in >$@
	$(AM_V_at)chmod a-w $@

all-am: $(COMPLETION_IN)

Florian Pritz's avatar
Florian Pritz committed
215
216
217
218
219
220
221
222
makepkg-template: \
	$(srcdir)/makepkg-template.pl.in \
	Makefile

	$(AM_V_at)$(RM) -f makepkg-template
	$(AM_V_GEN)$(edit) $< > $@
	$(AM_V_at)chmod +x,a-w $@

223
224
225
repo-remove repo-elephant: repo-add
	$(AM_V_at)$(RM) $@
	$(AM_V_at)$(LN_S) repo-add $@
226

227
228
.SECONDEXPANSION:
$(WRAPPER): \
229
	$(srcdir)/wrapper.sh.in \
230
	$$(subst -wrapper,,$$@)
231

232
	$(AM_V_at)$(MKDIR_P) .lib
233
	$(AM_V_at)mv -f $(subst -wrapper,,$@) .lib
234
235
236
	$(AM_V_at)$(RM) $@
	$(AM_V_GEN)sed \
		-e "s|@PWD[@]|$$(pwd)|" \
237
		-e "s|@PROGNAME[@]|$(subst -wrapper,,$@)|g" \
238
		-e '1s|!/bin/bash|!$(BASH_SHELL)|g' \
239
		$(srcdir)/wrapper.sh.in > $@
240
	$(AM_V_at)chmod +x,a-w $@
241
	$(AM_V_at)$(LN_S) $@ $(subst -wrapper,,$@)
242

243
install-data-local:
244
245
246
247
248
	$(MKDIR_P) $(DESTDIR)$(bashcompdir)
	$(INSTALL_DATA) completion/bash_completion $(DESTDIR)/$(bashcompdir)/pacman
	for completion in makepkg pacman-key; do \
	    $(LN_S) pacman $(DESTDIR)/$(bashcompdir)/$$completion; \
	done
249
250
251
252
	$(MKDIR_P) $(DESTDIR)$(datarootdir)/zsh/site-functions/
	$(INSTALL_DATA) completion/zsh_completion $(DESTDIR)$(datarootdir)/zsh/site-functions/_pacman

uninstall-local:
253
254
255
	$(RM) $(DESTDIR)$(bashcompdir)/makepkg
	$(RM) $(DESTDIR)$(bashcompdir)/pacman
	$(RM) $(DESTDIR)$(bashcompdir)/pacman-key
256
257
	$(RM) $(DESTDIR)$(datarootdir)/zsh/site-functions/_pacman

258
install-exec-hook:
259
	for wrapper in $(WRAPPER); do \
260
261
		$(RM) $(DESTDIR)$(bindir)/$${wrapper}; \
		$(INSTALL) .lib/$${wrapper%-wrapper} $(DESTDIR)$(bindir)/$${wrapper%-wrapper}; \
262
	done
263
264
265
266
267
268
269
270
271
	for dir in $(LIBMAKEPKGDIRS); do \
		$(MKDIR_P) $(DESTDIR)$(libmakepkgdir)/$$dir; \
	done
	for lib in $(LIBMAKEPKG); do \
		$(INSTALL) $(srcdir)/$$lib $(DESTDIR)$(libmakepkgdir)/$${lib#libmakepkg}; \
	done
	for lib in $(LIBMAKEPKG_IN); do \
		$(INSTALL) $$lib $(DESTDIR)$(libmakepkgdir)/$${lib#libmakepkg}; \
	done
272
	cd $(DESTDIR)$(bindir) && \
273
		$(RM) repo-elephant && \
274
275
276
277
		( $(LN_S) repo-add repo-elephant || \
		ln repo-add repo-elephant || \
		cp repo-add repo-elephant )
	cd $(DESTDIR)$(bindir) && \
278
		$(RM) repo-remove && \
279
280
281
282
283
284
285
		( $(LN_S) repo-add repo-remove || \
		ln repo-add repo-remove || \
		cp repo-add repo-remove )

uninstall-hook:
	cd $(DESTDIR)$(bindir) && \
		$(RM) repo-remove repo-elephant
286
287
288
289
290
291
	for lib in $(LIBMAKEPKG) $(LIBMAKEPKG_IN); do \
		$(RM) $(DESTDIR)$(libmakepkgdir)/$${lib#libmakepkg}; \
	done
	for dir in $(LIBMAKEPKGDIRS); do \
		$(RM) -r $(DESTDIR)$(libmakepkgdir)/$$dir; \
	done