Automake: almost functional make dist.
[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 README.amiga RPM-PGP-KEY \
6         autodeps/none autodeps/*.prov autodeps/*.req autogen.sh \
7         docs/[a-z]* gendiff groups po/*.in po/*.po po/rpm.pot \
8         rpm.8 rpm.8ru rpm.magic rpm.spec rpm2cpio.8 rpm2cpio.8ru
9
10 SUBDIRS = popt build lib po intl misc tools scripts tests .
11
12 INCLUDES = -I$(top_srcdir)/build -I$(top_srcdir)/lib -I$(top_srcdir)/intl @INCPATH@
13
14 LDFLAGS = @LDFLAGS_STATIC@ -L$(top_builddir)/build -L$(top_builddir)/lib -L$(top_builddir)/popt -L$(top_builddir)/misc
15
16 rpmbindir = $(subst usr/bin,bin,$(bindir))
17 rpmbin_PROGRAMS = rpm
18
19 bin_PROGRAMS =          rpm2cpio
20 bin_SCRIPTS =           gendiff
21 noinst_PROGRAMS =       rpmconvert
22
23 man_MANS = rpm.8 rpm2cpio.8
24
25 configdir = @RPMCONFIGDIR@
26 config_DATA = rpmrc rpmpopt macros
27 config_SCRIPTS = find-provides find-requires mkinstalldirs
28
29 noinst_HEADERS = \
30         acconfig.h      build.h         checksig.h      ftp.h   \
31         install.h       system.h        url.h   \
32         verify.h
33
34 rpm_SOURCES =           build.c checksig.c ftp.c install.c rpm.c url.c \
35                         verify.c
36 rpm_LDADD =             -lrpmbuild -lrpm -lpopt @LIBMISC@
37
38 $(PROGRAMS): ./build/librpmbuild.a ./lib/librpm.a ./popt/libpopt.a
39
40 include ./Makefile.inc
41
42 .PHONY: lclint
43 lclint:
44         lclint ${DEFS} ${INCLUDES} ${rpm_SOURCES}
45
46 CVSTAG = r$(subst .,-,$(VERSION))
47
48 rpm2cpio_SOURCES =      rpm2cpio.c
49 rpm2cpio_LDADD =        -lrpmbuild -lrpm -lpopt
50
51 rpmconvert_SOURCES =    convertdb.c oldrpmdb.c
52 rpmconvert_LDADD =      -lrpmbuild -lrpm -lpopt -lgdbm
53
54 install-data-local:
55         @$(mkinstalldirs) $(DESTDIR)/var/lib/rpm
56         @rm -f $(DESTDIR)/$(libdir)/rpmrc
57         @ln -s rpm/rpmrc $(DESTDIR)/$(libdir)/rpmrc
58         @rm -f $(DESTDIR)/$(libdir)/rpmpopt
59         @ln -s rpm/rpmpopt $(DESTDIR)/$(libdir)/rpmpopt
60         @$(mkinstalldirs) $(DESTDIR)/$(prefix)/src/redhat/BUILD
61         @$(mkinstalldirs) $(DESTDIR)/$(prefix)/src/redhat/RPMS/noarch
62         @$(mkinstalldirs) $(DESTDIR)/$(prefix)/src/redhat/RPMS/@build_cpu@
63         @$(mkinstalldirs) $(DESTDIR)/$(prefix)/src/redhat/SOURCES
64         @$(mkinstalldirs) $(DESTDIR)/$(prefix)/src/redhat/SPECS
65         @$(mkinstalldirs) $(DESTDIR)/$(prefix)/src/redhat/SRPMS
66         @$(mkinstalldirs) $(DESTDIR)/var/lib/rpm
67         @$(mkinstalldirs) $(DESTDIR)/var/tmp
68
69 # FIXME: these should be generated in configure.in
70 find-requires: find-requires.sh
71         cp $< $@
72 find-provides: find-provides.sh
73         cp $< $@
74 rpmrc: lib-rpmrc
75         cp $< $@
76
77 # FIXME: these should be checked
78 .PHONY:                tar
79 tar:
80         rm -rf /tmp/rpm-$(VERSION)
81         make installprefix=/tmp/rpm-$(VERSION)$(ROOT) install
82         $(mkinstalldirs) /tmp/rpm-$(VERSION)/usr/local/src/redhat/SOURCES
83         $(mkinstalldirs) /tmp/rpm-$(VERSION)/usr/local/src/redhat/SPECS
84         $(mkinstalldirs) /tmp/rpm-$(VERSION)/usr/local/src/redhat/SRPMS
85         $(mkinstalldirs) /tmp/rpm-$(VERSION)/usr/local/src/redhat/RPMS
86         $(mkinstalldirs) /tmp/rpm-$(VERSION)/usr/local/src/redhat/BUILD
87         $(mkinstalldirs) /tmp/rpm-$(VERSION)/var/local/lib/rpm
88         $(mkinstalldirs) /tmp/rpm-$(VERSION)/var/tmp
89 #       Couldn't figure de ARCH value   
90 #       $(mkinstalldirs) /tmp/rpm-$(VERSION)/usr/local/src/redhat/RPMS/i386
91         cd /tmp/rpm-$(VERSION) ; tar cvf /tmp/rpm-$(VERSION).tar .
92
93 .PHONY: noconfig
94 noconfig:
95         find . -name "Makefile" -exec rm {} \; 
96         rm -f *gz *rpm config.*
97
98 .PHONY: archive
99 archive: 
100         @echo " "
101         @echo "I hope you checked everything out and made sure it builds"
102         @echo "maybe someday Erik will get around to making that automatic."
103         @echo
104         @echo "This is version $(VERSION)."
105         @sleep 5
106         @cvs -Q tag -F $(CVSTAG) .
107         @rm -rf /tmp/rpm-$(VERSION) /tmp/rpm
108         @cd /tmp; cvs -Q -d $(CVSROOT) export -r$(CVSTAG) rpm || :
109         @mv /tmp/rpm /tmp/rpm-$(VERSION)
110         @rm /tmp/rpm-$(VERSION)/popt/popt.spec
111         @cd /tmp/rpm-$(VERSION); ./autogen.sh
112         @make -C /tmp/rpm-$(VERSION) distclean
113         @cd /tmp/rpm-$(VERSION); ./autogen.sh --noconfigure
114         @cd /tmp; tar czSpf rpm-$(VERSION).tar.gz rpm-$(VERSION)
115         @rm -rf /tmp/rpm-$(VERSION)
116         @cp /tmp/rpm-$(VERSION).tar.gz .
117         @rm -f /tmp/rpm-$(VERSION).tar.gz 
118         @echo " "
119         @echo "The final archive is ./rpm-$(VERSION).tar.gz."