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