Move rpmgraph from tools/Makefile.am to Makefile.am.
[platform/upstream/rpm.git] / Makefile.am
1 # Top level Makefile for rpm
2
3 include $(top_srcdir)/rpm.am
4
5 CLEANFILES =
6 EXTRA_DIST = CHANGES ChangeLog CREDITS Doxyheader GROUPS INSTALL \
7         autodeps autogen.sh \
8         db db3/configure installplatform platform* 
9
10 SUBDIRS = po misc @WITH_DB_SUBDIR@ lua rpmio rpmdb lib build python tools scripts doc . tests
11
12 pkgconfigdir = $(libdir)/pkgconfig
13 pkgconfig_DATA = rpm.pc
14
15 AM_CPPFLAGS = \
16         -I$(top_srcdir)/build \
17         -I$(top_srcdir)/lib \
18         -I$(top_srcdir)/rpmdb \
19         -I$(top_srcdir)/rpmio \
20         @WITH_BEECRYPT_INCLUDE@ \
21         @WITH_POPT_INCLUDE@ \
22         -I$(top_srcdir)/misc \
23         @WITH_LIBELF_INCLUDE@
24 AM_CPPFLAGS += -DLOCALEDIR="\"$(localedir)\""
25 AM_CPPFLAGS += -DRPMCONFIGDIR="\"@RPMCONFIGDIR@\""
26 AM_CPPFLAGS += -DLIBRPMALIAS_FILENAME="\"@RPMCONFIGDIR@/rpmpopt-${VERSION}\""
27
28 staticLDFLAGS = @LDFLAGS_STATIC@ @LDFLAGS_NPTL@
29
30 rpmbindir = `echo $(bindir) | sed -e s,usr/bin,bin,`
31 rpmbin_PROGRAMS = rpm
32
33 bin_PROGRAMS =          rpm2cpio
34
35 rpmlibexec_PROGRAMS =   rpmb rpmd rpmi rpmk rpmq
36 rpmconfig_DATA =        rpmrc rpmpopt-$(VERSION) macros
37 rpmconfig_SCRIPTS =     find-provides find-requires mkinstalldirs \
38                         config.guess config.sub
39
40 rpm_SOURCES =           rpmqv.c debug.h system.h
41 rpm_CPPFLAGS =          $(AM_CPPFLAGS) -DIAM_RPMDB -DIAM_RPMEIU -DIAM_RPMK -DIAM_RPMQV
42 rpm_LDADD =             build/librpmbuild.la lib/librpm.la rpmdb/librpmdb.la rpmio/librpmio.la
43 rpm_LDADD +=            @WITH_LIBELF_LIB@ @WITH_BEECRYPT_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@
44
45 rpmb_SOURCES =          build.c rpmqv.c build.h debug.h system.h
46 rpmb_CPPFLAGS =         $(AM_CPPFLAGS) -DIAM_RPMBT
47 rpmb_LDADD =            build/librpmbuild.la lib/librpm.la rpmdb/librpmdb.la rpmio/librpmio.la
48 rpmb_LDADD +=           @WITH_LIBELF_LIB@ @WITH_BEECRYPT_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@
49
50 rpmd_SOURCES =          rpmqv.c debug.h system.h
51 rpmd_CPPFLAGS =         $(AM_CPPFLAGS) -DIAM_RPMDB
52 rpmd_LDADD =            lib/librpm.la rpmdb/librpmdb.la rpmio/librpmio.la
53 rpmd_LDADD +=           @WITH_LIBELF_LIB@ @WITH_BEECRYPT_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@
54
55 rpmi_SOURCES =          rpmqv.c debug.h system.h
56 rpmi_CPPFLAGS =         $(AM_CPPFLAGS) -DIAM_RPMEIU
57 rpmi_LDADD =            lib/librpm.la rpmdb/librpmdb.la rpmio/librpmio.la
58 rpmi_LDADD +=           @WITH_LIBELF_LIB@ @WITH_BEECRYPT_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@
59
60 rpmk_SOURCES =          rpmqv.c debug.h system.h
61 rpmk_CPPFLAGS =         $(AM_CPPFLAGS) -DIAM_RPMK
62 rpmk_LDADD =            lib/librpm.la rpmdb/librpmdb.la rpmio/librpmio.la
63 rpmk_LDADD +=           @WITH_LIBELF_LIB@ @WITH_BEECRYPT_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@
64
65 rpmq_SOURCES =          rpmqv.c debug.h system.h
66 rpmq_CPPFLAGS =         $(AM_CPPFLAGS) -DIAM_RPMQV
67 rpmq_LDADD =            build/librpmbuild.la lib/librpm.la rpmdb/librpmdb.la rpmio/librpmio.la
68 rpmq_LDADD +=           @WITH_LIBELF_LIB@ @WITH_BEECRYPT_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@
69
70 rpm2cpio_SOURCES =      rpm2cpio.c debug.h system.h
71 rpm2cpio_LDADD =        lib/librpm.la rpmdb/librpmdb.la rpmio/librpmio.la
72 rpm2cpio_LDADD +=       @WITH_LIBELF_LIB@ @WITH_BEECRYPT_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@
73
74 ## Build under same conditions as debugedit
75 if LIBELF
76 if LIBDWARF
77 rpmconfig_SCRIPTS += scripts/find-debuginfo.sh
78 endif
79 endif
80
81
82 bin_PROGRAMS +=         rpmgraph
83 rpmgraph_SOURCES =      tools/rpmgraph.c
84 rpmgraph_LDADD =        lib/librpm.la
85
86
87 rpmrc: $(top_srcdir)/rpmrc.in
88         @sed \
89           -e "s,[@]SYSCONFIGDIR[@],$(sysconfdir)/rpm,g" \
90           < $(top_srcdir)/rpmrc.in > rpmrc.tmp \
91           && ( cd $(top_builddir) && ./config.status --file=${subdir}/rpmrc:${subdir}/rpmrc.tmp )
92 CLEANFILES += rpmrc.tmp rpmrc
93 EXTRA_DIST += rpmrc.in
94
95 macros: $(top_srcdir)/macros.in
96         @sed \
97           -e "s,[@]varprefix[@],$(localstatedir),g" \
98           < $(top_srcdir)/macros.in > macros.tmp \
99           && ( cd $(top_builddir) && ./config.status --file=${subdir}/macros:${subdir}/macros.tmp )
100 CLEANFILES += macros.tmp macros
101 EXTRA_DIST += macros.in
102
103 pkgsrcdir = $(prefix)/src/$(RPMCANONVENDOR)
104 pkgsrc_RPMSdir = $(pkgsrcdir)/RPMS
105 pkgsrc_RPMS_DATA =
106 pkgsrc_SRPMSdir = $(pkgsrcdir)/SRPMS
107 pkgsrc_SRPMS_DATA =
108 pkgsrc_SPECSdir = $(pkgsrcdir)/SPECS
109 pkgsrc_SPECS_DATA =
110 pkgsrc_SOURCESdir = $(pkgsrcdir)/SOURCES
111 pkgsrc_SOURCES_DATA =
112 pkgsrc_BUILDdir = $(pkgsrcdir)/BUILD
113 pkgsrc_BUILD_DATA =
114
115 rpmvardir = $(localstatedir)/lib/rpm
116 rpmvar_DATA =
117
118 install-exec-hook:
119         @rm -f $(DESTDIR)$(rpmlibexecdir)/rpmt
120         @@LN_S@ rpmb $(DESTDIR)$(rpmlibexecdir)/rpmt
121         @rm -f $(DESTDIR)$(rpmlibexecdir)/rpme
122         @@LN_S@ rpmi $(DESTDIR)$(rpmlibexecdir)/rpme
123         @rm -f $(DESTDIR)$(rpmlibexecdir)/rpmu
124         @@LN_S@ rpmi $(DESTDIR)$(rpmlibexecdir)/rpmu
125         @rm -f $(DESTDIR)$(rpmlibexecdir)/rpmv
126         @@LN_S@ rpmq $(DESTDIR)$(rpmlibexecdir)/rpmv
127         rm -f $(DESTDIR)$(bindir)/rpmbuild
128         @LN_S@ ../lib/rpm/rpmb $(DESTDIR)$(bindir)/rpmbuild
129         rm -f $(DESTDIR)$(bindir)/rpmquery
130         @LN_S@ ../lib/rpm/rpmq $(DESTDIR)$(bindir)/rpmquery
131         rm -f $(DESTDIR)$(bindir)/rpmverify
132         @LN_S@ ../lib/rpm/rpmv $(DESTDIR)$(bindir)/rpmverify
133         rm -f $(DESTDIR)$(bindir)/rpmsign
134         @LN_S@ ../lib/rpm/rpmk $(DESTDIR)$(bindir)/rpmsign
135         rm -f $(DESTDIR)$(bindir)/rpmdb ; \
136         @LN_S@ ../lib/rpm/rpmd $(DESTDIR)$(bindir)/rpmdb ; \
137         for bf in e i u ; do \
138             rm -f $(DESTDIR)$(bindir)/rpm$$bf ; \
139             @LN_S@ ../lib/rpm/rpm$$bf $(DESTDIR)$(bindir)/rpm$$bf ; \
140         done
141
142 install-data-local:
143         @case "@host_cpu@" in \
144         *86)    $(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/i386 ;\
145                 $(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/i486 ;\
146                 $(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/i586 ;\
147                 $(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/i686 ;\
148                 $(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/athlon ;;\
149         alpha*) $(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/alpha ;\
150                 $(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/alphaev6 ;;\
151         arm*)   $(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/armv3l ;\
152                 $(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/armv4l ;\
153                 $(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/armv4tl ;\
154                 $(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/armv5tel ;\
155                 $(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/armv5tejl ;\
156                 $(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/armv6l ;;\
157         sparc*) $(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/sparc ;\
158                 $(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/sparcv8 ;\
159                 $(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/sparcv9 ;\
160                 $(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/sparcv9v ;\
161                 $(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/sparc64 ;\
162                 $(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/sparc64v ;;\
163         ia64*)  $(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/ia64 ;;\
164         s390*)  $(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/s390 ;;\
165         mipsel*) $(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/mipsel ;;\
166         mips*)  $(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/mips ;;\
167         powerpc*) $(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/ppc ;\
168                 $(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/ppciseries ;\
169                 $(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/ppcpseries ;\
170                 $(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/ppc64 ;\
171                 $(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/ppc64iseries ;\
172                 $(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/ppc64pseries ;;\
173         *)      $(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/@host_cpu@ ;;\
174         esac
175         $(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/noarch
176         @case "@host_os@" in \
177         mint) $(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/m68kmint ;;\
178         solaris*|linux*|darwin*) \
179            DESTDIR="$(DESTDIR)" pkglibdir="$(rpmconfigdir)" $(SHELL) $(top_srcdir)/installplatform rpmrc macros platform ;; \
180         esac
181         @$(MKDIR_P) $(DESTDIR)$(localstatedir)/tmp
182
183 # XXX to appease distcheck we need to remove "stuff" here...
184 uninstall-local:
185         @rm -rf $(DESTDIR)/$(rpmconfigdir)/*-*
186         rm -f $(DESTDIR)$(rpmlibexecdir)/rpmu
187         rm -f $(DESTDIR)$(rpmlibexecdir)/rpme
188         rm -f $(DESTDIR)$(rpmlibexecdir)/rpmt
189         rm -f $(DESTDIR)$(rpmlibexecdir)/rpmv
190         rm -f $(DESTDIR)$(bindir)/rpmquery
191         rm -f $(DESTDIR)$(bindir)/rpmbuild
192         rm -f $(DESTDIR)$(bindir)/rpmu
193         rm -f $(DESTDIR)$(bindir)/rpmsign
194         rm -f $(DESTDIR)$(bindir)/rpme
195         rm -f $(DESTDIR)$(bindir)/rpmverify
196         rm -f $(DESTDIR)$(bindir)/rpmdb
197         rm -f $(DESTDIR)$(bindir)/rpmi
198
199 distclean-local:
200         @rm -rf Doxytags apidocs 
201         @rm -f stamp-h.in db3/*.orig db3/db3lobjs
202
203 MAINTAINERCLEANFILES = ChangeLog
204
205 .PHONY: setperms
206 setperms:
207         @for f in $(rpmbin_PROGRAMS) ; do\
208             $(__CHOWN) ${RPMUSER}.${RPMGROUP} $(DESTDIR)$(rpmbindir)/$$f ;\
209             $(__CHMOD) g+s $(DESTDIR)$(rpmbindir)/$$f ;\
210         done
211         @for f in $(bin_PROGRAMS) ; do\
212             $(__CHOWN) ${RPMUSER}.${RPMGROUP} $(DESTDIR)$(bindir)/$$f ;\
213         done
214         @for f in $(rpmlibexec_PROGRAMS) ; do\
215             $(__CHOWN) ${RPMUSER}.${RPMGROUP} $(DESTDIR)$(rpmlibexecdir)/$$f ;\
216             $(__CHMOD) g+s $(DESTDIR)$(rpmlibexecdir)/$$f ;\
217         done
218         @for f in $(pkglib_SCRIPTS) ; do\
219             $(__CHOWN) ${RPMUSER}.${RPMGROUP} $(DESTDIR)$(pkglibdir)/$$f ;\
220         done
221         @$(__CHOWN) ${RPMUSER}.${RPMGROUP} $(DESTDIR)$(pkglibdir)
222         @$(__CHOWN) -R ${RPMUSER}.${RPMGROUP} $(DESTDIR)$(rpmvardir)
223         -@$(__CHMOD) 0664 $(DESTDIR)$(rpmvardir)/[A-Z]*
224         -@$(__CHMOD) 0775 $(DESTDIR)$(rpmvardir)
225         -@$(__CHMOD) 0664 $(DESTDIR)$(rpmvardir)/__db.*
226
227 .PHONY: unsetgid
228 unsetgid:
229         @for f in $(rpmbin_PROGRAMS) ; do\
230             $(__CHMOD) g-s $(DESTDIR)$(rpmbindir)/$$f ;\
231         done
232         @for f in $(rpmlibexec_PROGRAMS) ; do\
233             $(__CHMOD) g-s $(DESTDIR)$(rpmlibexecdir)/$$f ;\
234         done
235
236 .PHONY: doxygen
237 doxygen @WITH_APIDOCS_TARGET@: Doxyfile rpmpopt-@VERSION@
238         rm -rf $@
239         $(MKDIR_P) $@
240         - [ X"@__DOXYGEN@" != Xno ] && @__DOXYGEN@
241
242 ChangeLog:
243         hg log --no-merge -v > ChangeLog
244
245 ACLOCAL_AMFLAGS = -I m4