mirror of
https://github.com/EnderIce2/Fennix.git
synced 2025-07-02 10:59:15 +00:00
chore: Fix build process
This commit is contained in:
130
tools/Makefile
130
tools/Makefile
@ -4,79 +4,133 @@ export PATH := $(CROSS_DIR):$(PATH)
|
||||
|
||||
QEMU_VERSION = 8.1.2
|
||||
|
||||
all: do_rep do_ep do_limine clone_all do_binutils_64 do_gcc_64 do_binutils_32 do_gcc_32 do_qemu
|
||||
all: do_tools do_limine __clone_all do_binutils_64 do_gcc_64 do_binutils_32 do_gcc_32 do_qemu
|
||||
|
||||
clean:
|
||||
rm -f rep ep fex
|
||||
rm -f rep ep
|
||||
|
||||
do_rep:
|
||||
do_tools:
|
||||
gcc -w ReadEthernetPackets.c -o rep
|
||||
chmod +x rep
|
||||
|
||||
do_ep:
|
||||
g++ -w ErrorParser.cpp -o ep
|
||||
chmod +x rep
|
||||
chmod +x ep
|
||||
|
||||
do_limine:
|
||||
git clone https://github.com/limine-bootloader/limine.git --branch=v6.x-branch-binary --depth=1
|
||||
ifeq ("$(wildcard ./limine)", "")
|
||||
git clone https://github.com/limine-bootloader/limine.git --branch=v6.x-branch-binary --depth=1 limine
|
||||
else
|
||||
$(info > TOOLS: Skipping cloning limine because directory already exists.)
|
||||
endif
|
||||
|
||||
__clone_qemu:
|
||||
ifeq ("$(wildcard ./qemu)", "")
|
||||
wget https://download.qemu.org/qemu-${QEMU_VERSION}.tar.xz
|
||||
tar xvJf qemu-${QEMU_VERSION}.tar.xz
|
||||
rm -f qemu-${QEMU_VERSION}.tar.xz
|
||||
mv qemu-${QEMU_VERSION} qemu
|
||||
else
|
||||
$(info > TOOLS: Skipping cloning qemu because directory already exists.)
|
||||
endif
|
||||
|
||||
__clone_all_no_qemu:
|
||||
git clone -b binutils-2_42-branch --single-branch https://github.com/Fennix-Project/binutils-gdb.git binutils-gdb
|
||||
git clone -b releases/gcc-13 --single-branch https://github.com/Fennix-Project/gcc.git gcc
|
||||
cd gcc && $(shell ./contrib/download_prerequisites)
|
||||
.PHONY: all clean __clone_binutils __clone_gcc __prep_cross __patch_cross __patch_cross_binutils __patch_cross_gcc
|
||||
|
||||
__clone_binutils:
|
||||
ifeq ("$(wildcard ./binutils-gdb)", "")
|
||||
git clone --depth 1 -b binutils-2_43_1 --single-branch git://sourceware.org/git/binutils-gdb.git binutils-gdb
|
||||
else
|
||||
$(info > TOOLS: Reseting binutils-gdb...)
|
||||
cd binutils-gdb && \
|
||||
git fetch origin && \
|
||||
git reset --hard binutils-2_43_1 && \
|
||||
git clean -dfx
|
||||
$(info > TOOLS: Operation completed for binutils-gdb)
|
||||
endif
|
||||
|
||||
__clone_gcc:
|
||||
ifeq ("$(wildcard ./gcc)", "")
|
||||
git clone --depth 1 -b releases/gcc-14.2.0 --single-branch git://gcc.gnu.org/git/gcc.git gcc
|
||||
else
|
||||
$(info > TOOLS: Reseting gcc...)
|
||||
cd gcc && \
|
||||
git fetch origin && \
|
||||
git reset --hard releases/gcc-14.2.0 && \
|
||||
git clean -dfx
|
||||
$(info > TOOLS: Operation completed for gcc)
|
||||
endif
|
||||
|
||||
__patch_cross_binutils: __clone_binutils
|
||||
$(info > TOOLS: Patching binutils-gcc)
|
||||
cd binutils-gdb && git apply ../binutils-gdb.patch
|
||||
$(info > TOOLS: Running automake for binutils-gdb/ld)
|
||||
cd binutils-gdb/ld && automake
|
||||
|
||||
__patch_cross_gcc: __clone_gcc
|
||||
$(info > TOOLS: Patching gcc)
|
||||
cd gcc && git apply ../gcc.patch
|
||||
cd gcc && ./contrib/download_prerequisites
|
||||
$(info > TOOLS: Running autoconf for gcc/libstdc++-v3)
|
||||
cd gcc/libstdc++-v3 && autoconf
|
||||
|
||||
__patch_cross: __patch_cross_binutils __patch_cross_gcc
|
||||
|
||||
__prep_cross:
|
||||
mkdir -p cross
|
||||
mkdir -p build-binutils64
|
||||
mkdir -p build-gcc64
|
||||
mkdir -p build-binutils32
|
||||
mkdir -p build-gcc32
|
||||
mkdir -p binutils-gdb/__build
|
||||
mkdir -p gcc/__build
|
||||
|
||||
clone_all: __clone_qemu __clone_all_no_qemu
|
||||
__clone_all_no_qemu: __clone_binutils __clone_gcc
|
||||
|
||||
do_qemu:
|
||||
__clone_all: __clone_qemu __clone_all_no_qemu
|
||||
|
||||
do_qemu: __prep_cross
|
||||
cd qemu && \
|
||||
bash ./configure --target-list=x86_64-softmmu,i386-softmmu,aarch64-softmmu \
|
||||
--prefix="$(CROSS_DIR)" \
|
||||
--enable-gtk --disable-tools \
|
||||
--disable-gio --disable-virtfs --disable-vnc \
|
||||
--disable-opengl && \
|
||||
make -j$(shell nproc) && make install
|
||||
make --quiet -j$(shell nproc) && make --quiet install
|
||||
|
||||
do_binutils_64:
|
||||
cd build-binutils64 && \
|
||||
../binutils-gdb/configure --target=x86_64-fennix \
|
||||
--prefix="$(CROSS_DIR)" --disable-nls \
|
||||
$(MAKE) __patch_cross_binutils
|
||||
$(MAKE) __prep_cross
|
||||
cd binutils-gdb/__build && \
|
||||
../configure --target=x86_64-fennix \
|
||||
--prefix="$(CROSS_DIR)" --disable-nls --quiet \
|
||||
--with-sysroot --enable-shared --disable-werror && \
|
||||
make all -j$(shell nproc) && make install
|
||||
make --quiet all -j$(shell nproc) && \
|
||||
make --quiet install
|
||||
|
||||
do_gcc_64:
|
||||
cd build-gcc64 && \
|
||||
../gcc/configure --target=x86_64-fennix \
|
||||
$(MAKE) __patch_cross_gcc
|
||||
$(MAKE) __prep_cross
|
||||
cd gcc/__build && \
|
||||
../configure --target=x86_64-fennix --quiet \
|
||||
--prefix="$(CROSS_DIR)" --disable-nls --enable-default-pie \
|
||||
--enable-languages=c,c++ --enable-shared --without-headers && \
|
||||
make all-gcc -j$(shell nproc) && \
|
||||
make all-target-libgcc -j$(shell nproc) && \
|
||||
make install-gcc -j$(shell nproc) && \
|
||||
make install-target-libgcc -j$(shell nproc)
|
||||
make --quiet all-gcc -j$(shell nproc) && \
|
||||
make --quiet all-target-libgcc -j$(shell nproc) && \
|
||||
make --quiet install-gcc -j$(shell nproc) && \
|
||||
make --quiet install-target-libgcc -j$(shell nproc)
|
||||
|
||||
do_binutils_32:
|
||||
cd build-binutils32 && \
|
||||
../binutils-gdb/configure --target=i386-fennix \
|
||||
--prefix="$(CROSS_DIR)" --disable-nls \
|
||||
$(MAKE) __patch_cross_binutils
|
||||
$(MAKE) __prep_cross
|
||||
cd binutils-gdb/__build && \
|
||||
../configure --target=i386-fennix \
|
||||
--prefix="$(CROSS_DIR)" --disable-nls --quiet \
|
||||
--with-sysroot --enable-shared --disable-werror && \
|
||||
make all -j$(shell nproc) && make install
|
||||
make --quiet all -j$(shell nproc) && \
|
||||
make --quiet install
|
||||
|
||||
do_gcc_32:
|
||||
cd build-gcc32 && \
|
||||
../gcc/configure --target=i386-fennix \
|
||||
$(MAKE) __patch_cross_gcc
|
||||
$(MAKE) __prep_cross
|
||||
cd gcc/__build && \
|
||||
../configure --target=i386-fennix --quiet \
|
||||
--prefix="$(CROSS_DIR)" --disable-nls --enable-default-pie \
|
||||
--enable-languages=c,c++ --enable-shared --without-headers && \
|
||||
make all-gcc -j$(shell nproc) && \
|
||||
make all-target-libgcc -j$(shell nproc) && \
|
||||
make install-gcc -j$(shell nproc) && \
|
||||
make install-target-libgcc -j$(shell nproc)
|
||||
make --quiet all-gcc -j$(shell nproc) && \
|
||||
make --quiet all-target-libgcc -j$(shell nproc) && \
|
||||
make --quiet install-gcc -j$(shell nproc) && \
|
||||
make --quiet install-target-libgcc -j$(shell nproc)
|
||||
|
Reference in New Issue
Block a user