move install/erase major modes into rpmlib.
[platform/upstream/rpm.git] / Makefile.am
1 # Top level Makefile for rpm
2
3 AUTOMAKE_OPTIONS = 1.4 foreign
4
5 EXTRA_DIST = CHANGES CREDITS GROUPS README.amiga INSTALL RPM-PGP-KEY \
6         autodeps/none autodeps/*.prov autodeps/*.req autogen.sh \
7         docs/[a-z]* gendiff $(man_MANS) po/*.in po/*.po po/rpm.pot \
8         rpm.magic rpmpopt rpm.spec rpm.8ru rpm2cpio.8ru
9
10 EXTRA_PROGRAMS = rpmconvert
11
12 SUBDIRS = popt build lib po intl misc tools scripts tests .
13
14 INCLUDES = \
15         -I$(top_srcdir)/build \
16         -I$(top_srcdir)/lib \
17         -I$(top_srcdir)/intl \
18         -I$(top_srcdir)/popt \
19         @INCPATH@
20
21 mylibs= $(top_builddir)/build/librpmbuild.la \
22         $(top_builddir)/lib/librpm.la \
23         $(top_builddir)/popt/libpopt.la
24
25 LDFLAGS = @LDFLAGS_STATIC@
26
27 rpmbindir = $(subst usr/bin,bin,$(bindir))
28 rpmbin_PROGRAMS = rpm
29
30 bin_PROGRAMS =          rpm2cpio
31 bin_SCRIPTS =           gendiff
32
33 noinst_PROGRAMS =       @BUILD_RPMCONVERT@
34
35 man_MANS = rpm.8 rpm2cpio.8     # rpm.8ru rpm2cpio.8ru
36
37 pkglibdir = @RPMCONFIGDIR@
38 pkglib_DATA = rpmrc rpmpopt macros
39 pkglib_SCRIPTS = find-provides find-requires mkinstalldirs \
40         config.guess config.sub
41
42 noinst_HEADERS = \
43         acconfig.h      build.h         checksig.h      system.h
44
45 rpm_SOURCES =           build.c checksig.c rpm.c
46 rpm_LDADD =             $(mylibs) @LIBMISC@
47
48 $(PROGRAMS):            $(mylibs) @LIBMISC@
49
50 .PHONY: lclint
51 lclint:
52         lclint ${DEFS} ${INCLUDES} ${rpm_SOURCES}
53
54 CVSTAG = r$(subst .,-,$(VERSION))
55
56 rpm2cpio_SOURCES =      rpm2cpio.c
57 rpm2cpio_LDADD =        $(mylibs)
58
59 rpmconvert_SOURCES =    convertdb.c oldrpmdb.c
60 ## Libmisc.a is required for rpmconvert.
61 rpmconvert_LDADD =      $(mylibs) @LIBMISC@ -lgdbm
62
63 install-data-local:
64         @$(mkinstalldirs) $(DESTDIR)$(varprefix)/lib/rpm
65         @rm -f $(DESTDIR)/$(libdir)/rpmrc
66         @ln -s rpm/rpmrc $(DESTDIR)/$(libdir)/rpmrc
67         @rm -f $(DESTDIR)/$(libdir)/rpmpopt
68         @ln -s rpm/rpmpopt $(DESTDIR)/$(libdir)/rpmpopt
69         @$(mkinstalldirs) $(DESTDIR)/$(prefix)/src/redhat/BUILD
70         @case "@build_cpu@" in \
71         *86) $(mkinstalldirs) $(DESTDIR)/$(prefix)/src/redhat/RPMS/i386 ;;\
72         alpha*) $(mkinstalldirs) $(DESTDIR)/$(prefix)/src/redhat/RPMS/alpha ;;\
73         sparc*) $(mkinstalldirs) $(DESTDIR)/$(prefix)/src/redhat/RPMS/sparc ;;\
74         powerpc*) $(mkinstalldirs) $(DESTDIR)/$(prefix)/src/redhat/RPMS/ppc ;;\
75         esac
76         @case "@build_os@" in \
77         mint) $(mkinstalldirs) $(DESTDIR)/$(prefix)/src/redhat/RPMS/m68kmint ;;\
78         *) $(mkinstalldirs) $(DESTDIR)/$(prefix)/src/redhat/RPMS/@build_cpu@ ;;\
79         esac
80         @$(mkinstalldirs) $(DESTDIR)/$(prefix)/src/redhat/RPMS/noarch
81         @$(mkinstalldirs) $(DESTDIR)/$(prefix)/src/redhat/SOURCES
82         @$(mkinstalldirs) $(DESTDIR)/$(prefix)/src/redhat/SPECS
83         @$(mkinstalldirs) $(DESTDIR)/$(prefix)/src/redhat/SRPMS
84         @$(mkinstalldirs) $(DESTDIR)/var/tmp
85
86 .PHONY:                tar
87 tar:
88         rm -rf /tmp/rpm-$(VERSION)
89         $(MAKE) DESTDIR=/tmp/rpm-$(VERSION) install
90         cd /tmp/rpm-$(VERSION) ; tar cvf /tmp/rpm-$(VERSION).tar .
91
92 .PHONY: noconfig
93 noconfig:
94         find . -name "Makefile" -exec rm {} \; 
95         rm -f *gz *rpm config.*
96
97 .PHONY: archive
98 archive: 
99         @cvs -d `cat CVS/Root` diff 2>&1 > /dev/null || { \
100             echo " " ; \
101             echo "==> Please resolve differences between the repository and" ; \
102             echo "==> your rpm check out before tagging." ; \
103             echo " " ; \
104             cvs -n up ; \
105             echo " " ; \
106             exit 1 ; \
107         }
108         @cvs -d `cat CVS/Root` -Q tag -F $(CVSTAG) .
109         @make dist
110         @echo " "
111         @echo "The final archive is ./rpm-$(VERSION).tar.gz."
112
113 .PHONY: nextsrpm
114 nextsrpm: all archive
115         @sudo ./rpm -ta rpm-$(VERSION).tar.gz