2021-05-31 04:47:02 +03:00
|
|
|
TOOLCHAIN=util
|
|
|
|
BASE=base
|
|
|
|
export PATH := $(shell $(TOOLCHAIN)/activate.sh)
|
2018-04-17 16:18:15 +03:00
|
|
|
|
2021-05-31 04:47:02 +03:00
|
|
|
include build/x86_64.mk
|
2018-09-22 19:15:32 +03:00
|
|
|
|
2021-05-31 04:47:02 +03:00
|
|
|
CC = ${TARGET}-gcc
|
|
|
|
NM = ${TARGET}-nm
|
|
|
|
CXX= ${TARGET}-g++
|
|
|
|
AR = ${TARGET}-ar
|
|
|
|
AS = ${TARGET}-as
|
|
|
|
OC = ${TARGET}-objcopy
|
2018-04-24 13:39:47 +03:00
|
|
|
|
2021-05-31 04:47:02 +03:00
|
|
|
KERNEL_CFLAGS = -ffreestanding -O2 -std=gnu11 -g -static
|
|
|
|
KERNEL_CFLAGS += -Wall -Wextra -Wno-unused-function -Wno-unused-parameter
|
|
|
|
KERNEL_CFLAGS += -pedantic -Wwrite-strings ${ARCH_KERNEL_CFLAGS}
|
2018-04-24 13:39:47 +03:00
|
|
|
|
2021-05-31 04:47:02 +03:00
|
|
|
# Defined constants for the kernel
|
|
|
|
KERNEL_CFLAGS += -D_KERNEL_ -DKERNEL_ARCH=${ARCH}
|
|
|
|
KERNEL_CFLAGS += -DKERNEL_GIT_TAG=`util/make-version`
|
2018-02-25 08:13:54 +03:00
|
|
|
|
2021-05-31 04:47:02 +03:00
|
|
|
KERNEL_OBJS = $(patsubst %.c,%.o,$(wildcard kernel/*.c))
|
|
|
|
KERNEL_OBJS += $(patsubst %.c,%.o,$(wildcard kernel/*/*.c))
|
|
|
|
KERNEL_OBJS += $(patsubst %.c,%.o,$(wildcard kernel/arch/${ARCH}/*.c))
|
|
|
|
|
|
|
|
KERNEL_ASMOBJS = $(filter-out kernel/symbols.o,$(patsubst %.S,%.o,$(wildcard kernel/arch/${ARCH}/*.S)))
|
|
|
|
|
|
|
|
KERNEL_SOURCES = $(wildcard kernel/*.c) $(wildcard kernel/*/*.c) $(wildcard kernel/${ARCH}/*/*.c)
|
|
|
|
KERNEL_SOURCES += $(wildcard kernel/arch/${ARCH}/*.S)
|
|
|
|
|
2021-06-03 15:01:57 +03:00
|
|
|
MODULES = $(patsubst modules/%.c,$(BASE)/mod/%.ko,$(wildcard modules/*.c))
|
2021-05-31 04:47:02 +03:00
|
|
|
|
|
|
|
# Configs you can override.
|
|
|
|
SMP ?= 1
|
|
|
|
RAM ?= 3G
|
|
|
|
EXTRA_ARGS ?=
|
|
|
|
|
|
|
|
EMU = qemu-system-x86_64
|
2021-06-14 05:27:35 +03:00
|
|
|
EMU_ARGS = -M q35
|
2021-05-31 04:47:02 +03:00
|
|
|
EMU_ARGS += -m $(RAM)
|
|
|
|
EMU_ARGS += -smp $(SMP)
|
|
|
|
EMU_ARGS += -no-reboot
|
|
|
|
EMU_ARGS += -serial mon:stdio
|
|
|
|
EMU_ARGS += -rtc base=localtime
|
|
|
|
EMU_ARGS += -soundhw pcspk,ac97
|
2021-06-07 13:12:02 +03:00
|
|
|
|
|
|
|
# Configures two network devices on the same network
|
|
|
|
EMU_ARGS += -net user
|
|
|
|
EMU_ARGS += -netdev hubport,id=u1,hubid=0, -device e1000e,netdev=u1 -object filter-dump,id=f1,netdev=u1,file=qemu-e1000e.pcap
|
2021-07-14 04:44:46 +03:00
|
|
|
#EMU_ARGS += -netdev hubport,id=u2,hubid=0, -device e1000e,netdev=u2
|
|
|
|
|
|
|
|
# Add an XHCI tablet
|
2021-08-01 11:45:31 +03:00
|
|
|
EMU_ARGS += -device qemu-xhci -device usb-tablet
|
2021-06-07 13:12:02 +03:00
|
|
|
|
2021-05-31 04:47:02 +03:00
|
|
|
EMU_KVM ?= -enable-kvm
|
|
|
|
|
|
|
|
APPS=$(patsubst apps/%.c,%,$(wildcard apps/*.c)) $(patsubst apps/%.c++,%,$(wildcard apps/*.c++))
|
|
|
|
APPS_X=$(foreach app,$(APPS),$(BASE)/bin/$(app))
|
2019-12-15 10:54:08 +03:00
|
|
|
APPS_Y=$(foreach app,$(APPS),.make/$(app).mak)
|
2018-08-08 04:14:59 +03:00
|
|
|
APPS_SH=$(patsubst apps/%.sh,%.sh,$(wildcard apps/*.sh))
|
2021-05-31 04:47:02 +03:00
|
|
|
APPS_SH_X=$(foreach app,$(APPS_SH),$(BASE)/bin/$(app))
|
2021-01-23 09:31:38 +03:00
|
|
|
APPS_KRK=$(patsubst apps/%.krk,%.krk,$(wildcard apps/*.krk))
|
2021-05-31 04:47:02 +03:00
|
|
|
APPS_KRK_X=$(foreach app,$(APPS_KRK),$(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))
|
2021-05-31 04:47:02 +03:00
|
|
|
LIBS_X=$(foreach lib,$(LIBS),$(BASE)/lib/libtoaru_$(lib).so)
|
2018-04-17 16:18:15 +03:00
|
|
|
LIBS_Y=$(foreach lib,$(LIBS),.make/$(lib).lmak)
|
|
|
|
|
2021-05-31 04:47:02 +03:00
|
|
|
KRK_MODS = $(patsubst kuroko/src/modules/module_%.c,$(BASE)/lib/kuroko/%.so,$(wildcard kuroko/src/modules/module_*.c))
|
2021-08-11 09:24:47 +03:00
|
|
|
KRK_MODS += $(patsubst kuroko/modules/%,$(BASE)/lib/kuroko/%,$(wildcard kuroko/modules/*.krk kuroko/modules/*/*/.krk kuroko/modules/*/*/*.krk))
|
2021-05-31 04:47:02 +03:00
|
|
|
KRK_MODS_X = $(patsubst lib/kuroko/%.c,$(BASE)/lib/kuroko/%.so,$(wildcard lib/kuroko/*.c))
|
|
|
|
KRK_MODS_Y = $(patsubst lib/kuroko/%.c,.make/%.kmak,$(wildcard lib/kuroko/*.c))
|
2019-07-09 15:18:20 +03:00
|
|
|
|
2021-05-31 04:47:02 +03:00
|
|
|
CFLAGS= -O2 -std=gnu11 -I. -Iapps -fplan9-extensions -Wall -Wextra -Wno-unused-parameter
|
2019-07-09 15:18:20 +03:00
|
|
|
|
2021-05-31 04:47:02 +03:00
|
|
|
LIBC_OBJS = $(patsubst %.c,%.o,$(wildcard libc/*.c))
|
|
|
|
LIBC_OBJS += $(patsubst %.c,%.o,$(wildcard libc/*/*.c))
|
|
|
|
LIBC_OBJS += $(patsubst %.c,%.o,$(wildcard libc/arch/${ARCH}/*.c))
|
2018-08-01 11:20:34 +03:00
|
|
|
|
2021-05-31 04:47:02 +03:00
|
|
|
GCC_SHARED = $(BASE)/usr/lib/libgcc_s.so.1 $(BASE)/usr/lib/libgcc_s.so
|
|
|
|
LIBSTDCXX = $(BASE)/usr/lib/libstdc++.so.6.0.28 $(BASE)/usr/lib/libstdc++.so.6 $(BASE)/usr/lib/libstdc++.so
|
2018-04-24 13:39:47 +03:00
|
|
|
|
2021-05-31 04:47:02 +03:00
|
|
|
CRTS = $(BASE)/lib/crt0.o $(BASE)/lib/crti.o $(BASE)/lib/crtn.o
|
2018-03-16 15:56:19 +03:00
|
|
|
|
2021-05-31 04:47:02 +03:00
|
|
|
LC = $(BASE)/lib/libc.so $(GCC_SHARED) $(LIBSTDCXX)
|
2018-03-16 15:56:19 +03:00
|
|
|
|
2021-05-31 04:47:02 +03:00
|
|
|
.PHONY: all system clean run shell
|
2018-04-24 13:39:47 +03:00
|
|
|
|
2021-05-31 04:47:02 +03:00
|
|
|
all: system
|
2021-06-14 05:27:35 +03:00
|
|
|
system: image.iso
|
2021-05-31 04:47:02 +03:00
|
|
|
|
2021-06-03 15:01:57 +03:00
|
|
|
$(BASE)/mod/%.ko: modules/%.c | dirs
|
|
|
|
${CC} -c ${KERNEL_CFLAGS} -mcmodel=large -o $@ $<
|
2021-05-31 04:47:02 +03:00
|
|
|
|
2021-07-17 12:55:54 +03:00
|
|
|
ramdisk.igz: $(wildcard $(BASE)/* $(BASE)/*/* $(BASE)/*/*/* $(BASE)/*/*/*/* $(BASE)/*/*/*/*/*) $(APPS_X) $(LIBS_X) $(KRK_MODS_X) $(BASE)/bin/kuroko $(BASE)/lib/ld.so $(APPS_KRK_X) $(KRK_MODS) $(APPS_SH_X) $(MODULES)
|
2021-05-31 04:47:02 +03:00
|
|
|
python3 util/createramdisk.py
|
|
|
|
|
|
|
|
KRK_SRC = $(sort $(wildcard kuroko/src/*.c))
|
2021-06-15 09:25:17 +03:00
|
|
|
$(BASE)/bin/kuroko: $(KRK_SRC) $(CRTS) lib/rline.c | $(LC)
|
|
|
|
$(CC) -O2 -g -o $@ -Wl,--export-dynamic -Ikuroko/src $(KRK_SRC) lib/rline.c
|
2021-05-31 04:47:02 +03:00
|
|
|
|
|
|
|
$(BASE)/lib/kuroko/%.so: kuroko/src/modules/module_%.c| dirs $(LC)
|
|
|
|
$(CC) -O2 -shared -fPIC -Ikuroko/src -o $@ $<
|
2018-04-24 13:39:47 +03:00
|
|
|
|
2021-07-31 12:40:03 +03:00
|
|
|
$(BASE)/lib/kuroko/%.krk: kuroko/modules/%.krk | dirs
|
|
|
|
mkdir -p $(dir $@)
|
|
|
|
cp $< $@
|
|
|
|
|
2021-05-31 04:47:02 +03:00
|
|
|
$(BASE)/lib/libkuroko.so: $(KRK_SRC) | $(LC)
|
|
|
|
$(CC) -O2 -shared -fPIC -Ikuroko/src -o $@ $(filter-out kuroko/src/kuroko.c,$(KRK_SRC))
|
2018-04-24 13:39:47 +03:00
|
|
|
|
2021-05-31 04:47:02 +03:00
|
|
|
$(BASE)/lib/ld.so: linker/linker.c $(BASE)/lib/libc.a | dirs $(LC)
|
|
|
|
$(CC) -g -static -Wl,-static $(CFLAGS) -o $@ -Os -T linker/link.ld $<
|
2018-03-16 15:56:19 +03:00
|
|
|
|
2021-05-31 04:47:02 +03:00
|
|
|
run: system
|
2021-06-14 05:27:35 +03:00
|
|
|
${EMU} ${EMU_ARGS} ${EMU_KVM} -cdrom image.iso
|
|
|
|
|
|
|
|
fast: system
|
|
|
|
${EMU} ${EMU_ARGS} ${EMU_KVM} -cdrom image.iso \
|
|
|
|
-fw_cfg name=opt/org.toaruos.bootmode,string=normal \
|
2018-03-16 15:56:19 +03:00
|
|
|
|
2021-06-10 14:20:55 +03:00
|
|
|
run-vga: system
|
2021-06-14 05:27:35 +03:00
|
|
|
${EMU} ${EMU_ARGS} ${EMU_KVM} -cdrom image.iso \
|
|
|
|
-fw_cfg name=opt/org.toaruos.bootmode,string=vga \
|
2021-06-10 14:20:55 +03:00
|
|
|
|
2021-08-04 13:36:36 +03:00
|
|
|
test: system
|
2021-08-08 10:36:16 +03:00
|
|
|
${EMU} -M q35 -m $(RAM) -smp $(SMP) ${EMU_KVM} -kernel misaka-kernel -initrd ramdisk.igz,util/init.krk -append "root=/dev/ram0 init=/dev/ram1" \
|
2021-08-04 13:36:36 +03:00
|
|
|
-nographic -no-reboot -audiodev none,id=id -serial null -serial mon:stdio \
|
2021-08-21 02:04:59 +03:00
|
|
|
-device qemu-xhci -device usb-tablet -trace "usb*"
|
2021-08-04 13:36:36 +03:00
|
|
|
|
2021-05-31 04:47:02 +03:00
|
|
|
shell: system
|
2021-06-14 05:27:35 +03:00
|
|
|
${EMU} -m $(RAM) -smp $(SMP) ${EMU_KVM} -cdrom image.iso \
|
2021-05-31 04:47:02 +03:00
|
|
|
-nographic -no-reboot -audiodev none,id=id -serial null -serial mon:stdio \
|
|
|
|
-fw_cfg name=opt/org.toaruos.gettyargs,string="-a local /dev/ttyS1" \
|
2021-06-14 05:27:35 +03:00
|
|
|
-fw_cfg name=opt/org.toaruos.bootmode,string=headless \
|
2021-05-31 04:47:02 +03:00
|
|
|
-fw_cfg name=opt/org.toaruos.term,string=${TERM}
|
2018-03-16 15:56:19 +03:00
|
|
|
|
2021-05-31 04:47:02 +03:00
|
|
|
misaka-kernel: ${KERNEL_ASMOBJS} ${KERNEL_OBJS} kernel/symbols.o
|
|
|
|
${CC} -g -T kernel/arch/${ARCH}/link.ld ${KERNEL_CFLAGS} -o $@.64 ${KERNEL_ASMOBJS} ${KERNEL_OBJS} kernel/symbols.o -lgcc
|
2021-05-31 14:06:28 +03:00
|
|
|
${OC} --strip-debug -I elf64-x86-64 -O elf32-i386 $@.64 $@
|
2018-03-16 15:56:19 +03:00
|
|
|
|
2021-05-31 04:47:02 +03:00
|
|
|
kernel/sys/version.o: ${KERNEL_SOURCES}
|
2018-03-16 15:56:19 +03:00
|
|
|
|
2021-05-31 04:47:02 +03:00
|
|
|
kernel/symbols.o: ${KERNEL_ASMOBJS} ${KERNEL_OBJS} util/gensym.krk
|
|
|
|
-rm -f kernel/symbols.o
|
|
|
|
${CC} -T kernel/arch/${ARCH}/link.ld ${KERNEL_CFLAGS} -o misaka-kernel.64 ${KERNEL_ASMOBJS} ${KERNEL_OBJS} -lgcc
|
|
|
|
${NM} misaka-kernel.64 -g | kuroko util/gensym.krk > kernel/symbols.S
|
|
|
|
${CC} -c kernel/symbols.S -o $@
|
|
|
|
|
|
|
|
kernel/%.o: kernel/%.S
|
|
|
|
echo ${PATH}
|
|
|
|
${CC} -c $< -o $@
|
|
|
|
|
2021-06-18 09:20:22 +03:00
|
|
|
HEADERS = $(wildcard base/usr/include/kernel/*.h) $(wildcard base/usr/include/kernel/*/*.h)
|
2021-05-31 04:47:02 +03:00
|
|
|
|
|
|
|
kernel/%.o: kernel/%.c ${HEADERS}
|
|
|
|
${CC} ${KERNEL_CFLAGS} -nostdlib -g -Iinclude -c -o $@ $<
|
|
|
|
|
|
|
|
clean:
|
|
|
|
-rm -f ${KERNEL_ASMOBJS}
|
|
|
|
-rm -f ${KERNEL_OBJS}
|
|
|
|
-rm -f kernel/symbols.o misaka-kernel misaka-kernel.64
|
|
|
|
-rm -f ramdisk.tar ramdisk.igz
|
|
|
|
-rm -f $(APPS_Y) $(LIBS_Y) $(KRK_MODS_Y) $(KRK_MODS)
|
|
|
|
-rm -f $(APPS_X) $(LIBS_X) $(KRK_MODS_X) $(APPS_KRK_X) $(APPS_SH_X)
|
|
|
|
-rm -f $(BASE)/lib/crt0.o $(BASE)/lib/crti.o $(BASE)/lib/crtn.o
|
|
|
|
-rm -f $(BASE)/lib/libc.so $(BASE)/lib/libc.a
|
|
|
|
-rm -f $(LIBC_OBJS) $(BASE)/lib/ld.so $(BASE)/lib/libkuroko.so $(BASE)/lib/libm.so
|
|
|
|
-rm -f $(BASE)/bin/kuroko
|
|
|
|
-rm -f $(GCC_SHARED) $(LIBSTDCXX)
|
|
|
|
|
|
|
|
libc/%.o: libc/%.c base/usr/include/syscall.h
|
|
|
|
$(CC) -O2 -std=gnu11 -Wall -Wextra -Wno-unused-parameter -fPIC -c -o $@ $<
|
|
|
|
|
|
|
|
.PHONY: libc
|
|
|
|
libc: $(BASE)/lib/libc.a $(BASE)/lib/libc.so
|
|
|
|
|
|
|
|
$(BASE)/lib/libc.a: ${LIBC_OBJS} $(CRTS)
|
|
|
|
$(AR) cr $@ $(LIBC_OBJS)
|
|
|
|
|
|
|
|
$(BASE)/lib/libc.so: ${LIBC_OBJS} | $(CRTS)
|
|
|
|
${CC} -nodefaultlibs -shared -fPIC -o $@ $^
|
|
|
|
|
|
|
|
$(BASE)/lib/crt%.o: libc/arch/${ARCH}/crt%.S
|
|
|
|
${AS} -o $@ $<
|
|
|
|
|
|
|
|
$(BASE)/usr/lib/%: util/local/${TARGET}/lib/% | dirs
|
|
|
|
cp -a $< $@
|
|
|
|
-strip $@
|
|
|
|
|
|
|
|
$(BASE)/lib/libm.so: util/libm.c
|
|
|
|
$(CC) -shared -nostdlib -fPIC -o $@ $<
|
|
|
|
|
|
|
|
$(BASE)/dev:
|
2018-07-11 03:43:31 +03:00
|
|
|
mkdir -p $@
|
2021-05-31 04:47:02 +03:00
|
|
|
$(BASE)/tmp:
|
2018-07-14 12:33:57 +03:00
|
|
|
mkdir -p $@
|
2021-05-31 04:47:02 +03:00
|
|
|
$(BASE)/proc:
|
2018-07-11 03:43:31 +03:00
|
|
|
mkdir -p $@
|
2021-05-31 04:47:02 +03:00
|
|
|
$(BASE)/bin:
|
2018-07-11 03:43:31 +03:00
|
|
|
mkdir -p $@
|
2021-05-31 04:47:02 +03:00
|
|
|
$(BASE)/lib:
|
2018-07-11 03:43:31 +03:00
|
|
|
mkdir -p $@
|
2021-05-31 04:47:02 +03:00
|
|
|
$(BASE)/cdrom:
|
2018-08-12 11:14:15 +03:00
|
|
|
mkdir -p $@
|
2021-05-31 04:47:02 +03:00
|
|
|
$(BASE)/var:
|
2018-10-31 04:51:08 +03:00
|
|
|
mkdir -p $@
|
2021-06-03 15:01:57 +03:00
|
|
|
$(BASE)/mod:
|
|
|
|
mkdir -p $@
|
2021-05-31 04:47:02 +03:00
|
|
|
$(BASE)/lib/kuroko:
|
|
|
|
mkdir -p $@
|
|
|
|
$(BASE)/usr/lib:
|
2021-01-01 11:19:44 +03:00
|
|
|
mkdir -p $@
|
2018-07-11 03:43:31 +03:00
|
|
|
fatbase/efi/boot:
|
|
|
|
mkdir -p $@
|
2018-11-16 08:09:37 +03:00
|
|
|
cdrom:
|
|
|
|
mkdir -p $@
|
2018-04-17 15:49:56 +03:00
|
|
|
.make:
|
|
|
|
mkdir -p .make
|
2021-06-03 15:01:57 +03:00
|
|
|
dirs: $(BASE)/dev $(BASE)/tmp $(BASE)/proc $(BASE)/bin $(BASE)/lib $(BASE)/cdrom $(BASE)/usr/lib $(BASE)/lib/kuroko cdrom $(BASE)/var fatbase/efi/boot .make $(BASE)/mod
|
2018-03-16 15:56:19 +03:00
|
|
|
|
2018-04-18 15:39:27 +03:00
|
|
|
ifeq (,$(findstring clean,$(MAKECMDGOALS)))
|
2021-05-31 04:47:02 +03:00
|
|
|
-include ${APPS_Y}
|
2018-04-17 16:18:15 +03:00
|
|
|
-include ${LIBS_Y}
|
2021-05-31 04:47:02 +03:00
|
|
|
-include ${KRK_MODS_Y}
|
2018-04-18 15:39:27 +03:00
|
|
|
endif
|
2018-02-25 08:13:54 +03:00
|
|
|
|
2021-05-31 04:47:02 +03:00
|
|
|
.make/%.lmak: lib/%.c util/auto-dep.krk | dirs $(CRTS)
|
|
|
|
kuroko util/auto-dep.krk --makelib $< > $@
|
2018-06-29 07:55:03 +03:00
|
|
|
|
2021-05-31 04:47:02 +03:00
|
|
|
.make/%.mak: apps/%.c util/auto-dep.krk | dirs $(CRTS)
|
|
|
|
kuroko util/auto-dep.krk --make $< > $@
|
2018-03-16 15:56:19 +03:00
|
|
|
|
2021-05-31 04:47:02 +03:00
|
|
|
.make/%.mak: apps/%.c++ util/auto-dep.krk | dirs $(CRTS)
|
|
|
|
kuroko util/auto-dep.krk --make $< > $@
|
2018-02-25 08:13:54 +03:00
|
|
|
|
2021-05-31 04:47:02 +03:00
|
|
|
.make/%.kmak: lib/kuroko/%.c util/auto-dep.krk | dirs
|
|
|
|
kuroko util/auto-dep.krk --makekurokomod $< > $@
|
2018-02-25 08:13:54 +03:00
|
|
|
|
2021-05-31 04:47:02 +03:00
|
|
|
$(BASE)/bin/%.sh: apps/%.sh
|
2018-08-08 04:14:59 +03:00
|
|
|
cp $< $@
|
|
|
|
chmod +x $@
|
|
|
|
|
2021-05-31 04:47:02 +03:00
|
|
|
$(BASE)/bin/%.krk: apps/%.krk
|
2021-01-23 09:31:38 +03:00
|
|
|
cp $< $@
|
|
|
|
chmod +x $@
|
|
|
|
|
2021-05-31 04:47:02 +03:00
|
|
|
.PHONY: libs
|
|
|
|
libs: $(LIBS_X)
|
2018-03-15 04:19:18 +03:00
|
|
|
|
2021-05-31 04:47:02 +03:00
|
|
|
.PHONY: apps
|
|
|
|
apps: $(APPS_X)
|
2018-09-21 07:13:49 +03:00
|
|
|
|
2021-05-31 04:47:02 +03:00
|
|
|
.PHONY: libstdcxx
|
|
|
|
libstdcxx: $(LIBSTDCXX)
|
2018-09-22 19:15:32 +03:00
|
|
|
|
2021-05-31 04:47:02 +03:00
|
|
|
util/local/${TARGET}/lib/libstdc++.so.6.0.28: | $(BASE)/lib/libm.so
|
|
|
|
cd util/build/gcc && make all-target-libstdc++-v3 && make install-target-libstdc++-v3
|
2018-10-16 08:14:23 +03:00
|
|
|
|
2021-05-31 04:47:02 +03:00
|
|
|
SOURCE_FILES = $(wildcard kernel/*.c kernel/*/*.c kernel/*/*/*.c kernel/*/*/*/*.c)
|
|
|
|
SOURCE_FILES += $(wildcard apps/*.c linker/*.c libc/*.c libc/*/*.c lib/*.c lib/kuroko/*.c)
|
|
|
|
SOURCE_FILES += $(wildcard kuroko/src/*.c kuroko/src/*.h kuroko/src/*/*.c kuroko/src/*/*.h)
|
|
|
|
SOURCE_FILES += $(wildcard $(BASE)/usr/include/*.h $(BASE)/usr/include/*/*.h $(BASE)/usr/include/*/*/*.h)
|
|
|
|
tags: $(SOURCE_FILES)
|
|
|
|
ctags -f tags $(SOURCE_FILES)
|
2021-05-31 06:31:01 +03:00
|
|
|
|
|
|
|
# Loader stuff, legacy CDs
|
|
|
|
fatbase/ramdisk.igz: ramdisk.igz
|
|
|
|
cp $< $@
|
|
|
|
fatbase/kernel: misaka-kernel
|
|
|
|
cp $< $@
|
|
|
|
strip $@
|
|
|
|
|
|
|
|
cdrom/fat.img: fatbase/ramdisk.igz fatbase/kernel util/mkdisk.sh | dirs
|
|
|
|
util/mkdisk.sh $@ fatbase
|
|
|
|
|
2021-06-14 05:11:37 +03:00
|
|
|
cdrom/boot.sys: boot/boot.o $(patsubst %.c,%.o,$(wildcard boot/*.c)) boot/link.ld | dirs
|
|
|
|
${LD} -melf_i386 -T boot/link.ld -o $@ boot/boot.o $(patsubst %.c,%.o,$(wildcard boot/*.c))
|
2021-05-31 06:31:01 +03:00
|
|
|
|
2021-06-14 05:11:37 +03:00
|
|
|
boot/%.o: boot/%.c boot/*.h
|
2021-05-31 06:31:01 +03:00
|
|
|
${CC} -m32 -c -Os -fno-strict-aliasing -finline-functions -ffreestanding -mgeneral-regs-only -o $@ $<
|
|
|
|
|
|
|
|
boot/boot.o: boot/boot.S
|
|
|
|
${AS} --32 -o $@ $<
|
|
|
|
|
|
|
|
image.iso: cdrom/fat.img cdrom/boot.sys util/update-extents.py
|
|
|
|
xorriso -as mkisofs -R -J -c bootcat \
|
|
|
|
-b boot.sys -no-emul-boot -boot-load-size full \
|
|
|
|
-eltorito-alt-boot -e fat.img -no-emul-boot -isohybrid-gpt-basdat \
|
|
|
|
-o image.iso cdrom
|
|
|
|
python3 util/update-extents.py
|
|
|
|
|