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.
9 include $(common-objpfx
)soversions.mk
11 distinfo
:= $(common-objpfx
)distinfo \
12 $(wildcard $(subdirs
:%=$(common-objpfx
)%/distinfo
))
15 config
= $(config-machine
)-$(config-vendor
)-$(config-os
)
17 headers
:= $(-headers
) $(foreach d
,$(subdirs
),$($d-headers
))
18 install-lib
:= $(-install-lib
) $(foreach d
,$(subdirs
),$($d-install
-lib
))
19 install-lib.so
:= $(-install-lib.so
) \
20 $(foreach d
,$(subdirs
),$(filter-out $($d-versioned
),\
21 $($d-install
-lib.so
)))
22 versioned
:= $(-versioned
) $(foreach d
,$(subdirs
),$($d-versioned
))
23 install-bin
:= $(-install-bin
) $(foreach d
,$(subdirs
),$($d-install
-bin
))
24 install-sbin
:= $(-install-sbin
) $(foreach d
,$(subdirs
),$($d-install
-sbin
))
25 install-data
:= $(-install-data
) $(foreach d
,$(subdirs
),$($d-install
-data
))
26 install-others
:= $(-install-others
) \
27 $(foreach d
,$(subdirs
),$($d-install
-others
))
29 # Notice things to be installed in /etc. They get specially marked as
30 # possibly user-modified config files.
31 install-sysconf
:= $(filter $(sysconfdir
)/%,$(install-others
))
32 install-others
:= $(filter-out $(sysconfdir
)/%,$(install-others
))
34 # Add the unversioned lib*.so's.
35 install-slib
= $(install-lib.so
)
37 # For each versioned lib*.so, add two files:
38 # lib*-VERSION.so and lib*.so.MAJOR
39 install-slib
+= $(foreach lib
,$(versioned
),\
40 $(patsubst %.so
,%-$(version
).so
,$(lib
)) \
41 $(lib
)$($(lib
)-version
))
42 install-lib
+= $(versioned
)
44 # Add libc.a and libc_p.a.
45 install-lib
+= $(foreach o
,$(filter-out .os
,$(object-suffixes-for-libc
)),\
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-slib
+= libc.so
53 install-lib
+= libc.so
54 install-slib
+= libc-
$(version
).so libc.so
$(libc.so-version
)
59 all: glibc-
$(version
).
$(config
).rpm
61 instvars
= include lib slib bin sbin data others
63 # Generate the rpm spec file for this configuration.
64 $(config
): template
$(distinfo
) Makefile
66 (sed
-e
's%@VERSION@%$(version)%g' \
67 -e
's%@prefix@%$(prefix)%g' \
69 ($(foreach var
,$(instvars
),\
70 list
='$(install-$(var))'; \
72 echo
$(filter-out /,$($(var
)dir)/)$$f; \
75 (list
='$(install-sysconf)'; \
78 done
) |
sort) > $@.new
81 install-include
= $(headers
)
83 instfiles
:= $(sort $(foreach x
,$(instvars
),\
84 $(addprefix $(filter-out /,$($xdir)/),\
87 # Build the binary rpm for this configuration.
88 glibc-
$(version
).
$(config
).rpm
: $(config
) rpmrc
$(instfiles
)
89 # rpm is really lame. You cannot tell it the name of the output file,
90 # and you can only guess at what the name will turn out to be!
91 arch
=`uname -m | sed -e 's/i.86/i386/' -e 's/alpha/axp/'`; \
92 rm -f
$$arch; ln
-s .
$$arch; \
93 rpm
--rcfile rpmrc
-bb
$<; \
95 mv
-f glibc-
$(version
)-1.
$${arch}.rpm
$@
97 # Avoid time-consuming implicit rule search.
102 rm -f
$(config
) glibc-
$(version
).
$(config
).rpm