apply some patch for pythons rpm from opensource
[platform/upstream/rpm.git] / Makefile.am
1 # Top level Makefile for rpm
2
3 ACLOCAL_AMFLAGS = -I m4
4
5 DISTCHECK_CONFIGURE_FLAGS = --with-external-db --enable-python --enable-zstd
6
7 include $(top_srcdir)/rpm.am
8 AM_CFLAGS = @RPMCFLAGS@
9
10 CLEANFILES =
11 EXTRA_DIST = ChangeLog CREDITS INSTALL \
12         autogen.sh db3/configure installplatform platform.in
13 BUILT_SOURCES =
14
15 SUBDIRS = po misc
16 if WITH_INTERNAL_DB
17 SUBDIRS += db3
18 endif
19 if WITH_LUA
20 SUBDIRS += luaext
21 endif
22 SUBDIRS += rpmio lib sign build scripts fileattrs doc .
23
24 if ENABLE_PYTHON
25 SUBDIRS += python
26 endif
27
28 if ENABLE_PLUGINS
29 SUBDIRS += plugins
30 endif
31
32 if HAVE_FAKECHROOT
33 SUBDIRS += tests
34 endif
35
36 DIST_SUBDIRS = po misc luaext rpmio lib sign build python scripts fileattrs doc tests plugins
37
38 pkgconfigdir = $(libdir)/pkgconfig
39
40 AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) -I$(top_builddir)/include/
41 AM_CPPFLAGS += -I$(top_srcdir)/build
42 AM_CPPFLAGS += -I$(top_srcdir)/lib
43 AM_CPPFLAGS += -I$(top_srcdir)/rpmio
44 AM_CPPFLAGS += @WITH_BEECRYPT_INCLUDE@
45 AM_CPPFLAGS += @WITH_NSS_INCLUDE@
46 AM_CPPFLAGS += @WITH_OPENSSL_INCLUDE@
47 AM_CPPFLAGS += @WITH_POPT_INCLUDE@
48 AM_CPPFLAGS += -I$(top_srcdir)/misc
49 AM_CPPFLAGS += -DLOCALEDIR="\"$(localedir)\""
50 AM_CPPFLAGS += -DLIBRPMALIAS_FILENAME="\"rpmpopt-${VERSION}\""
51
52 pkginclude_HEADERS =
53 nodist_pkginclude_HEADERS =
54
55 pkginclude_HEADERS += rpmio/argv.h
56 pkginclude_HEADERS += rpmio/rpmio.h
57 pkginclude_HEADERS += rpmio/rpmurl.h
58 pkginclude_HEADERS += rpmio/rpmmacro.h
59 pkginclude_HEADERS += rpmio/rpmlog.h
60 pkginclude_HEADERS += rpmio/rpmpgp.h
61 pkginclude_HEADERS += rpmio/rpmsq.h
62 pkginclude_HEADERS += rpmio/rpmstring.h
63 pkginclude_HEADERS += rpmio/rpmstrpool.h
64 pkginclude_HEADERS += rpmio/rpmsw.h
65 pkginclude_HEADERS += rpmio/rpmfileutil.h
66 pkginclude_HEADERS += rpmio/rpmutil.h
67 pkginclude_HEADERS += rpmio/rpmkeyring.h
68 pkginclude_HEADERS += rpmio/rpmbase64.h
69
70 pkginclude_HEADERS += lib/header.h
71 pkginclude_HEADERS += lib/rpmdb.h
72 pkginclude_HEADERS += lib/rpmcallback.h
73 pkginclude_HEADERS += lib/rpmcli.h
74 pkginclude_HEADERS += lib/rpmlib.h
75 pkginclude_HEADERS += lib/rpmds.h
76 pkginclude_HEADERS += lib/rpmfi.h
77 pkginclude_HEADERS += lib/rpmfiles.h
78 pkginclude_HEADERS += lib/rpmlegacy.h
79 pkginclude_HEADERS += lib/rpmpol.h
80 pkginclude_HEADERS += lib/rpmps.h
81 pkginclude_HEADERS += lib/rpmprob.h
82 pkginclude_HEADERS += lib/rpmtag.h
83 pkginclude_HEADERS += lib/rpmtd.h
84 pkginclude_HEADERS += lib/rpmte.h
85 pkginclude_HEADERS += lib/rpmts.h
86 pkginclude_HEADERS += lib/rpmtypes.h
87 pkginclude_HEADERS += lib/rpmvf.h
88 pkginclude_HEADERS += lib/rpmarchive.h
89
90 pkginclude_HEADERS += sign/rpmsign.h
91
92 pkginclude_HEADERS += build/rpmbuild.h
93 pkginclude_HEADERS += build/rpmfc.h
94 pkginclude_HEADERS += build/rpmspec.h
95
96
97 rpmbindir = `echo $(bindir) | $(SED) -e s,usr/bin,bin,`
98 rpmbin_PROGRAMS = rpm
99
100 bin_PROGRAMS =          rpm2cpio rpmbuild rpmdb rpmkeys rpmsign rpmspec
101
102 if WITH_ARCHIVE
103 bin_PROGRAMS +=         rpm2archive 
104 endif
105
106 rpmlibexec_PROGRAMS =
107 rpmconfig_SCRIPTS =     mkinstalldirs \
108                         config.guess config.sub
109
110 noinst_LTLIBRARIES =            libcliutils.la
111 libcliutils_la_SOURCES =        cliutils.h cliutils.c
112 libcliutils_la_CPPFLAGS =       $(AM_CPPFLAGS)
113 libcliutils_la_LIBADD =         lib/librpm.la rpmio/librpmio.la
114 libcliutils_la_LIBADD +=        @WITH_POPT_LIB@
115
116 rpm_SOURCES =           rpmqv.c debug.h system.h
117 rpm_CPPFLAGS =          $(AM_CPPFLAGS) -DIAM_RPMEIU -DIAM_RPMQ -DIAM_RPMV
118 rpm_LDADD =             libcliutils.la
119 rpm_LDADD +=            lib/librpm.la rpmio/librpmio.la
120
121 rpm_LDADD +=            @WITH_POPT_LIB@
122 rpm_CFLAGS =            $(CFLAGS) -fPIE
123 rpm_LDFLAGS =           $(LDFLAGS) -pie
124
125
126 rpmdb_SOURCES =         rpmdb.c debug.h system.h
127 rpmdb_CPPFLAGS =        $(AM_CPPFLAGS)
128 rpmdb_LDADD =           libcliutils.la
129 rpmdb_LDADD +=          lib/librpm.la rpmio/librpmio.la
130
131 rpmdb_LDADD +=          @WITH_POPT_LIB@
132 rpmdb_CFLAGS =          $(CFLAGS) -fPIE
133 rpmdb_LDFLAGS =         $(LDFLAGS) -pie
134
135
136 rpmkeys_SOURCES =       rpmkeys.c debug.h system.h
137 rpmkeys_CPPFLAGS =      $(AM_CPPFLAGS)
138 rpmkeys_LDADD =         libcliutils.la
139 rpmkeys_LDADD +=        lib/librpm.la rpmio/librpmio.la
140
141 rpmkeys_LDADD +=        @WITH_POPT_LIB@
142 rpmkeys_CFLAGS =        $(CFLAGS) -fPIE
143 rpmkeys_LDFLAGS =       $(LDFLAGS) -pie
144
145 rpmsign_SOURCES =       rpmsign.c debug.h system.h
146 rpmsign_CPPFLAGS =      $(AM_CPPFLAGS)
147 rpmsign_LDADD =         libcliutils.la
148 rpmsign_LDADD +=        sign/librpmsign.la lib/librpm.la rpmio/librpmio.la
149 rpmsign_LDADD +=        @WITH_POPT_LIB@
150
151 rpmbuild_SOURCES =      rpmbuild.c debug.h system.h
152 rpmbuild_CPPFLAGS =     $(AM_CPPFLAGS)
153 rpmbuild_LDADD =        libcliutils.la
154 rpmbuild_LDADD +=       build/librpmbuild.la lib/librpm.la rpmio/librpmio.la
155 rpmbuild_LDADD +=       @WITH_POPT_LIB@
156
157 rpmspec_SOURCES =       rpmspec.c debug.h system.h
158 rpmspec_CPPFLAGS =      $(AM_CPPFLAGS)
159 rpmspec_LDADD =         libcliutils.la
160 rpmspec_LDADD +=        build/librpmbuild.la lib/librpm.la rpmio/librpmio.la
161 rpmspec_LDADD +=        @WITH_POPT_LIB@
162
163 rpm2cpio_SOURCES =      rpm2cpio.c debug.h system.h
164 rpm2cpio_LDADD =        lib/librpm.la rpmio/librpmio.la
165 rpm2cpio_LDADD +=       @WITH_POPT_LIB@
166 rpm2cpio_CFLAGS =       $(CFLAGS) -fPIE
167 rpm2cpio_LDFLAGS =      $(LDFLAGS) -pie
168
169 rpm2archive_SOURCES =   rpm2archive.c debug.h system.h
170 rpm2archive_LDADD =     lib/librpm.la rpmio/librpmio.la
171 rpm2archive_LDADD +=    @WITH_POPT_LIB@ @WITH_ARCHIVE_LIB@
172
173
174 if LIBELF
175 if LIBDW
176
177 rpmconfig_SCRIPTS += scripts/find-debuginfo.sh
178
179 rpmlibexec_PROGRAMS +=  debugedit
180 debugedit_SOURCES =     tools/debugedit.c tools/hashtab.c tools/hashtab.h
181 debugedit_LDADD =       rpmio/librpmio.la
182 debugedit_LDADD +=      @WITH_LIBELF_LIB@ @WITH_POPT_LIB@
183 if HAVE_LIBDW_STRTAB
184 debugedit_LDADD +=      @WITH_LIBDW_LIB@
185 else
186 debugedit_LDADD +=      @WITH_LIBDW_LIB@ -lebl
187 endif # HAVE_LIBDW_STRTAB
188 endif # LIBDW
189 rpmlibexec_PROGRAMS +=  elfdeps
190 elfdeps_SOURCES =       tools/elfdeps.c
191 elfdeps_LDADD =         rpmio/librpmio.la
192 elfdeps_LDADD +=        @WITH_LIBELF_LIB@ @WITH_POPT_LIB@
193
194 rpmlibexec_PROGRAMS +=  sepdebugcrcfix
195 sepdebugcrcfix_SOURCES = tools/sepdebugcrcfix.c
196 sepdebugcrcfix_LDADD =  @WITH_LIBELF_LIB@
197
198 endif #LIBELF
199
200 rpmlibexec_PROGRAMS +=  rpmdeps
201 rpmdeps_SOURCES =       tools/rpmdeps.c
202 rpmdeps_LDADD =         lib/librpm.la rpmio/librpmio.la build/librpmbuild.la @WITH_POPT_LIB@
203
204 bin_PROGRAMS +=         rpmgraph
205 rpmgraph_SOURCES =      tools/rpmgraph.c
206 rpmgraph_LDADD =        lib/librpm.la rpmio/librpmio.la @WITH_POPT_LIB@
207
208 dist_bin_SCRIPTS =      scripts/gendiff
209
210 bin_PROGRAMS +=         rpmqpack
211 rpmqpack_SOURCES =      rpmqpack.c
212 rpmqpack_LDADD =        lib/librpm.la
213 rpmqpack_CFLAGS =       $(CFLAGS) -fPIE
214 rpmqpack_LDFLAGS =      $(LDFLAGS) -pie
215
216 rpmconfig_DATA = rpmrc
217 rpmrc: $(top_srcdir)/rpmrc.in
218         @$(SED) \
219           -e "s,[@]SYSCONFIGDIR[@],$(sysconfdir)/rpm,g" \
220           < $(top_srcdir)/rpmrc.in > rpmrc.tmp \
221           && ( cd $(top_builddir) && ./config.status --file=${subdir}/rpmrc:${subdir}/rpmrc.tmp )
222 CLEANFILES += rpmrc.tmp rpmrc
223 EXTRA_DIST += rpmrc.in
224
225 noinst_DATA = macros
226 macros: $(top_srcdir)/macros.in
227           ( cd $(top_builddir) && ./config.status --file=${subdir}/macros:${subdir}/macros.in )
228 CLEANFILES += macros
229 EXTRA_DIST += macros.in
230
231 # Used for the testsuite to test creating debuginfo packages
232 EXTRA_DIST += macros.debug
233
234 noinst_DATA += platform
235 platform: $(top_srcdir)/platform.in
236         @$(SED) \
237           -e "s,[@]RPMCONFIGDIR[@],$(rpmconfigdir),g" \
238           < $(top_srcdir)/platform.in > platform.tmp \
239           && ( cd $(top_builddir) && ./config.status --file=${subdir}/platform:${subdir}/platform.tmp )
240 CLEANFILES += platform.tmp platform
241 EXTRA_DIST += platform.in
242
243 pkgconfig_DATA = rpm.pc
244 rpm.pc: $(top_srcdir)/rpm.pc.in
245         @$(SED) \
246           -e "s,[@]RPMCONFIGDIR[@],$(rpmconfigdir),g" \
247           < $(top_srcdir)/rpm.pc.in > rpm.pc.tmp \
248           && ( cd $(top_builddir) && ./config.status --file=${subdir}/rpm.pc:${subdir}/rpm.pc.tmp )
249 CLEANFILES += rpm.pc.tmp rpm.pc
250 EXTRA_DIST += rpm.pc.in
251
252 rpmconfig_DATA += rpmpopt-$(VERSION)
253 rpmpopt-@VERSION@: $(top_srcdir)/rpmpopt.in
254         @$(SED) \
255           -e "s,[@]RPMCONFIGDIR[@],$(rpmconfigdir),g" \
256           -e "s,[@]BINDIR[@],$(bindir),g" \
257           < $(top_srcdir)/rpmpopt.in > rpmpopt-@VERSION@.tmp \
258           && ( cd $(top_builddir) && ./config.status --file=${subdir}/rpmpopt-@VERSION@:${subdir}/rpmpopt-@VERSION@.tmp )
259 CLEANFILES += rpmpopt-@VERSION@.tmp rpmpopt-@VERSION@
260 EXTRA_DIST += rpmpopt.in
261
262 usrsrcdir = $(prefix)/src
263
264 rpmvardir = $(localstatedir)/lib/rpm
265 rpmvar_DATA =
266
267 install-exec-hook:
268         @rm -f $(DESTDIR)$(bindir)/rpmquery
269         @LN_S@ $(rpm_symlink_prefix)rpm $(DESTDIR)$(bindir)/rpmquery
270         @rm -f $(DESTDIR)$(bindir)/rpmverify
271         @LN_S@  $(rpm_symlink_prefix)rpm $(DESTDIR)$(bindir)/rpmverify
272
273 install-data-local:
274         DESTDIR="$(DESTDIR)" pkglibdir="$(rpmconfigdir)" \
275                 $(SHELL) $(top_srcdir)/installplatform \
276                         rpmrc platform macros \
277                         $(RPMCANONVENDOR) $(RPMCANONOS) $(RPMCANONGNU)
278         @$(MKDIR_P) $(DESTDIR)$(localstatedir)/tmp
279         @$(MKDIR_P) $(DESTDIR)$(rpmconfigdir)/macros.d
280
281 # XXX to appease distcheck we need to remove "stuff" here...
282 uninstall-local:
283         @rm -f $(DESTDIR)$(bindir)/rpmquery
284         @rm -f $(DESTDIR)$(bindir)/rpmverify
285         @rm -rf $(DESTDIR)$(rpmconfigdir)/platform/
286         @rm -f $(DESTDIR)$(rpmconfigdir)/macros
287         @rm -rf $(DESTDIR)$(rpmconfigdir)/macros.d
288
289 MAINTAINERCLEANFILES = ChangeLog
290
291 # Build hacking docs only on request
292 if HACKINGDOCS
293 if DOXYGEN
294 doc/hacking.doxy: doc/hacking.doxy.in doc/hacking/Doxyheader.h Makefile.am
295         $(SED) \
296           -e "s,\@top_srcdir\@/,$(top_srcdir)/,g" \
297           -e "s,[@]HAVE_DOT[@],$(HAVE_DOT)," \
298           -e "s,[@]PACKAGE[@],$(PACKAGE)," \
299           -e "s,[@]VERSION[@],$(VERSION)," \
300         < $(top_srcdir)/doc/hacking.doxy.in > doc/hacking.doxy
301
302 doc/hacking/html/index.html: doc/hacking.doxy rpmpopt-@VERSION@
303         @DOXYGEN@ doc/hacking.doxy
304 noinst_DATA += doc/hacking/html/index.html
305 endif
306 endif
307 EXTRA_DIST += doc/hacking.doxy.in doc/hacking/Doxyheader.h
308
309 # Always build librpm docs
310 if DOXYGEN
311 doc/librpm.doxy: doc/librpm.doxy.in doc/librpm/Doxyheader.h Makefile.am configure.ac $(pkginclude_HEADERS)
312         files=`echo " $(pkginclude_HEADERS)" | $(SED) -e "s, , \@top_srcdir\@/,g"`; \
313         $(SED) -e "s,[@]pkginclude_HEADERS[@],$$files," \
314           -e "s,\@top_srcdir\@/,$(top_srcdir)/,g" \
315           -e "s,[@]HAVE_DOT[@],$(HAVE_DOT)," \
316           -e "s,[@]PACKAGE[@],$(PACKAGE)," \
317           -e "s,[@]VERSION[@],$(VERSION)," \
318         < $(top_srcdir)/doc/librpm.doxy.in > doc/librpm.doxy
319
320 doc/librpm/html/index.html: doc/librpm.doxy
321         @DOXYGEN@ doc/librpm.doxy
322 noinst_DATA += doc/librpm/html/index.html
323 endif
324 EXTRA_DIST += doc/librpm.doxy.in doc/librpm/Doxyheader.h
325 EXTRA_DIST += doc/librpm/html
326
327 if WITH_INTERNAL_DB
328 db.h:   $(top_builddir)/db3/db.h
329         $(LN_S) $(top_builddir)/db3/db.h $@
330 BUILT_SOURCES += db.h
331 endif
332 DISTCLEANFILES = db.h
333
334 ChangeLog:
335         touch ChangeLog
336
337 dist-hook:
338         if [ -d .git ] && [ -x $(command -v git) ]; then git log --no-merges > $(distdir)/ChangeLog; fi
339
340 clean-local:
341         rm -rf doc/hacking/html
342         rm -rf include
343
344 distclean-local:
345         rm -rf doc/librpm.doxy doc/librpm/html
346         rm -rf Doxytags
347         rm -f stamp-h.in db3/*.orig db3/db3lobjs
348
349 $(top_srcdir)/preinstall.am: Makefile.am
350         rm -f $(top_srcdir)/preinstall.am
351         @for f in $(HEADERS); do \
352           b=`basename $$f`; \
353           echo 'include/rpm/'$$b': '$$f' include/rpm/$$(dirstamp)' >> $(top_srcdir)/preinstall.am;\
354           echo '        $$(INSTALL_DATA) $$(top_srcdir)/'$$f' include/rpm/'$$b >> $(top_srcdir)/preinstall.am; \
355           echo 'BUILT_SOURCES += include/rpm/'$$b >> $(top_srcdir)/preinstall.am; \
356           echo 'CLEANFILES += include/rpm/'$$b  >> $(top_srcdir)/preinstall.am; \
357          done
358
359 include/rpm/$(dirstamp):
360         @$(MKDIR_P) include/rpm
361         @: > include/rpm/$(dirstamp)
362
363 include $(top_srcdir)/preinstall.am