Rework on scripts

Also we are now using a cross compiler to create the toolchain because
I'm too lazy to do too much scripting lmao.
This commit is contained in:
cowmonk 2025-11-15 20:00:42 -07:00
parent a9a3077633
commit b041f9304f
8 changed files with 45 additions and 43 deletions

View file

@ -1,45 +1,43 @@
IS_MAKE=1
include config.mk
all: build
pull:
@if [ ! -d ./sources ]; then \
@if [ ! -d ${PROOT}/sources ]; then \
echo "Sources Directory Not Found!"; \
mkdir -p ./sources; \
mkdir -p ${PROOT}/sources; \
echo "Pulling Sources..."; \
xargs -a ${SOURCES_FILE} -n1 -P4 -- curl -f -L -S -O --output-dir ./sources || { echo "curl failed"; exit 1; }; \
xargs -a ${SOURCES_FILE} -n1 -P4 -- curl -f -L -S -O --output-dir ${PROOT}/sources || { echo "curl failed"; exit 1; }; \
echo "Pulling cross musl compiler to build toolchain"
curl -f -L -O https://musl.cc/${ARCH}-linux-musl-cross.tgz --output-dir ${PROOT}/sources
echo "done"; \
else \
./scripts/check.sh; \
. ${PROOT}/scripts/check.sh; \
fi
build: init
./scripts/musl-cross.sh
./scripts/elftoolchain-cross.sh
. ${PROOT}/scripts/musl-cross.sh
. ${PROOT}/scripts/elftoolchain-cross.sh
init:
@if [ ! -d ./build/${FROOT} ]; then \
@echo "Making toolchain directory..."; \
mkdir -p ./build/${FROOT}; \
@echo "Making cross directory"; \
mkdir -p ./build/cross; \
echo "Making toolchain directory..."; \
mkdir -p ${PROOT}/build/${FROOT}; \
fi
@echo "updating configuration based on config.mk..."
cp -r config.mk ./scripts/config.sh
sed -i 's/shell //g' ./scripts/config.sh
cp -r config.mk ${PROOT}/scripts/config.sh
sed -i 's/shell //g' ${PROOT}/scripts/config.sh
clean:
rm -rf ./sources
rm -rf ./build
rm -rf ${PROOT}/sources
rm -rf ${PROOT}/build
help:
@echo "musllvm"
@echo "-----------------------"
@echo "commands:"
@echo " all - make all (duh)"
@echo " pull - pull all sources (on first run), second run will check indivdually"
@echo " pull - pull all sources (on first run), second run will check individually"
@echo " build - build will build to toolchain"
@echo " clean - clean up all sources and build artifacts"
@echo " init - sets up everything, run also every time you make changes to config.mk"