wifi: ieee80211: add helper to validate ML element type and size
[carl9170fw.git] / toolchain / Makefile
1 BINUTILS_VER=2.40
2 BINUTILS_TAR=binutils-$(BINUTILS_VER).tar.xz
3 BINUTILS_URL="http://mirrors.kernel.org/gnu/binutils/$(BINUTILS_TAR)"
4
5 NEWLIB_VER=4.3.0.20230120
6 NEWLIB_TAR=newlib-$(NEWLIB_VER).tar.gz
7 NEWLIB_URL="ftp://sourceware.org/pub/newlib/$(NEWLIB_TAR)"
8
9 GCC_VER=13.2.0
10 GCC_TAR=gcc-$(GCC_VER).tar.xz
11 GCC_URL="http://mirrors.kernel.org/gnu/gcc/gcc-$(GCC_VER)/$(GCC_TAR)"
12
13 MPFR_VER=4.2.0
14 MPFR_TAR=mpfr-$(MPFR_VER).tar.xz
15 MPFR_URL="http://ftpmirror.gnu.org/gnu/mpfr/$(MPFR_TAR)"
16
17 GMP_VER=6.2.1
18 GMP_TAR=gmp-$(GMP_VER).tar.xz
19 GMP_URL="http://ftpmirror.gnu.org/gnu/gmp/$(GMP_TAR)"
20
21 MPC_VER=1.3.1
22 MPC_TAR=mpc-$(MPC_VER).tar.gz
23 MPC_URL="http://ftpmirror.gnu.org/gnu/mpc/$(MPC_TAR)"
24
25 JOBS?=$(shell grep -c ^processor /proc/cpuinfo)
26
27 BASEDIR=$(shell pwd)
28
29 define checksum
30 @if grep -q '  $(subst .,\.,$(1))$$' SHA256SUMS; then                   \
31         grep '  $(subst .,\.,$(1))$$' SHA256SUMS | sha256sum -c || rm $(1);     \
32 else                                                                    \
33         echo "WARNING: no checksum defined for $(1)";                   \
34 fi
35 endef
36
37 all: clean gcc
38
39 src/$(MPFR_TAR):
40         wget -P "$(BASEDIR)/src" "$(MPFR_URL)"
41         $(call checksum,$@)
42
43 src/$(GMP_TAR):
44         wget -P "$(BASEDIR)/src" "$(GMP_URL)"
45         $(call checksum,$@)
46
47 src/$(MPC_TAR):
48         wget -P "$(BASEDIR)/src" "$(MPC_URL)"
49         $(call checksum,$@)
50
51 src/$(BINUTILS_TAR):
52         wget -P "$(BASEDIR)/src" "$(BINUTILS_URL)"
53         $(call checksum,$@)
54
55 src/$(NEWLIB_TAR):
56         wget -P "$(BASEDIR)/src" "$(NEWLIB_URL)"
57         $(call checksum,$@)
58
59 src/$(GCC_TAR):
60         wget -P "$(BASEDIR)/src" "$(GCC_URL)"
61         $(call checksum,$@)
62
63 src/mpfr-$(MPFR_VER): src/$(MPFR_TAR)
64         tar -C "$(BASEDIR)/src" -xf "$<"
65
66 src/gmp-$(GMP_VER): src/$(GMP_TAR)
67         tar -C "$(BASEDIR)/src" -xf "$<"
68
69 src/mpc-$(MPC_VER): src/$(MPC_TAR)
70         tar -C "$(BASEDIR)/src" -xf "$<"
71
72 src/binutils-$(BINUTILS_VER): src/$(BINUTILS_TAR)
73         tar -C "$(BASEDIR)/src" -xf "$<"
74
75 src/newlib-$(NEWLIB_VER): src/$(NEWLIB_TAR)
76         tar -C "$(BASEDIR)/src" -xf "$<"
77
78 src/gcc-$(GCC_VER): src/$(GCC_TAR) src/newlib-$(NEWLIB_VER) src/mpc-$(MPC_VER) src/gmp-$(GMP_VER) src/mpfr-$(MPFR_VER)
79         tar -C "$(BASEDIR)/src" -xf "$<"
80         ln -s "$(BASEDIR)/src/newlib-$(NEWLIB_VER)/newlib" "$@"
81         ln -s "$(BASEDIR)/src/newlib-$(NEWLIB_VER)/libgloss" "$@"
82         ln -s "$(BASEDIR)/src/gmp-$(GMP_VER)" "$@/gmp"
83         ln -s "$(BASEDIR)/src/mpfr-$(MPFR_VER)" "$@/mpfr"
84         ln -s "$(BASEDIR)/src/mpc-$(MPC_VER)" "$@/mpc"
85
86 binutils: src/binutils-$(BINUTILS_VER)
87         mkdir -p "$(BASEDIR)/build/binutils"
88         cd "$(BASEDIR)/build/binutils"; \
89         "$(BASEDIR)"/$</configure --target=sh-elf --prefix="$(BASEDIR)/inst"; \
90         $(MAKE) -j$(JOBS); \
91         $(MAKE) install
92
93 gcc: src/gcc-$(GCC_VER) binutils
94         mkdir -p "$(BASEDIR)/build/gcc"
95         cd "$(BASEDIR)/build/gcc"; \
96         "$(BASEDIR)"/$</configure --target=sh-elf --prefix="$(BASEDIR)/inst" -enable-languages=c --without-pkgversion --with-newlib; \
97         $(MAKE) -j$(JOBS); \
98         $(MAKE) install
99
100 clean:
101         rm -rf "$(BASEDIR)/build" "$(BASEDIR)/inst"
102
103 distclean: clean
104         rm -rf "$(BASEDIR)/src"