2018-03-21 10:48:33 +03:00
|
|
|
ifeq ($(TOOLCHAIN),)
|
2018-03-21 11:17:48 +03:00
|
|
|
ifeq ($(shell util/check.sh),y)
|
|
|
|
export PATH := $(shell util/activate.sh)
|
|
|
|
else
|
|
|
|
FOO := $(shell util/prompt.sh)
|
|
|
|
ifeq ($(shell util/check.sh),y)
|
|
|
|
export PATH := $(shell util/activate.sh)
|
|
|
|
else
|
|
|
|
$(error "No toolchain, and you did not ask to build it.")
|
|
|
|
endif
|
|
|
|
endif
|
2018-03-21 10:48:33 +03:00
|
|
|
endif
|
|
|
|
|
2018-04-17 16:18:15 +03:00
|
|
|
# Prevents Make from removing intermediary files on failure
|
|
|
|
.SECONDARY:
|
|
|
|
|
|
|
|
# Disable built-in rules
|
|
|
|
.SUFFIXES:
|
|
|
|
|
2018-04-24 13:39:47 +03:00
|
|
|
TARGET_TRIPLET=i686-pc-toaru
|
|
|
|
|
|
|
|
# Userspace flags
|
|
|
|
|
|
|
|
CC=$(TARGET_TRIPLET)-gcc
|
|
|
|
AR=$(TARGET_TRIPLET)-ar
|
2018-06-25 07:15:09 +03:00
|
|
|
AS=$(TARGET_TRIPLET)-as
|
2018-06-10 13:06:48 +03:00
|
|
|
CFLAGS= -O3 -g -std=gnu99 -I. -Iapps -pipe -mmmx -msse -msse2 -fplan9-extensions -Wall -Wextra -Wno-unused-parameter
|
2018-02-25 08:13:54 +03:00
|
|
|
|
2018-05-02 05:59:30 +03:00
|
|
|
LIBC_OBJS = $(patsubst %.c,%.o,$(wildcard libc/*.c))
|
|
|
|
LIBC_OBJS += $(patsubst %.c,%.o,$(wildcard libc/*/*.c))
|
2018-06-25 07:15:09 +03:00
|
|
|
LIBC_OBJS += libc/setjmp.o
|
2018-03-19 07:36:02 +03:00
|
|
|
LC=base/lib/libc.so
|
2018-02-25 08:13:54 +03:00
|
|
|
|
2018-04-17 16:18:15 +03:00
|
|
|
APPS=$(patsubst apps/%.c,%,$(wildcard apps/*.c))
|
2018-02-25 08:13:54 +03:00
|
|
|
APPS_X=$(foreach app,$(APPS),base/bin/$(app))
|
2018-04-17 15:49:56 +03:00
|
|
|
APPS_Y=$(foreach app,$(filter-out init,$(APPS)),.make/$(app).mak)
|
2018-08-08 04:14:59 +03:00
|
|
|
APPS_SH=$(patsubst apps/%.sh,%.sh,$(wildcard apps/*.sh))
|
|
|
|
APPS_SH_X=$(foreach app,$(APPS_SH),base/bin/$(app))
|
2018-02-25 08:13:54 +03:00
|
|
|
|
2018-04-17 16:18:15 +03:00
|
|
|
LIBS=$(patsubst lib/%.c,%,$(wildcard lib/*.c))
|
|
|
|
LIBS_X=$(foreach lib,$(LIBS),base/lib/libtoaru_$(lib).so)
|
|
|
|
LIBS_Y=$(foreach lib,$(LIBS),.make/$(lib).lmak)
|
|
|
|
|
2018-08-08 04:14:59 +03:00
|
|
|
RAMDISK_FILES= ${APPS_X} ${APPS_SH_X} ${LIBS_X} base/lib/ld.so base/lib/libm.so
|
2018-08-01 11:20:34 +03:00
|
|
|
|
2018-02-25 08:13:54 +03:00
|
|
|
all: image.iso
|
|
|
|
|
2018-04-24 13:39:47 +03:00
|
|
|
# Kernel / module flags
|
|
|
|
|
|
|
|
KCC = $(TARGET_TRIPLET)-gcc
|
|
|
|
KAS = $(TARGET_TRIPLET)-as
|
|
|
|
KLD = $(TARGET_TRIPLET)-ld
|
|
|
|
KNM = $(TARGET_TRIPLET)-nm
|
2018-03-16 15:56:19 +03:00
|
|
|
|
|
|
|
KCFLAGS = -O2 -std=c99
|
|
|
|
KCFLAGS += -finline-functions -ffreestanding
|
|
|
|
KCFLAGS += -Wall -Wextra -Wno-unused-function -Wno-unused-parameter -Wno-format
|
|
|
|
KCFLAGS += -pedantic -fno-omit-frame-pointer
|
|
|
|
KCFLAGS += -D_KERNEL_
|
|
|
|
KCFLAGS += -DKERNEL_GIT_TAG=$(shell util/make-version)
|
|
|
|
KASFLAGS = --32
|
|
|
|
|
|
|
|
KERNEL_OBJS = $(patsubst %.c,%.o,$(wildcard kernel/*.c))
|
|
|
|
KERNEL_OBJS += $(patsubst %.c,%.o,$(wildcard kernel/*/*.c))
|
|
|
|
KERNEL_OBJS += $(patsubst %.c,%.o,$(wildcard kernel/*/*/*.c))
|
|
|
|
|
|
|
|
KERNEL_ASMOBJS = $(filter-out kernel/symbols.o,$(patsubst %.S,%.o,$(wildcard kernel/*.S)))
|
|
|
|
|
2018-04-24 13:39:47 +03:00
|
|
|
# Kernel
|
|
|
|
|
2018-07-11 03:43:31 +03:00
|
|
|
fatbase/kernel: ${KERNEL_ASMOBJS} ${KERNEL_OBJS} kernel/symbols.o
|
2018-03-16 15:56:19 +03:00
|
|
|
${KCC} -T kernel/link.ld ${KCFLAGS} -nostdlib -o $@ ${KERNEL_ASMOBJS} ${KERNEL_OBJS} kernel/symbols.o -lgcc
|
|
|
|
|
|
|
|
kernel/symbols.o: ${KERNEL_ASMOBJS} ${KERNEL_OBJS} util/generate_symbols.py
|
|
|
|
-rm -f kernel/symbols.o
|
|
|
|
${KCC} -T kernel/link.ld ${KCFLAGS} -nostdlib -o .toaruos-kernel ${KERNEL_ASMOBJS} ${KERNEL_OBJS} -lgcc
|
|
|
|
${KNM} .toaruos-kernel -g | util/generate_symbols.py > kernel/symbols.S
|
|
|
|
${KAS} ${KASFLAGS} kernel/symbols.S -o $@
|
|
|
|
-rm -f .toaruos-kernel
|
|
|
|
|
|
|
|
kernel/sys/version.o: kernel/*/*.c kernel/*.c
|
|
|
|
|
2018-04-24 13:39:47 +03:00
|
|
|
kernel/%.o: kernel/%.S
|
|
|
|
${KAS} ${ASFLAGS} $< -o $@
|
|
|
|
|
|
|
|
kernel/%.o: kernel/%.c ${HEADERS}
|
|
|
|
${KCC} ${KCFLAGS} -nostdlib -g -c -o $@ $<
|
|
|
|
|
|
|
|
# Modules
|
|
|
|
|
2018-07-11 03:43:31 +03:00
|
|
|
fatbase/mod:
|
2018-03-16 15:56:19 +03:00
|
|
|
@mkdir -p $@
|
|
|
|
|
2018-07-11 03:43:31 +03:00
|
|
|
MODULES = $(patsubst modules/%.c,fatbase/mod/%.ko,$(wildcard modules/*.c))
|
2018-03-16 15:56:19 +03:00
|
|
|
|
2018-03-19 05:38:11 +03:00
|
|
|
HEADERS = $(shell find base/usr/include/kernel -type f -name '*.h')
|
2018-03-16 15:56:19 +03:00
|
|
|
|
2018-07-11 03:43:31 +03:00
|
|
|
fatbase/mod/%.ko: modules/%.c ${HEADERS} | fatbase/mod
|
2018-03-19 05:38:11 +03:00
|
|
|
${KCC} -T modules/link.ld -nostdlib ${KCFLAGS} -c -o $@ $<
|
2018-03-16 15:56:19 +03:00
|
|
|
|
|
|
|
modules: ${MODULES}
|
|
|
|
|
|
|
|
# Root Filesystem
|
|
|
|
|
2018-02-25 08:13:54 +03:00
|
|
|
base/dev:
|
2018-07-11 03:43:31 +03:00
|
|
|
mkdir -p $@
|
2018-02-25 08:13:54 +03:00
|
|
|
base/tmp:
|
2018-07-14 12:33:57 +03:00
|
|
|
mkdir -p $@
|
2018-02-25 08:13:54 +03:00
|
|
|
base/proc:
|
2018-07-11 03:43:31 +03:00
|
|
|
mkdir -p $@
|
2018-02-25 08:13:54 +03:00
|
|
|
base/bin:
|
2018-07-11 03:43:31 +03:00
|
|
|
mkdir -p $@
|
2018-02-25 08:13:54 +03:00
|
|
|
base/lib:
|
2018-07-11 03:43:31 +03:00
|
|
|
mkdir -p $@
|
2018-08-12 11:14:15 +03:00
|
|
|
base/cdrom:
|
|
|
|
mkdir -p $@
|
2018-07-11 03:43:31 +03:00
|
|
|
fatbase/efi/boot:
|
|
|
|
mkdir -p $@
|
2018-04-17 15:49:56 +03:00
|
|
|
.make:
|
|
|
|
mkdir -p .make
|
2018-08-12 11:14:15 +03:00
|
|
|
dirs: base/dev base/tmp base/proc base/bin base/lib base/cdrom fatbase/efi/boot .make
|
2018-02-25 08:13:54 +03:00
|
|
|
|
2018-03-16 15:56:19 +03:00
|
|
|
# C Library
|
|
|
|
|
2018-03-16 16:40:23 +03:00
|
|
|
crts: base/lib/crt0.o base/lib/crti.o base/lib/crtn.o | dirs
|
|
|
|
|
|
|
|
base/lib/crt%.o: libc/crt%.s
|
|
|
|
yasm -f elf -o $@ $<
|
|
|
|
|
2018-06-25 07:15:09 +03:00
|
|
|
libc/setjmp.o: libc/setjmp.S
|
|
|
|
$(AS) -o $@ $<
|
|
|
|
|
2018-02-25 08:13:54 +03:00
|
|
|
libc/%.o: libc/%.c
|
2018-04-25 15:39:55 +03:00
|
|
|
$(CC) $(CFLAGS) -fPIC -c -o $@ $<
|
2018-02-25 08:13:54 +03:00
|
|
|
|
2018-03-16 16:40:23 +03:00
|
|
|
base/lib/libc.a: ${LIBC_OBJS} | dirs crts
|
2018-02-25 08:13:54 +03:00
|
|
|
$(AR) cr $@ $^
|
|
|
|
|
2018-03-16 16:40:23 +03:00
|
|
|
base/lib/libc.so: ${LIBC_OBJS} | dirs crts
|
|
|
|
$(CC) -nodefaultlibs -o $@ $(CFLAGS) -shared -fPIC $^ -lgcc
|
2018-02-25 08:13:54 +03:00
|
|
|
|
2018-06-26 14:53:48 +03:00
|
|
|
base/lib/libm.so: util/lm.c | dirs crts
|
|
|
|
$(CC) -nodefaultlibs -o $@ $(CFLAGS) -shared -fPIC $^ -lgcc
|
|
|
|
|
2018-03-16 15:56:19 +03:00
|
|
|
# Userspace Linker/Loader
|
|
|
|
|
2018-03-16 16:40:23 +03:00
|
|
|
base/lib/ld.so: linker/linker.c base/lib/libc.a | dirs
|
2018-04-17 16:18:15 +03:00
|
|
|
$(CC) -static -Wl,-static $(CFLAGS) -o $@ -Os -T linker/link.ld $<
|
2018-03-16 15:56:19 +03:00
|
|
|
|
|
|
|
# Shared Libraries
|
2018-04-17 16:18:15 +03:00
|
|
|
.make/%.lmak: lib/%.c util/auto-dep.py | dirs
|
|
|
|
util/auto-dep.py --makelib $< > $@
|
2018-03-16 15:56:19 +03:00
|
|
|
|
2018-04-18 15:39:27 +03:00
|
|
|
ifeq (,$(findstring clean,$(MAKECMDGOALS)))
|
2018-04-17 16:18:15 +03:00
|
|
|
-include ${LIBS_Y}
|
2018-04-18 15:39:27 +03:00
|
|
|
endif
|
2018-02-25 08:13:54 +03:00
|
|
|
|
2018-04-24 13:39:47 +03:00
|
|
|
# Init (static)
|
2018-03-16 15:56:19 +03:00
|
|
|
|
2018-03-16 16:40:23 +03:00
|
|
|
base/bin/init: apps/init.c base/lib/libc.a | dirs
|
2018-04-17 16:18:15 +03:00
|
|
|
$(CC) -static -Wl,-static $(CFLAGS) -o $@ $<
|
2018-02-25 08:13:54 +03:00
|
|
|
|
2018-07-11 03:43:31 +03:00
|
|
|
fatbase/netinit: util/netinit.c base/lib/libc.a | dirs
|
2018-09-04 04:17:59 +03:00
|
|
|
$(CC) -static -Wl,-static $(CFLAGS) -o $@ $<
|
2018-06-29 07:55:03 +03:00
|
|
|
|
2018-04-24 13:39:47 +03:00
|
|
|
# Userspace applications
|
2018-03-16 15:56:19 +03:00
|
|
|
|
2018-04-17 15:49:56 +03:00
|
|
|
.make/%.mak: apps/%.c util/auto-dep.py | dirs
|
|
|
|
util/auto-dep.py --make $< > $@
|
2018-02-25 08:13:54 +03:00
|
|
|
|
2018-04-18 15:39:27 +03:00
|
|
|
ifeq (,$(findstring clean,$(MAKECMDGOALS)))
|
2018-04-17 15:49:56 +03:00
|
|
|
-include ${APPS_Y}
|
2018-04-18 15:39:27 +03:00
|
|
|
endif
|
2018-02-25 08:13:54 +03:00
|
|
|
|
2018-08-08 04:14:59 +03:00
|
|
|
base/bin/%.sh: apps/%.sh
|
|
|
|
cp $< $@
|
|
|
|
chmod +x $@
|
|
|
|
|
2018-03-16 15:56:19 +03:00
|
|
|
# Ramdisk
|
|
|
|
|
2018-08-01 11:20:34 +03:00
|
|
|
util/devtable: ${RAMDISK_FILES} $(shell find base) util/update-devtable.py
|
2018-07-18 07:03:13 +03:00
|
|
|
util/update-devtable.py
|
|
|
|
|
2018-08-01 11:20:34 +03:00
|
|
|
fatbase/ramdisk.img: ${RAMDISK_FILES} $(shell find base) Makefile util/devtable | dirs
|
2018-07-11 03:43:31 +03:00
|
|
|
genext2fs -B 4096 -d base -D util/devtable -U -b `util/calc-size.sh` -N 2048 $@
|
2018-03-15 04:19:18 +03:00
|
|
|
|
2018-03-16 15:56:19 +03:00
|
|
|
# CD image
|
|
|
|
|
2018-07-06 06:30:28 +03:00
|
|
|
ifeq (,$(wildcard /usr/lib32/crt0-efi-ia32.o))
|
2018-07-11 06:45:31 +03:00
|
|
|
$(error Missing GNU-EFI.)
|
2018-07-06 06:30:28 +03:00
|
|
|
endif
|
|
|
|
|
2018-07-11 03:43:31 +03:00
|
|
|
EFI_XORRISO=-eltorito-alt-boot -e fat.img -no-emul-boot -isohybrid-gpt-basdat
|
|
|
|
EFI_BOOT=cdrom/fat.img
|
2018-07-18 06:44:05 +03:00
|
|
|
EFI_UPDATE=util/update-extents.py
|
2018-07-06 06:30:28 +03:00
|
|
|
|
2018-07-11 04:55:49 +03:00
|
|
|
image.iso: ${EFI_BOOT} cdrom/boot.sys fatbase/netinit ${MODULES} util/update-extents.py
|
2018-07-11 03:43:31 +03:00
|
|
|
xorriso -as mkisofs -R -J -c bootcat \
|
|
|
|
-b boot.sys -no-emul-boot -boot-load-size 24 \
|
2018-07-06 06:30:28 +03:00
|
|
|
${EFI_XORRISO} \
|
2018-07-06 03:17:20 +03:00
|
|
|
-o image.iso cdrom
|
2018-07-11 03:43:31 +03:00
|
|
|
${EFI_UPDATE}
|
2018-03-15 04:19:18 +03:00
|
|
|
|
2018-03-16 15:56:19 +03:00
|
|
|
# Boot loader
|
|
|
|
|
2018-07-11 07:23:04 +03:00
|
|
|
cdrom/fat.img: fatbase/ramdisk.img ${MODULES} fatbase/kernel fatbase/netinit fatbase/efi/boot/bootia32.efi fatbase/efi/boot/bootx64.efi util/mkdisk.sh
|
2018-07-11 03:43:31 +03:00
|
|
|
util/mkdisk.sh $@ fatbase
|
2018-07-06 10:35:01 +03:00
|
|
|
|
2018-07-11 07:23:04 +03:00
|
|
|
EFI_CFLAGS=-fno-stack-protector -fpic -DEFI_PLATFORM -ffreestanding -fshort-wchar -I /usr/include/efi -mno-red-zone
|
2018-07-06 10:35:01 +03:00
|
|
|
EFI_SECTIONS=-j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel -j .rela -j .reloc
|
|
|
|
|
2018-07-06 17:53:14 +03:00
|
|
|
boot/efi.so: boot/cstuff.c boot/*.h
|
2018-07-11 07:23:04 +03:00
|
|
|
$(CC) ${EFI_CFLAGS} -I /usr/include/efi/ia32 -c -o boot/efi.o $<
|
2018-07-06 10:35:01 +03:00
|
|
|
$(LD) boot/efi.o /usr/lib32/crt0-efi-ia32.o -nostdlib -znocombreloc -T /usr/lib32/elf_ia32_efi.lds -shared -Bsymbolic -L /usr/lib32 -lefi -lgnuefi -o boot/efi.so
|
|
|
|
|
2018-07-11 03:43:31 +03:00
|
|
|
fatbase/efi/boot/bootia32.efi: boot/efi.so
|
2018-07-11 07:23:04 +03:00
|
|
|
objcopy ${EFI_SECTIONS} --target=efi-app-ia32 $< $@
|
|
|
|
|
|
|
|
boot/efi64.so: boot/cstuff.c boot/*.h
|
|
|
|
gcc ${EFI_CFLAGS} -I /usr/include/efi/x86_64 -DEFI_FUNCTION_WRAPPER -c -o boot/efi64.o $<
|
|
|
|
$(LD) boot/efi64.o /usr/lib/crt0-efi-x86_64.o -nostdlib -znocombreloc -T /usr/lib/elf_x86_64_efi.lds -shared -Bsymbolic -L /usr/lib -lefi -lgnuefi -o boot/efi64.so
|
|
|
|
|
|
|
|
fatbase/efi/boot/bootx64.efi: boot/efi64.so
|
|
|
|
objcopy ${EFI_SECTIONS} --target=efi-app-x86_64 $< $@
|
2018-07-06 03:17:20 +03:00
|
|
|
|
2018-07-11 03:43:31 +03:00
|
|
|
cdrom/boot.sys: boot/boot.o boot/cstuff.o boot/link.ld | dirs
|
2018-03-15 04:19:18 +03:00
|
|
|
${KLD} -T boot/link.ld -o $@ boot/boot.o boot/cstuff.o
|
|
|
|
|
2018-06-09 13:19:21 +03:00
|
|
|
boot/cstuff.o: boot/cstuff.c boot/*.h
|
2018-03-15 04:19:18 +03:00
|
|
|
${KCC} -c -Os -o $@ $<
|
2018-02-25 08:13:54 +03:00
|
|
|
|
2018-03-15 04:19:18 +03:00
|
|
|
boot/boot.o: boot/boot.s
|
|
|
|
yasm -f elf -o $@ $<
|
2018-02-25 08:13:54 +03:00
|
|
|
|
2018-02-25 11:43:31 +03:00
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
|
|
|
rm -f base/lib/*.so
|
2018-03-16 16:40:23 +03:00
|
|
|
rm -f base/lib/libc.a
|
2018-08-08 04:14:59 +03:00
|
|
|
rm -f ${APPS_X} ${APPS_SH_X}
|
2018-05-02 09:02:05 +03:00
|
|
|
rm -f libc/*.o libc/*/*.o
|
2018-02-25 11:43:31 +03:00
|
|
|
rm -f image.iso
|
2018-07-11 03:43:31 +03:00
|
|
|
rm -f fatbase/ramdisk.img
|
|
|
|
rm -f cdrom/boot.sys
|
2018-03-15 04:33:02 +03:00
|
|
|
rm -f boot/*.o
|
2018-07-06 10:37:22 +03:00
|
|
|
rm -f boot/*.efi
|
|
|
|
rm -f boot/*.so
|
2018-07-11 07:23:04 +03:00
|
|
|
rm -f cdrom/fat.img cdrom/kernel cdrom/mod/* cdrom/ramdisk.img
|
|
|
|
rm -f fatbase/kernel fatbase/efi/boot/bootia32.efi fatbase/efi/boot/bootx64.efi
|
2018-07-11 03:43:31 +03:00
|
|
|
rm -f cdrom/netinit fatbase/netinit
|
2018-03-19 09:33:07 +03:00
|
|
|
rm -f ${KERNEL_OBJS} ${KERNEL_ASMOBJS} kernel/symbols.o kernel/symbols.S
|
2018-03-19 05:47:16 +03:00
|
|
|
rm -f base/lib/crt*.o
|
2018-03-16 15:56:19 +03:00
|
|
|
rm -f ${MODULES}
|
2018-04-17 16:18:15 +03:00
|
|
|
rm -f ${APPS_Y} ${LIBS_Y}
|
2018-03-16 15:56:19 +03:00
|
|
|
|
2018-08-15 13:45:25 +03:00
|
|
|
ifneq (,$(findstring Microsoft,$(shell uname -r)))
|
2018-08-15 13:53:05 +03:00
|
|
|
QEMU_ARGS=-serial mon:stdio -m 1G -rtc base=localtime -vnc :0
|
2018-08-15 13:45:25 +03:00
|
|
|
else
|
2018-08-16 08:26:40 +03:00
|
|
|
ifeq (,${NO_KVM})
|
|
|
|
KVM=-enable-kvm
|
|
|
|
else
|
|
|
|
KVM=
|
|
|
|
endif
|
|
|
|
QEMU_ARGS=-serial mon:stdio -m 1G -soundhw ac97,pcspk ${KVM} -rtc base=localtime
|
2018-08-15 13:45:25 +03:00
|
|
|
endif
|
|
|
|
|
2018-07-06 04:40:49 +03:00
|
|
|
|
2018-04-26 11:04:19 +03:00
|
|
|
.PHONY: run
|
|
|
|
run: image.iso
|
2018-07-06 04:40:49 +03:00
|
|
|
qemu-system-i386 -cdrom $< ${QEMU_ARGS}
|
|
|
|
|
2018-07-06 08:15:17 +03:00
|
|
|
.PHONY: fast
|
|
|
|
fast: image.iso
|
|
|
|
qemu-system-i386 -cdrom $< ${QEMU_ARGS} \
|
2018-07-07 04:56:14 +03:00
|
|
|
-fw_cfg name=opt/org.toaruos.bootmode,string=normal
|
2018-07-06 08:15:17 +03:00
|
|
|
|
2018-07-06 04:40:49 +03:00
|
|
|
.PHONY: headless
|
|
|
|
headless: image.iso
|
2018-07-17 17:39:14 +03:00
|
|
|
@qemu-system-i386 -cdrom $< ${QEMU_ARGS} \
|
2018-08-02 12:48:45 +03:00
|
|
|
-nographic -no-reboot \
|
2018-07-07 04:56:14 +03:00
|
|
|
-fw_cfg name=opt/org.toaruos.bootmode,string=headless
|
2018-04-26 11:04:19 +03:00
|
|
|
|
2018-08-13 07:32:26 +03:00
|
|
|
.PHONY: shell
|
|
|
|
shell: image.iso
|
|
|
|
@qemu-system-i386 -cdrom $< ${QEMU_ARGS} \
|
|
|
|
-nographic -no-reboot \
|
|
|
|
-fw_cfg name=opt/org.toaruos.bootmode,string=headless \
|
|
|
|
-fw_cfg name=opt/org.toaruos.forceuser,string=local
|
|
|
|
|
2018-07-11 13:18:41 +03:00
|
|
|
.PHONY: efi64
|
|
|
|
efi64: image.iso
|
|
|
|
qemu-system-x86_64 -cdrom $< ${QEMU_ARGS} \
|
|
|
|
-bios /usr/share/qemu/OVMF.fd
|
|
|
|
|
2018-04-26 11:04:19 +03:00
|
|
|
VMNAME=ToaruOS-NIH CD
|
2018-07-11 13:17:18 +03:00
|
|
|
|
2018-07-17 17:49:37 +03:00
|
|
|
define virtualbox-runner =
|
|
|
|
.PHONY: $1
|
|
|
|
$1: image.iso
|
2018-04-26 11:04:19 +03:00
|
|
|
-VBoxManage unregistervm "$(VMNAME)" --delete
|
2018-07-17 17:49:37 +03:00
|
|
|
VBoxManage createvm --name "$(VMNAME)" --ostype $2 --register
|
|
|
|
VBoxManage modifyvm "$(VMNAME)" --memory 1024 --vram 32 --audio pulse --audiocontroller ac97 --bioslogodisplaytime 1 --bioslogofadeout off --bioslogofadein off --biosbootmenu disabled $3
|
2018-04-26 11:04:19 +03:00
|
|
|
VBoxManage storagectl "$(VMNAME)" --add ide --name "IDE"
|
2018-07-17 17:49:37 +03:00
|
|
|
VBoxManage storageattach "$(VMNAME)" --storagectl "IDE" --port 0 --device 0 --medium $$(shell pwd)/image.iso --type dvddrive
|
2018-05-04 06:29:17 +03:00
|
|
|
VBoxManage setextradata "$(VMNAME)" GUI/DefaultCloseAction PowerOff
|
2018-04-27 10:41:43 +03:00
|
|
|
VBoxManage startvm "$(VMNAME)" --type separate
|
2018-07-17 17:49:37 +03:00
|
|
|
endef
|
2018-04-26 11:04:19 +03:00
|
|
|
|
2018-07-17 17:49:37 +03:00
|
|
|
$(eval $(call virtualbox-runner,virtualbox,"Other",))
|
|
|
|
$(eval $(call virtualbox-runner,virtualbox-efi,"Other",--firmware efi))
|
|
|
|
$(eval $(call virtualbox-runner,virtualbox-efi64,"Other_64",--firmware efi))
|
2018-04-26 11:04:19 +03:00
|
|
|
|
2018-09-21 07:13:49 +03:00
|
|
|
# Optional Extensions
|
|
|
|
#
|
|
|
|
# These optional extension libraries require third-party components to build,
|
|
|
|
# but allow the native applications to make use of functionality such as
|
|
|
|
# TrueType fonts or PNG images. You must have the necessary elements to build
|
|
|
|
# these already installed into your sysroot for this to work.
|
|
|
|
EXT_LIBS=$(patsubst ext/%.c,%,$(wildcard ext/*.c))
|
|
|
|
EXT_LIBS_X=$(foreach lib,$(EXT_LIBS),base/lib/libtoaru_$(lib).so)
|
|
|
|
EXT_LIBS_Y=$(foreach lib,$(EXT_LIBS),.make/$(lib).elmak)
|
|
|
|
|
|
|
|
.make/%.elmak: ext/%.c util/auto-dep.py | dirs
|
|
|
|
util/auto-dep.py --makelib $< > $@
|
|
|
|
|
|
|
|
ifeq (,$(findstring clean,$(MAKECMDGOALS)))
|
|
|
|
-include ${EXT_LIBS_Y}
|
|
|
|
endif
|
|
|
|
|
|
|
|
ext-freetype: base/lib/libtoaru_ext_freetype_fonts.so
|
2018-09-22 15:26:25 +03:00
|
|
|
ext-cairo: base/lib/libtoaru_ext_cairo_renderer.so
|