universally apply our cflags (no vsx, no altivec..)
[glibc.git] / debian / rules
1 #! /usr/bin/make -f
2 # -*- makefile -*-
3 # debian/rules file for GNU libc.
4 # Copyright 1998, 1999 by Joel Klecker <espy@debian.org>
5 # Copyright 2000 Ben Collins <bcollins@debian.org>
6 # Copyright 2003 Jeff Bailey <jbailey@debian.org>
7 # This Makefile is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
11
12 # What are the phases to building glibc?
13
14 # Unpack main tarball
15 # Do any necessary overlays
16 # Apply patches
17 # Determine how many builds there are to do. For Each build:
18
19 # Create build directory
20 # Configure
21 # Build
22 # Test as desired
23 # Install to package directories
24
25 # Run debian magic to build packages.
26
27 # Things you may need to customise:
28
29 # These are done as absolute paths so that in the case of filesystem size
30 # limitations, they can be overridden and spread all over.
31 build-tree := build-tree
32 debian-tmp = debian/tmp$(filter-out -libc,-$(curpass))
33 stamp := $(CURDIR)/stamp-dir/
34 DUMMY := $(shell mkdir -p $(stamp))
35
36 # Beyond here you shouldn't need to customise anything:
37 DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
38 DEB_HOST_ARCH_CPU ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU)
39 DEB_HOST_ARCH_ENDIAN ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_ENDIAN)
40 DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
41 DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
42 DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
43 DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)
44 DEB_BUILD_ARCH_BITS ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH_BITS)
45 DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
46
47 include /usr/share/dpkg/pkg-info.mk
48
49 # The minimum package version with which these packages are compatible.
50 shlib_dep_ver = $(DEB_VERSION_UPSTREAM)
51 shlib_dep = $(libc) (>= $(shlib_dep_ver))
52
53 DEB_BUILDDIR ?= $(build-tree)/$(DEB_HOST_ARCH)-$(curpass)
54 DEB_BUILDDIRLIBC ?= $(build-tree)/$(DEB_HOST_ARCH)-libc
55
56 GLIBC_SOURCES = $(filter-out debian $(shell basename $(stamp)) $(build-tree), $(wildcard *))
57
58 # Support multiple makes at once based on number of processors
59 ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
60 NJOBS := -j $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
61 endif
62
63 # use the package settings, not the settings from the environment
64 define unsetenv
65 unexport $(1)
66 $(1) =
67 endef
68 $(foreach v, CPPFLAGS CFLAGS CXXFLAGS LDFLAGS, $(if $(filter environment,$(origin $(v))),$(eval $(call unsetenv, $(v)))))
69
70 # export debhelper substitution variables
71 export $(build-tree)
72
73 # Default setup
74 GLIBC_PASSES ?= libc
75
76 prefix=/usr
77 bindir=$(prefix)/bin
78 datadir=$(prefix)/share
79 complocaledir=$(prefix)/lib/locale
80 sysconfdir=/etc
81 libexecdir=$(prefix)/lib
82 rootsbindir=/sbin
83 includedir=$(prefix)/include
84 docdir=$(prefix)/share/doc
85 mandir=$(prefix)/share/man
86 sbindir=$(prefix)/sbin
87 vardbdir=/var/lib/misc
88 rtlddir=/lib
89 slibdir=/lib/$(DEB_HOST_MULTIARCH)
90 libdir=/usr/lib/$(DEB_HOST_MULTIARCH)
91 mvec = no
92
93 rtld_so=$(shell awk 'BEGIN {FS="="} /^ld\.so-version/ {print $$2}' $(DEB_BUILDDIR)/soversions.mk)
94 libc_so=$(shell awk 'BEGIN {FS="="} /^libc\.so-version/ {print "libc.so"$$2}' $(DEB_BUILDDIR)/soversions.mk)
95
96 BASE_CC = gcc
97 BASE_CXX = g++
98 BASE_MIG = mig
99 DEB_GCC_VERSION ?= -12
100
101 RUN_TESTSUITE = yes
102 TIMEOUTFACTOR = 25
103
104 # Set cross and native compiler names, including version.
105 CC = $(DEB_HOST_GNU_TYPE)-$(BASE_CC)$(DEB_GCC_VERSION)
106 CXX = $(DEB_HOST_GNU_TYPE)-$(BASE_CXX)$(DEB_GCC_VERSION)
107 MIG = $(DEB_HOST_GNU_TYPE)-$(BASE_MIG)
108 BUILD_CC = $(DEB_BUILD_GNU_TYPE)-$(BASE_CC)
109 BUILD_CXX = $(DEB_BUILD_GNU_TYPE)-$(BASE_CXX)
110
111 BUILD_CFLAGS = -O2 -g -fdebug-prefix-map=$(CURDIR)=.
112 HOST_CFLAGS = -pipe -O2 -g -fdebug-prefix-map=$(CURDIR)=. $(call xx,extra_cflags)
113
114 extra_cflags += -mno-altivec -mno-vsx -mno-htm -mno-crypto
115
116 # 32-bit MIPS builders have a 2GB memory space. This is not enough to
117 # build test-tgmath3.o with GCC, unless tweaking the garbage collector.
118 ifeq ($(findstring mips,$(DEB_BUILD_ARCH))-$(DEB_BUILD_ARCH_BITS), mips-32)
119 CC += --param ggc-min-expand=10
120 endif
121
122 configure_target := $(DEB_HOST_GNU_TYPE)
123
124 # Normally we'll just use this for --build. If the architecture requires
125 # that build daemons be able to run a particular optimized library, then
126 # they can set the --build to match --host for that optimized build.
127 # Among other things this lets tests run.
128 configure_build := $(DEB_BUILD_GNU_TYPE)
129
130 # Which build pass are we on?
131 curpass = $(filter-out %_,$(subst _,_ ,$@))
132
133 ifneq ($(filter stage1,$(DEB_BUILD_PROFILES)),)
134 DEB_ARCH_REGULAR_PACKAGES = $(libc)-dev
135 DEB_INDEP_REGULAR_PACKAGES =
136 DEB_UDEB_PACKAGES =
137 ifeq ($(filter nocheck,$(DEB_BUILD_OPTIONS)),)
138 DEB_BUILD_OPTIONS+=nocheck
139 endif
140 else
141 DEB_ARCH_REGULAR_PACKAGES = $(libc) $(libc)-dev $(libc)-dbg libc-bin libc-dev-bin
142 ifeq ($(filter stage2,$(DEB_BUILD_PROFILES)),)
143 DEB_ARCH_REGULAR_PACKAGES += libc-devtools
144 endif
145 DEB_INDEP_REGULAR_PACKAGES = glibc-doc glibc-source libc-l10n locales
146 ifneq ($(filter noudeb,$(DEB_BUILD_PROFILES)),)
147 DEB_UDEB_PACKAGES =
148 else
149 DEB_UDEB_PACKAGES = $(libc)-udeb
150 endif
151 ## Locales can only be pre-generated during native compiles
152 ifeq ($(DEB_HOST_ARCH),$(DEB_BUILD_ARCH))
153 DEB_ARCH_REGULAR_PACKAGES += locales-all
154 endif
155 endif
156
157 # Generic kernel version check
158 define kernel_check
159 (if [ $(CURRENT_KERNEL_VERSION) -lt $(1) ]; then \
160 false; \
161 fi)
162 endef
163
164 # Include libidn for both NPTL and FBTL targets.
165 standard-add-ons = libidn,
166
167 # Pull in all the per-arch magic!
168
169 -include debian/sysdeps/$(DEB_HOST_ARCH_OS).mk
170 -include debian/sysdeps/$(DEB_HOST_ARCH).mk
171
172 ifneq ($(filter stage1,$(DEB_BUILD_PROFILES)),)
173 DEB_ARCH_REGULAR_PACKAGES += $(foreach p,$(DEB_ARCH_MULTILIB_PACKAGES), $(if $(findstring -dev,$(p)), $(p)))
174 else
175 DEB_ARCH_REGULAR_PACKAGES += $(DEB_ARCH_MULTILIB_PACKAGES)
176 endif
177
178 # Don't run dh_strip on this package
179 NOSTRIP_$(libc)-dbg = 1
180
181 # Put the debug files from these packages in $(libc)-dbg
182 DEBUG_$(libc) = 1
183 DEBUG_libc6.1-alphaev67 = 1
184
185 ifeq ($(filter stage1,$(DEB_BUILD_PROFILES)),)
186 ifeq ($(threads),yes)
187 DEB_ARCH_REGULAR_PACKAGES += nscd
188 endif
189 endif
190
191 # And now the rules...
192 include debian/rules.d/*.mk
193
194 clean:: unpatch
195 rm -rf $(patsubst %,debian/tmp-%,$(GLIBC_PASSES))
196 rm -rf $(build-tree)
197 rm -rf $(stamp)
198 rm -rf debian/include
199 rm -f debian/control.in/libc0.1 debian/control.in/libc0.3 \
200 debian/control.in/libc6 debian/control.in/libc6.1 \
201 debian/*.preinst.* debian/*.links.*
202
203 # Required Debian targets
204 build-arch: $(stamp)info \
205 $(patsubst %,$(stamp)build_%,$(GLIBC_PASSES)) \
206 $(patsubst %,$(stamp)check_%,$(GLIBC_PASSES)) \
207 build-arch-post-check
208
209 ifeq ($(filter stage1,$(DEB_BUILD_PROFILES)),)
210 build-arch: $(stamp)build_C.utf8 \
211 $(stamp)build_locales-all
212 endif
213
214 build-indep: $(stamp)source $(stamp)build_libc
215
216 build: build-arch build-indep
217
218
219 binary-indep: build-indep testroot debian/control $(build-tree) \
220 $(patsubst %,$(stamp)binaryinst_%,$(DEB_INDEP_REGULAR_PACKAGES))
221
222 binary-arch: build-arch testroot debian/control $(build-tree) \
223 $(patsubst %,$(stamp)binaryinst_%,$(DEB_ARCH_REGULAR_PACKAGES)) \
224 $(patsubst %,$(stamp)binaryinst_%,$(DEB_UDEB_PACKAGES))
225
226 binary: binary-indep binary-arch
227
228 testroot:
229 dh_testroot