rwildcard=$(foreach d,$(wildcard $(1:=/*)),$(call rwildcard,$d,$2) $(filter $(subst *,%,$2),$d)) HEADERS := $(call rwildcard,src/kernel,*.h) SOURCEC := $(call rwildcard,src/kernel,*.c) SOURCEA := $(call rwildcard,src/kernel,*.asm) OBJECTS := $(patsubst src/%.c, build/%.o, $(SOURCEC)) $(patsubst src/%.asm, build/%.o, $(SOURCEA)) drive.bin: Makefile partuuid.txt mod.ld elftomod.py bootfs/luma_vid.mod bootfs/luma_hda.mod bootfs/luma_fs.mod bootfs/luma_wm.mod bootfs/luma_uhci.mod bootfs/luma_ps2.mod boot0.bin boot1.bin $(OBJECTS) i386-elf-ld -pie -T mod.ld -no-dynamic-linker -nostdlib -o kernel.elf $(OBJECTS) $(LDFLAGS) ./elftomod.py kernel.elf bootfs/krnl.mod ppm_Bitmap:0 vpm_init:1 vpm_map:2 canal_init:3 pci_init:4 scheduler_init:5 scheduler_spawn:6 scheduler_start:7 dd if=/dev/zero of=drive.bin bs=1024 count=10240 /bin/echo -e "mklabel msdos\nmkpart primary 8192b -1s\nquit\n" | parted drive.bin mkdir -p mnt /bin/echo -e "512\n20464\n0\n0\n0\n0\n" | leanfuse -O8192 -I`cat partuuid.txt` -Cdrive.bin ./leanfuse mnt drive.bin -O8192 cp -r bootfs/* ./mnt/ fusermount -u ./mnt dd if=boot0.bin of=drive.bin bs=1 count=446 seek=0 conv=notrunc dd if=boot1.bin of=drive.bin bs=1 seek=512 conv=notrunc cp drive.bin drive2.bin bootfs/luma_%.mod: $(MAKE) -C luma/$* mod boot0.bin: src/boot0.asm boot1.bin nasm -DBOOT1_SIZE=`stat -c %s boot1.bin` -fbin -o $@ $< boot1.bin: src/boot1.asm partuuid.txt nasm -DPARTUUID=`cat partuuid.txt` -fbin -o $@ $< build/kernel/%.o: src/kernel/%.c mkdir -p $(@D) i386-elf-gcc -march=i386 -Isrc -Os -pie -nodefaultlibs -nostdlib -nostartfiles -fomit-frame-pointer -c -o $@ -ffreestanding -mgeneral-regs-only -std=gnu99 -Wall $< build/kernel/%.o: src/kernel/%.asm mkdir -p $(@D) nasm -felf32 -o $@ $< partuuid.txt: openssl rand -hex 16 > partuuid.txt qemu: qemu-system-i386 -m 32 -drive if=none,id=driev,format=raw,file=drive.bin -usb -debugcon stdio -soundhw hda -device usb-storage,bus=usb-bus.0,drive=driev