Makefile (1400B)
1 include config.mk 2 3 all: build 4 5 pull: 6 @if [ ! -d ${PROOT}/sources ]; then \ 7 echo "Sources Directory Not Found!"; \ 8 mkdir -p ${PROOT}/sources; \ 9 echo "Pulling Sources..."; \ 10 xargs -a ${SOURCES_FILE} -n1 -P4 -- curl -f -L -S -O --output-dir ${PROOT}/sources || { echo "curl failed"; exit 1; }; \ 11 echo "Pulling cross musl compiler to build toolchain" 12 curl -f -L -O https://musl.cc/${ARCH}-linux-musl-cross.tgz --output-dir ${PROOT}/sources 13 echo "done"; \ 14 else \ 15 . ${PROOT}/scripts/check.sh; \ 16 fi 17 18 build: init 19 . ${PROOT}/scripts/musl-cross.sh 20 . ${PROOT}/scripts/elftoolchain-cross.sh 21 22 init: 23 @if [ ! -d ./build/${FROOT} ]; then \ 24 echo "Making toolchain directory..."; \ 25 mkdir -p ${PROOT}/build/${FROOT}; \ 26 fi 27 @echo "updating configuration based on config.mk..." 28 cp -r config.mk ${PROOT}/scripts/config.sh 29 sed -i 's/shell //g' ${PROOT}/scripts/config.sh 30 31 clean: 32 rm -rf ${PROOT}/sources 33 rm -rf ${PROOT}/build 34 35 help: 36 @echo "musllvm" 37 @echo "-----------------------" 38 @echo "commands:" 39 @echo " all - make all (duh)" 40 @echo " pull - pull all sources (on first run), second run will check individually" 41 @echo " build - build will build to toolchain" 42 @echo " clean - clean up all sources and build artifacts" 43 @echo " init - sets up everything, run also every time you make changes to config.mk" 44 @echo " help - shows this menu" 45 46 .PHONY: all pull build clean init help