Sat Jun 29 00:02:11 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
[glibc.git] / rpm / Makefile
blob148a3a19d65c9844b1f44e69d3eb27e86aa9972e
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 ($(foreach var,$(instvars),\
69 list='$(install-$(var))'; \
70 for f in $$list; do \
71 echo $(filter-out /,$($(var)dir)/)$$f; \
72 done;\
73 )) | sort; \
74 (list='$(install-sysconf)'; \
75 for f in $$list; do \
76 echo %config $$f; \
77 done) | sort) > $@.new
78 mv -f $@.new $@
80 install-include = $(headers)
82 instfiles := $(sort $(foreach x,$(instvars),\
83 $(addprefix $(filter-out /,$($xdir)/),\
84 $(install-$x))))
86 # Build the binary rpm for this configuration.
87 glibc-$(version).$(config).rpm: $(config) rpmrc $(instfiles)
88 # rpm is really lame. You cannot tell it the name of the output file,
89 # and you can only guess at what the name will turn out to be!
90 arch=`uname -m | sed -e 's/i.86/i386/' -e 's/alpha/axp/'`; \
91 rm -f $$arch; ln -s . $$arch; \
92 rpm --rcfile rpmrc -bb $<; \
93 rm -f $$arch; \
94 mv -f glibc-$(version)-1.$${arch}.rpm $@
96 # Avoid time-consuming implicit rule search.
97 $(instfiles) : ;
99 .PHONY: clean
100 clean:
101 rm -f $(config) glibc-$(version).$(config).rpm