update from main archive 961119
[glibc.git] / rpm / Makefile
blob22544506f690b8f6193234c20ed1a98f902e86cf
1 # A start at automated rpm-making for GNU libc.
2 # Generates an rpm spec file in `CPU-VENDOR-OS' from the list of installed
3 # files and the `template' file.
5 all:
7 subdir := rpm
8 include ../Makeconfig
9 include $(common-objpfx)soversions.mk
10 include $(common-objpfx)version.mk
12 distinfo := $(common-objpfx)distinfo- \
13 $(wildcard $(subdirs:%=$(common-objpfx)distinfo-%))
14 -include $(distinfo)
16 config = $(config-machine)-$(config-vendor)-$(config-os)
18 headers := $(-headers) $(foreach d,$(subdirs),$($d-headers))
19 install-lib := $(-install-lib) $(foreach d,$(subdirs),$($d-install-lib))
20 install-lib.so := $(-install-lib.so) \
21 $(foreach d,$(subdirs),$(filter-out $($d-versioned),\
22 $($d-install-lib.so)))
23 versioned := $(-versioned) $(foreach d,$(subdirs),$($d-versioned))
24 install-bin := $(-install-bin) $(foreach d,$(subdirs),$($d-install-bin))
25 install-sbin := $(-install-sbin) $(foreach d,$(subdirs),$($d-install-sbin))
26 install-data := $(-install-data) $(foreach d,$(subdirs),$($d-install-data))
27 install-others := $(-install-others) \
28 $(foreach d,$(subdirs),$($d-install-others))
30 # Notice things to be installed in /etc. They get specially marked as
31 # possibly user-modified config files.
32 install-sysconf := $(filter $(sysconfdir)/%,$(install-others))
33 install-others := $(filter-out $(sysconfdir)/%,$(install-others))
35 # Add the unversioned lib*.so's to install-lib.
36 install-lib += $(install-lib.so)
38 # For each versioned lib*.so, add three files:
39 # lib*-VERSION.so, lib*.so.MAJOR, and lib*.so
40 install-lib += $(foreach lib,$(versioned),\
41 $(patsubst %.so,%-$(version).so,$(lib)) \
42 $(lib)$($(lib)-version) $(lib))
44 # Add libc.a and libc_p.a.
45 install-lib += $(foreach o,$(filter-out .so,$(object-suffixes)),\
46 $(patsubst %,$(libtype$o),c))
48 ifeq (yes,$(build-shared))
49 # Add libc.so itself, which is a special case in Makerules.
50 ifndef libc.so-version
51 install-others += $(slibdir)/libc.so
52 else
53 install-others += $(libdir)/libc.so \
54 $(slibdir)/libc-$(version).so \
55 $(slibdir)/libc.so$(libc.so-version)
56 endif
57 endif
60 all: glibc-$(version).$(config).rpm
62 instvars = include lib bin sbin data others
64 # Generate the rpm spec file for this configuration.
65 $(config): template $(distinfo) Makefile
66 rm -f $@.new
67 (sed -e 's%@VERSION@%$(version)%g' \
68 -e 's%@prefix@%$(prefix)%g' \
69 $<; \
70 ($(foreach var,$(instvars),\
71 list='$(install-$(var))'; \
72 for f in $$list; do \
73 echo $(filter-out /,$($(var)dir)/)$$f; \
74 done;\
75 )) | sort; \
76 (list='$(install-sysconf)'; \
77 for f in $$list; do \
78 echo %config $$f; \
79 done) | sort) > $@.new
80 mv -f $@.new $@
82 install-include = $(headers)
84 instfiles := $(sort $(foreach x,$(instvars),\
85 $(addprefix $(filter-out /,$($xdir)/),\
86 $(install-$x))))
88 # Build the binary rpm for this configuration.
89 glibc-$(version).$(config).rpm: $(config) rpmrc $(instfiles)
90 # rpm is really lame. You cannot tell it the name of the output file,
91 # and you can only guess at what the name will turn out to be!
92 arch=`uname -m | sed -e 's/i.86/i386/' -e 's/alpha/axp/'`; \
93 rm -f $$arch; ln -s . $$arch; \
94 rpm --rcfile rpmrc -bb $<; \
95 rm -f $$arch; \
96 mv -f glibc-$(version)-1.$${arch}.rpm $@
98 # Avoid time-consuming implicit rule search.
99 $(instfiles) : ;
101 .PHONY: clean
102 clean:
103 rm -f $(config) glibc-$(version).$(config).rpm