1
0
Fork 0
mirror of https://github.com/tailix/mrubyvisor.git synced 2024-11-11 13:50:47 -05:00
mrubyvisor/Makefile

70 lines
1.9 KiB
Makefile
Raw Normal View History

2022-11-27 07:10:32 -05:00
CCPREFIX = /home/kotovalexarian/repos/global/tailix/cross/root/bin/i386-elf-
2022-11-27 06:21:26 -05:00
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 07:10:32 -05:00
QEMU = qemu-system-i386
2022-11-27 06:21:26 -05:00
2022-11-27 06:54:45 -05:00
ABS_REPO = $(shell pwd)
2022-11-27 06:21:26 -05:00
2022-11-28 15:20:42 -05:00
DEST = dest
IMAGE = image.iso
MRUBY_CONF = build_config.rb
ROOTFS = rootfs
SRC = src
2022-11-27 06:54:45 -05:00
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 07:10:32 -05:00
.PHONY: $(IMAGE) $(MRUBYVISOR)
2022-11-27 06:54:45 -05:00
all: runc
runc: $(IMAGE)
2022-11-27 07:10:32 -05:00
$(QEMU) -cdrom $< -serial stdio -display none
2022-11-27 06:54:45 -05:00
runw: $(IMAGE)
2022-11-27 07:10:32 -05:00
$(QEMU) -cdrom $< -serial stdio
2022-11-27 06:54:45 -05:00
2022-11-28 16:18:01 -05:00
clean: clean-src clean-dest clean-mruby clean-libkernaux
clean-src:
$(MAKE) -C $(SRC) clean
clean-dest:
2022-11-27 06:54:45 -05:00
rm -rf $(MRUBYVISOR) $(DEST)/*
2022-11-28 16:18:01 -05:00
clean-mruby:
2022-11-28 16:09:43 -05:00
cd vendor/mruby && $(RAKE) clean
2022-11-28 16:18:01 -05:00
clean-libkernaux:
$(MAKE) -C vendor/libkernaux distclean
2022-11-27 06:54:45 -05:00
$(IMAGE): $(GRUBCFG) $(MRUBYVISOR)
grub-mkrescue $(ROOTFS) -o $@
$(MRUBYVISOR): $(LIBKERNAUX) $(LIBMRUBY)
2022-11-27 07:10:32 -05:00
$(MAKE) -C $(SRC) mrubyvisor.multiboot2 CCPREFIX='$(CCPREFIX)' DEST='$(ABS_REPO)/$(DEST)'
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 07:35:43 -05:00
cd vendor/libkernaux && ./configure --host='i386-elf' --prefix='$(ABS_REPO)/$(DEST)' --enable-freestanding --enable-split-libc --with-drivers --with-libc AR='$(AR)' AS='$(AS)' CC='$(CC)' LD='$(LD)' RANLIB='$(RANLIB)'
2022-11-27 07:10:32 -05:00
cd vendor/libkernaux && $(MAKE)
cd vendor/libkernaux && $(MAKE) install
2022-11-27 06:21:26 -05:00
2022-11-28 15:20:42 -05:00
$(LIBMRUBY): $(LIBKERNAUX) $(MRUBY_CONF)
2022-11-28 16:21:10 -05:00
$(MAKE) clean-mruby
2022-11-28 15:20:42 -05:00
cd vendor/mruby && $(RAKE) MRUBY_CONFIG='$(ABS_REPO)/$(MRUBY_CONF)' 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