2022-11-27 06:54:45 -05:00
|
|
|
.PHONY: $(MRUBYVISOR)
|
2022-11-27 06:21:26 -05:00
|
|
|
|
|
|
|
CCPREFIX = /home/kotovalexarian/repos/global/tailix/cross/root/bin/x86_64-elf-
|
|
|
|
|
|
|
|
AR = $(CCPREFIX)ar
|
|
|
|
AS = $(CCPREFIX)as
|
|
|
|
CC = $(CCPREFIX)gcc
|
|
|
|
LD = $(CCPREFIX)ld
|
2022-11-27 06:54:45 -05:00
|
|
|
RAKE = rake
|
2022-11-27 06:21:26 -05:00
|
|
|
RANLIB = $(CCPREFIX)ranlib
|
|
|
|
|
2022-11-27 06:54:45 -05:00
|
|
|
ABS_REPO = $(shell pwd)
|
2022-11-27 06:21:26 -05:00
|
|
|
|
2022-11-27 06:54:45 -05:00
|
|
|
IMAGE = image.iso
|
|
|
|
ROOTFS = rootfs
|
|
|
|
DEST = dest
|
|
|
|
|
|
|
|
GRUBCFG = $(ROOTFS)/boot/grub/grub.cfg
|
|
|
|
LIBKERNAUX = $(DEST)/lib/libkernaux.a
|
|
|
|
LIBMRUBY = $(DEST)/lib/libmruby.a
|
|
|
|
MRUBYVISOR = $(ROOTFS)/boot/mrubyvisor.multiboot2
|
2022-11-27 06:21:26 -05:00
|
|
|
|
|
|
|
MRUBY_NAME = mrubyvisor
|
|
|
|
|
2022-11-27 06:54:45 -05:00
|
|
|
all: runc
|
|
|
|
|
|
|
|
runc: $(IMAGE)
|
|
|
|
qemu-system-x86_64 -cdrom $< -serial stdio -display none
|
|
|
|
|
|
|
|
runw: $(IMAGE)
|
|
|
|
qemu-system-x86_64 -cdrom $< -serial stdio
|
|
|
|
|
2022-11-27 06:21:26 -05:00
|
|
|
clean:
|
2022-11-27 06:54:45 -05:00
|
|
|
rm -rf $(MRUBYVISOR) $(DEST)/*
|
|
|
|
|
|
|
|
$(IMAGE): $(GRUBCFG) $(MRUBYVISOR)
|
|
|
|
grub-mkrescue $(ROOTFS) -o $@
|
|
|
|
|
|
|
|
$(MRUBYVISOR): $(LIBKERNAUX) $(LIBMRUBY)
|
|
|
|
make -C src mrubyvisor.multiboot2
|
|
|
|
cp src/mrubyvisor.multiboot2 $@
|
2022-11-27 06:21:26 -05:00
|
|
|
|
2022-11-27 06:54:45 -05:00
|
|
|
$(LIBKERNAUX):
|
2022-11-27 06:21:26 -05:00
|
|
|
cd vendor/libkernaux && ./autogen.sh
|
2022-11-27 06:54:45 -05:00
|
|
|
cd vendor/libkernaux && ./configure --host='x86_64-elf' --prefix='$(ABS_REPO)/$(DEST)' --enable-freestanding --with-drivers --with-libc AR='$(AR)' AS='$(AS)' CC='$(CC)' LD='$(LD)' RANLIB='$(RANLIB)'
|
2022-11-27 06:21:26 -05:00
|
|
|
cd vendor/libkernaux && make
|
|
|
|
cd vendor/libkernaux && make install
|
|
|
|
|
2022-11-27 06:54:45 -05:00
|
|
|
$(LIBMRUBY): $(LIBKERNAUX)
|
|
|
|
cd vendor/mruby && $(RAKE) MRUBY_CONFIG='$(ABS_REPO)/build_config.rb' CROSS_AR='$(AR)' CROSS_CC='$(CC)' CROSS_LD='$(LD)'
|
2022-11-27 06:21:26 -05:00
|
|
|
mkdir -p $(DEST)/include $(DEST)/lib
|
|
|
|
cp vendor/mruby/build/$(MRUBY_NAME)/lib/libmruby.a $(DEST)/lib
|
|
|
|
cp -r vendor/mruby/include/* $(DEST)/include
|
|
|
|
cp -r vendor/mruby/build/$(MRUBY_NAME)/include/* $(DEST)/include
|