File: rules

package info (click to toggle)
libstdc%2B%2B-arm-none-eabi 29
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 76 kB
  • sloc: makefile: 108; sh: 6
file content (132 lines) | stat: -rwxr-xr-x 4,917 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#!/usr/bin/make -f
# export DH_VERBOSE=1

export DEB_BUILD_MAINT_OPTIONS=hardening=-fortify,-stackprotector

TARGET=arm-none-eabi

MULTILIB_LIST="--with-multilib-list=rmprofile"

GCC_PACKAGE=gcc-arm-none-eabi

include /usr/share/dpkg/pkg-info.mk

SVERSION := $(shell dpkg-query -W -f="\$${Version}\n" $(GCC_PACKAGE)-source)
DVERSION := $(SVERSION)+$(DEB_VERSION)
UVERSION := $(shell echo $(DVERSION) | cut -d- -f1)
BASE_VERSION := $(shell echo $(DVERSION) | sed -e 's/\([1-9]\.[0-9]\).*-.*/\1/')

TOP_DIR=$(shell pwd)
LIBSTDCXX_SDIR=$(TOP_DIR)/src/libstdc++-v3
STAMP_DIR=$(TOP_DIR)/debian/stamp
UNPACK=$(STAMP_DIR)/unpack
APPY_PATCHES=$(STAMP_DIR)/patches
BUILD_DIR=$(TOP_DIR)/build/libstdc++
BUILD_NANO_DIR=$(TOP_DIR)/build_nano/libstdc++
BUILD_PICOLIBC_DIR=$(TOP_DIR)/build_picolibc/libstdc++
BUILD_PICOLIBC_RELEASE_DIR=$(TOP_DIR)/build_picolibc_release/libstdc++
PNEWLIB=libstdc\+\+-arm-none-eabi-newlib
PPICOLIBC=libstdc\+\+-arm-none-eabi-picolibc

CFLAGS := -ffile-prefix-map=$(TOP_DIR)=. -Wformat -Werror=format-security
CXXFLAGS := $(CFLAGS)

BUILDFLAGS=CFLAGS="$(CFLAGS) -g -O2 -ffunction-sections -fdata-sections" CXXFLAGS="$(CXXFLAGS) -g -O2 -ffunction-sections -fdata-sections" LDFLAGS="$(LDFLAGS)"
BUILDFLAGS_NANO=CFLAGS="$(CFLAGS) -g -Os -ffunction-sections -fdata-sections -fno-exceptions" CXXFLAGS="$(CXXFLAGS) -g -Os -ffunction-sections -fdata-sections -fno-exceptions" LDFLAGS="$(LDFLAGS)"
BUILDFLAGS_PICOLIBC=CFLAGS="--specs=picolibc.specs $(CFLAGS) -g -Os -ffunction-sections -fdata-sections -fno-exceptions" CXXFLAGS="--specs=picolibcpp.specs $(CXXFLAGS) -g -Os -ffunction-sections -fdata-sections -fno-exceptions" LDFLAGS="--specs=picolibc.specs $(LDFLAGS)"
BUILDFLAGS_PICOLIBC_RELEASE=CFLAGS="--specs=picolibc.specs --picolibc-buildtype=release $(CFLAGS) -g -O3 -ffunction-sections -fdata-sections -fno-exceptions" CXXFLAGS="--specs=picolibcpp.specs --picolibc-buildtype=release $(CXXFLAGS) -g -Os -ffunction-sections -fdata-sections -fno-exceptions" LDFLAGS="--specs=picolibc.specs --picolibc-buildtype=release $(LDFLAGS)"

TARGET_TOOLS=\
	AR_FOR_TARGET=$(TARGET)-ar \
	AS_FOR_TARGET=$(TARGET)-as \
	LD_FOR_TARGET=$(TARGET)-ld \
	NM_FOR_TARGET=$(TARGET)-nm \
	OBJDUMP_FOR_TARGET=$(TARGET)-objdump \
	RANLIB_FOR_TARGET=$(TARGET)-ranlib \
	READELF_FOR_TARGET=$(TARGET)-readelf \
	STRIP_FOR_TARGET=$(TARGET)-strip

