2015-08-25 21:32:46 +02:00
|
|
|
|
2015-11-10 02:11:56 +01:00
|
|
|
SOURCES = sources
|
2015-08-25 21:32:46 +02:00
|
|
|
|
2016-05-01 07:36:28 +02:00
|
|
|
CONFIG_SUB_REV = 3d5db9ebe860
|
2020-01-22 06:03:07 +01:00
|
|
|
BINUTILS_VER = 2.33.1
|
2020-01-22 07:13:14 +01:00
|
|
|
GCC_VER = 9.2.0
|
2021-06-23 22:26:49 +02:00
|
|
|
MUSL_VER = 1.2.2
|
2019-07-16 19:41:33 +02:00
|
|
|
GMP_VER = 6.1.2
|
|
|
|
MPC_VER = 1.1.0
|
|
|
|
MPFR_VER = 4.0.2
|
2019-12-18 20:29:07 +01:00
|
|
|
LINUX_VER = headers-4.19.88
|
2015-08-25 21:32:46 +02:00
|
|
|
|
2016-05-01 07:36:28 +02:00
|
|
|
GNU_SITE = https://ftp.gnu.org/pub/gnu
|
2015-11-06 07:35:17 +01:00
|
|
|
GCC_SITE = $(GNU_SITE)/gcc
|
|
|
|
BINUTILS_SITE = $(GNU_SITE)/binutils
|
2016-05-01 07:36:28 +02:00
|
|
|
GMP_SITE = $(GNU_SITE)/gmp
|
|
|
|
MPC_SITE = $(GNU_SITE)/mpc
|
|
|
|
MPFR_SITE = $(GNU_SITE)/mpfr
|
2016-05-22 13:27:05 +02:00
|
|
|
ISL_SITE = http://isl.gforge.inria.fr/
|
2015-11-06 07:35:17 +01:00
|
|
|
|
2020-12-21 13:33:36 +01:00
|
|
|
MUSL_SITE = https://musl.libc.org/releases
|
2016-05-01 07:36:28 +02:00
|
|
|
MUSL_REPO = git://git.musl-libc.org/musl
|
2015-08-25 21:32:46 +02:00
|
|
|
|
2016-05-14 06:14:52 +02:00
|
|
|
LINUX_SITE = https://cdn.kernel.org/pub/linux/kernel
|
2019-08-17 04:20:47 +02:00
|
|
|
LINUX_HEADERS_SITE = http://ftp.barfooze.de/pub/sabotage/tarballs/
|
2016-05-14 06:14:52 +02:00
|
|
|
|
2016-12-15 05:42:27 +01:00
|
|
|
DL_CMD = wget -c -O
|
2020-03-07 05:12:57 +01:00
|
|
|
SHA1_CMD = sha1sum -c
|
2016-12-15 05:42:27 +01:00
|
|
|
|
2020-03-07 22:32:46 +01:00
|
|
|
COWPATCH = $(CURDIR)/cowpatch.sh
|
2020-01-21 08:49:07 +01:00
|
|
|
|
2018-08-06 03:36:14 +02:00
|
|
|
HOST = $(if $(NATIVE),$(TARGET))
|
|
|
|
BUILD_DIR = build/$(if $(HOST),$(HOST),local)/$(TARGET)
|
|
|
|
OUTPUT = $(CURDIR)/output$(if $(HOST),-$(HOST))
|
2017-06-11 01:47:23 +02:00
|
|
|
|
|
|
|
REL_TOP = ../../..
|
2015-08-25 21:32:46 +02:00
|
|
|
|
|
|
|
-include config.mak
|
|
|
|
|
2016-05-01 07:36:28 +02:00
|
|
|
SRC_DIRS = gcc-$(GCC_VER) binutils-$(BINUTILS_VER) musl-$(MUSL_VER) \
|
|
|
|
$(if $(GMP_VER),gmp-$(GMP_VER)) \
|
|
|
|
$(if $(MPC_VER),mpc-$(MPC_VER)) \
|
2016-05-14 06:14:52 +02:00
|
|
|
$(if $(MPFR_VER),mpfr-$(MPFR_VER)) \
|
2016-05-22 13:27:05 +02:00
|
|
|
$(if $(ISL_VER),isl-$(ISL_VER)) \
|
2016-05-14 06:14:52 +02:00
|
|
|
$(if $(LINUX_VER),linux-$(LINUX_VER))
|
2015-08-25 21:32:46 +02:00
|
|
|
|
2016-05-01 07:36:28 +02:00
|
|
|
all:
|
2015-08-25 21:32:46 +02:00
|
|
|
|
2015-08-25 23:28:55 +02:00
|
|
|
clean:
|
2017-06-23 05:06:38 +02:00
|
|
|
rm -rf gcc-* binutils-* musl-* gmp-* mpc-* mpfr-* isl-* build build-* linux-*
|
2015-08-25 23:28:55 +02:00
|
|
|
|
|
|
|
distclean: clean
|
2015-11-10 02:11:56 +01:00
|
|
|
rm -rf sources
|
2015-08-25 21:32:46 +02:00
|
|
|
|
2015-11-10 00:45:56 +01:00
|
|
|
|
2016-05-01 07:36:28 +02:00
|
|
|
# Rules for downloading and verifying sources. Treat an external SOURCES path as
|
|
|
|
# immutable and do not try to download anything into it.
|
2015-11-10 00:45:56 +01:00
|
|
|
|
2016-05-01 07:36:28 +02:00
|
|
|
ifeq ($(SOURCES),sources)
|
2015-11-10 00:45:56 +01:00
|
|
|
|
2016-05-01 07:36:28 +02:00
|
|
|
$(patsubst hashes/%.sha1,$(SOURCES)/%,$(wildcard hashes/gmp*)): SITE = $(GMP_SITE)
|
|
|
|
$(patsubst hashes/%.sha1,$(SOURCES)/%,$(wildcard hashes/mpc*)): SITE = $(MPC_SITE)
|
|
|
|
$(patsubst hashes/%.sha1,$(SOURCES)/%,$(wildcard hashes/mpfr*)): SITE = $(MPFR_SITE)
|
2016-05-22 13:27:05 +02:00
|
|
|
$(patsubst hashes/%.sha1,$(SOURCES)/%,$(wildcard hashes/isl*)): SITE = $(ISL_SITE)
|
2016-05-01 07:36:28 +02:00
|
|
|
$(patsubst hashes/%.sha1,$(SOURCES)/%,$(wildcard hashes/binutils*)): SITE = $(BINUTILS_SITE)
|
|
|
|
$(patsubst hashes/%.sha1,$(SOURCES)/%,$(wildcard hashes/gcc*)): SITE = $(GCC_SITE)/$(basename $(basename $(notdir $@)))
|
|
|
|
$(patsubst hashes/%.sha1,$(SOURCES)/%,$(wildcard hashes/musl*)): SITE = $(MUSL_SITE)
|
2020-08-29 00:56:20 +02:00
|
|
|
$(patsubst hashes/%.sha1,$(SOURCES)/%,$(wildcard hashes/linux-5*)): SITE = $(LINUX_SITE)/v5.x
|
2016-05-17 02:05:13 +02:00
|
|
|
$(patsubst hashes/%.sha1,$(SOURCES)/%,$(wildcard hashes/linux-4*)): SITE = $(LINUX_SITE)/v4.x
|
|
|
|
$(patsubst hashes/%.sha1,$(SOURCES)/%,$(wildcard hashes/linux-3*)): SITE = $(LINUX_SITE)/v3.x
|
|
|
|
$(patsubst hashes/%.sha1,$(SOURCES)/%,$(wildcard hashes/linux-2.6*)): SITE = $(LINUX_SITE)/v2.6
|
2019-08-17 04:20:47 +02:00
|
|
|
$(patsubst hashes/%.sha1,$(SOURCES)/%,$(wildcard hashes/linux-headers-*)): SITE = $(LINUX_HEADERS_SITE)
|
2015-11-10 00:45:56 +01:00
|
|
|
|
2015-11-10 02:11:56 +01:00
|
|
|
$(SOURCES):
|
|
|
|
mkdir -p $@
|
2015-08-25 21:32:46 +02:00
|
|
|
|
2015-11-10 02:11:56 +01:00
|
|
|
$(SOURCES)/config.sub: | $(SOURCES)
|
2016-05-01 07:36:28 +02:00
|
|
|
mkdir -p $@.tmp
|
2016-12-15 05:42:27 +01:00
|
|
|
cd $@.tmp && $(DL_CMD) $(notdir $@) "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=$(CONFIG_SUB_REV)"
|
2016-05-01 07:36:28 +02:00
|
|
|
cd $@.tmp && touch $(notdir $@)
|
2020-03-07 05:12:57 +01:00
|
|
|
cd $@.tmp && $(SHA1_CMD) $(CURDIR)/hashes/$(notdir $@).$(CONFIG_SUB_REV).sha1
|
2016-05-01 07:36:28 +02:00
|
|
|
mv $@.tmp/$(notdir $@) $@
|
|
|
|
rm -rf $@.tmp
|
|
|
|
|
|
|
|
$(SOURCES)/%: hashes/%.sha1 | $(SOURCES)
|
|
|
|
mkdir -p $@.tmp
|
2016-12-15 05:42:27 +01:00
|
|
|
cd $@.tmp && $(DL_CMD) $(notdir $@) $(SITE)/$(notdir $@)
|
2016-05-01 07:36:28 +02:00
|
|
|
cd $@.tmp && touch $(notdir $@)
|
2020-03-07 05:12:57 +01:00
|
|
|
cd $@.tmp && $(SHA1_CMD) $(CURDIR)/hashes/$(notdir $@).sha1
|
2016-05-01 07:36:28 +02:00
|
|
|
mv $@.tmp/$(notdir $@) $@
|
|
|
|
rm -rf $@.tmp
|
2015-08-25 21:32:46 +02:00
|
|
|
|
2016-05-01 07:36:28 +02:00
|
|
|
endif
|
2015-08-25 21:32:46 +02:00
|
|
|
|
|
|
|
|
2016-05-01 07:36:28 +02:00
|
|
|
# Rules for extracting and patching sources, or checking them out from git.
|
2015-08-25 21:32:46 +02:00
|
|
|
|
2016-05-01 07:36:28 +02:00
|
|
|
musl-git-%:
|
|
|
|
rm -rf $@.tmp
|
|
|
|
git clone -b $(patsubst musl-git-%,%,$@) $(MUSL_REPO) $@.tmp
|
|
|
|
cd $@.tmp && git fsck
|
|
|
|
mv $@.tmp $@
|
2015-08-25 21:32:46 +02:00
|
|
|
|
2020-01-22 23:26:56 +01:00
|
|
|
%.orig: $(SOURCES)/%.tar.gz
|
2020-01-23 19:21:24 +01:00
|
|
|
case "$@" in */*) exit 1 ;; esac
|
2016-05-01 07:36:28 +02:00
|
|
|
rm -rf $@.tmp
|
|
|
|
mkdir $@.tmp
|
|
|
|
( cd $@.tmp && tar zxvf - ) < $<
|
|
|
|
rm -rf $@
|
2020-01-21 08:49:07 +01:00
|
|
|
touch $@.tmp/$(patsubst %.orig,%,$@)
|
|
|
|
mv $@.tmp/$(patsubst %.orig,%,$@) $@
|
2016-05-01 07:36:28 +02:00
|
|
|
rm -rf $@.tmp
|
2015-08-25 21:32:46 +02:00
|
|
|
|
2020-01-22 23:26:56 +01:00
|
|
|
%.orig: $(SOURCES)/%.tar.bz2
|
2020-01-23 19:21:24 +01:00
|
|
|
case "$@" in */*) exit 1 ;; esac
|
2016-05-01 07:36:28 +02:00
|
|
|
rm -rf $@.tmp
|
|
|
|
mkdir $@.tmp
|
|
|
|
( cd $@.tmp && tar jxvf - ) < $<
|
|
|
|
rm -rf $@
|
2020-01-21 08:49:07 +01:00
|
|
|
touch $@.tmp/$(patsubst %.orig,%,$@)
|
|
|
|
mv $@.tmp/$(patsubst %.orig,%,$@) $@
|
2016-05-01 07:36:28 +02:00
|
|
|
rm -rf $@.tmp
|
2015-08-25 21:32:46 +02:00
|
|
|
|
2020-01-22 23:26:56 +01:00
|
|
|
%.orig: $(SOURCES)/%.tar.xz
|
2020-01-23 19:21:24 +01:00
|
|
|
case "$@" in */*) exit 1 ;; esac
|
2016-05-14 06:14:52 +02:00
|
|
|
rm -rf $@.tmp
|
|
|
|
mkdir $@.tmp
|
|
|
|
( cd $@.tmp && tar Jxvf - ) < $<
|
|
|
|
rm -rf $@
|
2020-01-21 08:49:07 +01:00
|
|
|
touch $@.tmp/$(patsubst %.orig,%,$@)
|
|
|
|
mv $@.tmp/$(patsubst %.orig,%,$@) $@
|
|
|
|
rm -rf $@.tmp
|
|
|
|
|
2020-01-22 23:26:56 +01:00
|
|
|
%: %.orig | $(SOURCES)/config.sub
|
2020-01-23 19:21:24 +01:00
|
|
|
case "$@" in */*) exit 1 ;; esac
|
2016-05-14 06:14:52 +02:00
|
|
|
rm -rf $@.tmp
|
2020-01-21 08:49:07 +01:00
|
|
|
mkdir $@.tmp
|
2020-02-17 21:10:44 +01:00
|
|
|
( cd $@.tmp && $(COWPATCH) -I ../$< )
|
2020-01-21 08:49:07 +01:00
|
|
|
test ! -d patches/$@ || cat patches/$@/* | ( cd $@.tmp && $(COWPATCH) -p1 )
|
2020-06-27 07:35:13 +02:00
|
|
|
if test -f $</configfsf.sub ; then cs=configfsf.sub ; elif test -f $</config.sub ; then cs=config.sub ; else exit 0 ; fi ; rm -f $@.tmp/$$cs && cp -f $(SOURCES)/config.sub $@.tmp/$$cs && chmod +x $@.tmp/$$cs
|
2020-01-23 19:18:17 +01:00
|
|
|
rm -rf $@
|
2020-01-21 08:49:07 +01:00
|
|
|
mv $@.tmp $@
|
2016-05-14 06:14:52 +02:00
|
|
|
|
2020-01-31 22:53:24 +01:00
|
|
|
|
|
|
|
# Add deps for all patched source dirs on their patchsets
|
|
|
|
$(foreach dir,$(notdir $(basename $(basename $(basename $(wildcard hashes/*))))),$(eval $(dir): $$(wildcard patches/$(dir) patches/$(dir)/*)))
|
2020-01-22 23:25:53 +01:00
|
|
|
|
2016-07-08 01:58:01 +02:00
|
|
|
extract_all: | $(SRC_DIRS)
|
|
|
|
|
2015-08-25 21:32:46 +02:00
|
|
|
|
2016-05-01 07:36:28 +02:00
|
|
|
# Rules for building.
|
2015-08-25 21:32:46 +02:00
|
|
|
|
2016-05-01 07:36:28 +02:00
|
|
|
ifeq ($(TARGET),)
|
2015-08-25 21:32:46 +02:00
|
|
|
|
2016-05-01 07:36:28 +02:00
|
|
|
all:
|
|
|
|
@echo TARGET must be set via config.mak or command line.
|
|
|
|
@exit 1
|
2015-08-25 21:32:46 +02:00
|
|
|
|
2016-05-01 07:36:28 +02:00
|
|
|
else
|
2015-08-25 21:32:46 +02:00
|
|
|
|
2016-05-01 07:36:28 +02:00
|
|
|
$(BUILD_DIR):
|
|
|
|
mkdir -p $@
|
2015-08-25 21:32:46 +02:00
|
|
|
|
2016-05-01 07:36:28 +02:00
|
|
|
$(BUILD_DIR)/Makefile: | $(BUILD_DIR)
|
2017-06-11 01:47:23 +02:00
|
|
|
ln -sf $(REL_TOP)/litecross/Makefile $@
|
2015-08-25 21:32:46 +02:00
|
|
|
|
2016-05-01 07:36:28 +02:00
|
|
|
$(BUILD_DIR)/config.mak: | $(BUILD_DIR)
|
2016-12-02 08:07:03 +01:00
|
|
|
printf >$@ '%s\n' \
|
2017-06-11 01:47:23 +02:00
|
|
|
"TARGET = $(TARGET)" \
|
|
|
|
"HOST = $(HOST)" \
|
|
|
|
"MUSL_SRCDIR = $(REL_TOP)/musl-$(MUSL_VER)" \
|
|
|
|
"GCC_SRCDIR = $(REL_TOP)/gcc-$(GCC_VER)" \
|
|
|
|
"BINUTILS_SRCDIR = $(REL_TOP)/binutils-$(BINUTILS_VER)" \
|
|
|
|
$(if $(GMP_VER),"GMP_SRCDIR = $(REL_TOP)/gmp-$(GMP_VER)") \
|
|
|
|
$(if $(MPC_VER),"MPC_SRCDIR = $(REL_TOP)/mpc-$(MPC_VER)") \
|
|
|
|
$(if $(MPFR_VER),"MPFR_SRCDIR = $(REL_TOP)/mpfr-$(MPFR_VER)") \
|
|
|
|
$(if $(ISL_VER),"ISL_SRCDIR = $(REL_TOP)/isl-$(ISL_VER)") \
|
|
|
|
$(if $(LINUX_VER),"LINUX_SRCDIR = $(REL_TOP)/linux-$(LINUX_VER)") \
|
|
|
|
"-include $(REL_TOP)/config.mak"
|
2015-08-25 21:32:46 +02:00
|
|
|
|
2016-05-01 07:36:28 +02:00
|
|
|
all: | $(SRC_DIRS) $(BUILD_DIR) $(BUILD_DIR)/Makefile $(BUILD_DIR)/config.mak
|
|
|
|
cd $(BUILD_DIR) && $(MAKE) $@
|
2015-08-25 21:32:46 +02:00
|
|
|
|
2016-05-01 07:36:28 +02:00
|
|
|
install: | $(SRC_DIRS) $(BUILD_DIR) $(BUILD_DIR)/Makefile $(BUILD_DIR)/config.mak
|
|
|
|
cd $(BUILD_DIR) && $(MAKE) OUTPUT=$(OUTPUT) $@
|
2015-08-25 21:32:46 +02:00
|
|
|
|
2016-05-01 07:36:28 +02:00
|
|
|
endif
|
2020-01-21 08:49:07 +01:00
|
|
|
|
|
|
|
.SECONDARY:
|