replace steps directory with stamp files in source/build dirs

this makes it easy to rebuild components simply by removing the source
or build directory with rm -rf; no separate action on the steps files
is needed.

some dependencies are also changed to order-only so that
update/rebuild of one component does not force unnecessary rebuild of
another.

new convenience pseudo-targets are also added.
This commit is contained in:
Rich Felker 2015-11-09 23:45:56 +00:00
parent 3fb6709806
commit 0b1f5d1197
2 changed files with 39 additions and 19 deletions

View File

@ -34,18 +34,38 @@ MUSL_CONFIG = CC="$(GCC0_CC)" --prefix=
-include config.mak
all: steps/install_binutils steps/install_musl steps/install_gcc
all: install_binutils install_musl install_gcc
clean:
rm -rf gcc-$(GCC_VER) binutils-$(BINUTILS_VER) musl
rm -rf steps/extract_* steps/clone_*
rm -rf steps/configure_* steps/build_* steps/install_*
distclean: clean
rm -rf sources/config.sub sources/*.tar.bz2
steps/configure_gcc0: steps/install_binutils
steps/configure_gcc: steps/install_musl
.PHONY: extract_binutils extract_gcc clone_musl
.PHONY: configure_binutils configure_gcc0 configure_gcc configure_musl
.PHONY: build_binutils build_gcc0 build_gcc build_musl
.PHONY: install_binutils install_gcc install_musl
extract_binutils: binutils-$(BINUTILS_VER)/.mcm_extracted
extract_gcc: gcc-$(GCC_VER)/.mcm_extracted
clone_musl: musl/.mcm_cloned
configure_binutils: binutils-$(BINUTILS_VER)/.mcm_configured
configure_gcc0: gcc-$(GCC_VER)/build0/.mcm_configured
configure_gcc: gcc-$(GCC_VER)/build/.mcm_configured
configure_musl: musl/.mcm_configured
build_binutils: binutils-$(BINUTILS_VER)/.mcm_built
build_gcc0: gcc-$(GCC_VER)/build0/.mcm_built
build_gcc: gcc-$(GCC_VER)/build/.mcm_built
build_musl: musl/.mcm_built
install_binutils: binutils-$(BINUTILS_VER)/.mcm_installed
install_gcc: gcc-$(GCC_VER)/build/.mcm_installed
install_musl: musl/.mcm_installed
sources/config.sub:
@ -61,52 +81,52 @@ sources/gcc-%:
steps/extract_binutils: sources/binutils-$(BINUTILS_VER).tar.bz2 sources/config.sub
binutils-$(BINUTILS_VER)/.mcm_extracted: sources/binutils-$(BINUTILS_VER).tar.bz2 sources/config.sub
tar jxvf $<
cat patches/binutils-$(BINUTILS_VER)/* | ( cd binutils-$(BINUTILS_VER) && patch -p1 )
cp sources/config.sub binutils-$(BINUTILS_VER)
touch $@
steps/configure_binutils: steps/extract_binutils
binutils-$(BINUTILS_VER)/.mcm_configured: binutils-$(BINUTILS_VER)/.mcm_extracted
test -e binutils-$(BINUTILS_VER)/config.status || ( cd binutils-$(BINUTILS_VER) && ./configure $(BINUTILS_CONFIG) )
touch $@
steps/build_binutils: steps/configure_binutils
binutils-$(BINUTILS_VER)/.mcm_built: binutils-$(BINUTILS_VER)/.mcm_configured
cd binutils-$(BINUTILS_VER) && $(MAKE)
touch $@
steps/install_binutils: steps/build_binutils
binutils-$(BINUTILS_VER)/.mcm_installed: binutils-$(BINUTILS_VER)/.mcm_built
cd binutils-$(BINUTILS_VER) && $(MAKE) install
touch $@
steps/extract_gcc: sources/gcc-$(GCC_VER).tar.bz2 sources/config.sub
gcc-$(GCC_VER)/.mcm_extracted: sources/gcc-$(GCC_VER).tar.bz2 sources/config.sub
tar jxvf $<
cat patches/gcc-$(GCC_VER)/* | ( cd gcc-$(GCC_VER) && patch -p1 )
cp sources/config.sub gcc-$(GCC_VER)
touch $@
steps/configure_gcc0: steps/extract_gcc
gcc-$(GCC_VER)/build0/.mcm_configured: gcc-$(GCC_VER)/.mcm_extracted | binutils-$(BINUTILS_VER)/.mcm_installed
mkdir -p gcc-$(GCC_VER)/build0
test -e gcc-$(GCC_VER)/build0/config.status || ( cd gcc-$(GCC_VER)/build0 && $(GCC0_VARS) ../configure $(GCC0_CONFIG) )
touch $@
steps/build_gcc0: steps/configure_gcc0
gcc-$(GCC_VER)/build0/.mcm_built: gcc-$(GCC_VER)/build0/.mcm_configured
cd gcc-$(GCC_VER)/build0 && $(MAKE)
touch $@
steps/configure_gcc: steps/extract_gcc
gcc-$(GCC_VER)/build/.mcm_configured: gcc-$(GCC_VER)/.mcm_extracted | binutils-$(BINUTILS_VER)/.mcm_installed musl/.mcm_installed
mkdir -p gcc-$(GCC_VER)/build
test -e gcc-$(GCC_VER)/build/config.status || ( cd gcc-$(GCC_VER)/build && ../configure $(GCC_CONFIG) )
touch $@
steps/build_gcc: steps/configure_gcc
gcc-$(GCC_VER)/build/.mcm_built: gcc-$(GCC_VER)/build/.mcm_configured
cd gcc-$(GCC_VER)/build && $(MAKE)
touch $@
steps/install_gcc: steps/build_gcc
gcc-$(GCC_VER)/build/.mcm_installed: gcc-$(GCC_VER)/build/.mcm_built
cd gcc-$(GCC_VER)/build && $(MAKE) install
touch $@
@ -114,20 +134,20 @@ steps/install_gcc: steps/build_gcc
steps/clone_musl:
musl/.mcm_cloned:
test -d musl || git clone -b $(MUSL_TAG) git://git.musl-libc.org/musl musl
touch $@
steps/configure_musl: steps/clone_musl steps/build_gcc0
musl/.mcm_configured: musl/.mcm_cloned gcc-$(GCC_VER)/build0/.mcm_built
cd musl && ./configure $(MUSL_CONFIG)
cat patches/musl-complex-hack >> musl/config.mak
touch $@
steps/build_musl: steps/configure_musl
musl/.mcm_built: musl/.mcm_configured
cd musl && $(MAKE)
touch $@
steps/install_musl: steps/build_musl
musl/.mcm_installed: musl/.mcm_built
cd musl && $(MAKE) install DESTDIR=$(OUTPUT)/$(TARGET)
ln -sfn . $(OUTPUT)/$(TARGET)/usr
touch $@

View File