CONFIGURE_FLAGS = \
	--with-cross-host=$(DEB_HOST_GNU_TYPE) \
	--with-target-subdir="." \
	--enable-multilib \
	--disable-decimal-float \
	--disable-libffi \
	--disable-libgomp \
	--disable-libmudflap \
	--disable-libquadmath \
	--disable-libssp \
	--disable-libstdcxx-pch \
	--disable-nls \
	--disable-shared \
	--disable-threads \
	--enable-tls \
	--disable-plugin \
	--disable-libstdcxx-verbose \
	--mandir=/usr/share/man \
	--with-system-zlib \
	--with-gnu-as \
	--with-gnu-ld \
	--with-newlib \
	--with-headers=yes \
	"--with-pkgversion=$(DVERSION)" \
	--without-included-gettext \
	--with-host-libstdcxx="-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm" \
	--enable-languages=c,c++ \
	--disable-option-checking \
	--build=$(DEB_BUILD_GNU_TYPE) \
	--target=$(TARGET) \
	--host=$(TARGET) \
	$(MULTILIB_LIST) \
	$(TARGET_TOOLS)

CONFIGURE_FLAGS_PICOLIBC= \
	--enable-cstdio=stdio_pure \
	--disable-wchar_t \

%:
	dh $@

$(UNPACK):
	mkdir -p $(STAMP_DIR)
	mkdir -p $(TOP_DIR)/src
	tar xf /usr/src/gcc-arm-none-eabi-source.tar.* -C $(TOP_DIR)/src
	touch $@

override_dh_auto_configure: $(UNPACK)
	mkdir -p $(BUILD_DIR) $(BUILD_NANO_DIR)
	dh_auto_configure -D$(LIBSTDCXX_SDIR) -B$(BUILD_DIR) -- $(CONFIGURE_FLAGS) $(BUILDFLAGS)
	dh_auto_configure -D$(LIBSTDCXX_SDIR) -B$(BUILD_NANO_DIR) -- $(CONFIGURE_FLAGS) $(BUILDFLAGS_NANO)
	dh_auto_configure -D$(LIBSTDCXX_SDIR) -B$(BUILD_PICOLIBC_DIR) -- $(CONFIGURE_FLAGS) $(CONFIGURE_FLAGS_PICOLIBC) $(BUILDFLAGS_PICOLIBC)
	dh_auto_configure -D$(LIBSTDCXX_SDIR) -B$(BUILD_PICOLIBC_RELEASE_DIR) -- $(CONFIGURE_FLAGS) $(CONFIGURE_FLAGS_PICOLIBC) $(BUILDFLAGS_PICOLIBC_RELEASE)

override_dh_auto_clean:
	rm -rf src build* debian/*tmp* $(STAMP_DIR)

override_dh_auto_test:
	@echo "no testing, that's way too painful"

override_dh_gencontrol:
	dh_gencontrol -- -v$(DVERSION) -Vlocal:Version=$(UVERSION) -Vgcc:Version=$(SVERSION)

override_dh_auto_build:
	dh_auto_build -B $(BUILD_DIR)
	dh_auto_build -B $(BUILD_NANO_DIR)
	dh_auto_build -B $(BUILD_PICOLIBC_DIR)
	dh_auto_build -B $(BUILD_PICOLIBC_RELEASE_DIR)

override_dh_auto_install:
	dh_auto_install -B $(BUILD_DIR) --destdir debian/tmp
	dh_auto_install -B $(BUILD_NANO_DIR) --destdir debian/tmp_nano
	dh_auto_install -B $(BUILD_PICOLIBC_DIR) --destdir debian/tmp/picolibc
	dh_auto_install -B $(BUILD_PICOLIBC_RELEASE_DIR) --destdir debian/tmp/picolibc-release
	find debian/tmp_nano \
		-name "*.a" \
		-exec rename 's@debian/tmp_nano/(.*).a@debian/tmp/$$1_nano.a@' \{\} \;
	find debian/tmp -name "*.la" -exec rm -f {} +

override_dh_install:
	dh_install

override_dh_strip:
	dh_strip -X.a