MAKE = make MAKEFLAGS += --no-print-directory SRC_ROOT := $(shell pwd) include Makefile.config .PHONY: all doc run clean test FORCE all: glitch.elf doc: FORCE sphinx-build -b html doc.src doc run: glitch.iso @qemu-system-i386 -cdrom glitch.iso -accel kvm -d cpu_reset -display gtk,zoom-to-fit=on clean: @${MAKE} ARCH=${ARCH} -C lib clean @${MAKE} ARCH=${ARCH} -C ${ARCH} clean @${MAKE} ARCH=${ARCH} -C devices clean @${MAKE} ARCH=${ARCH} -C src clean info: @echo "* Build information *" @echo " ARCH ${ARCH}" @echo " MAKE $(shell ${MAKE} --version | head -n1)" @echo " CC $(shell ${CC} --version | head -n1)" @echo " ${CFLAGS}" @echo " LD $(shell ${LD} --version | head -n1)" @echo " ${LDFLAGS}" test: @echo Looking for inline assembly @grep -rn 'asm' devices lib src @echo Running tests @make -C lib test FORCE: .config: Kconfig @alldefconfig Makefile.config: .config @cp .config Makefile.config @echo -e '\n# toolchain.mk' >> Makefile.config @cat $$(sed -nE "s/CONFIG_ARCH_(.+)=y/\1/p" .config)/toolchain.mk >> Makefile.config symlinks: mkdir -p src/include ln -sTf $(SRC_ROOT)/grub src/include/grub ln -sTf $(SRC_ROOT)/${ARCH} src/include/arch ln -sTf $(SRC_ROOT)/${ARCH}/sys src/include/sys ln -sTf $(SRC_ROOT)/devices src/include/devices ln -sTf $(SRC_ROOT)/lib src/include/lib mkdir -p devices/include ln -sTf $(SRC_ROOT)/${ARCH}/sys devices/include/sys mkdir -p i686/include ln -sTf $(SRC_ROOT)/grub i686/include/grub lib/libk.a: FORCE @${MAKE} -C lib libk.a i686/arch.a: FORCE @${MAKE} -C ${ARCH} arch.a devices/devs.a: FORCE @${MAKE} -C devices devs.a src/kernel.a: FORCE @${MAKE} -C src kernel.a glitch.elf: ${ARCH}/arch.a src/kernel.a devices/devs.a lib/libk.a @echo ' LD $@' @${LD} ${LDFLAGS} -T ${ARCH}/linker.ld -o $@ $^ @echo -n ' B2b ' @b2sum $@ | cut -d ' ' -f1 glitch.iso: glitch.elf grub/grub.cfg @grub-file --is-x86-multiboot2 glitch.elf @mkdir -p isodir/boot/grub @mkdir -p isodir/boot/glitch @grub-script-check grub/grub.cfg @cp grub/grub.cfg isodir/boot/grub/grub.cfg @cp glitch.elf isodir/boot/glitch/glitch.elf @${STRIP} isodir/boot/glitch/glitch.elf @rm -f isodir/boot/glitch/checksums @sha512sum isodir/boot/glitch/* > isodir/boot/glitch/checksums @sed -i s/isodir// isodir/boot/glitch/checksums @grub-mkrescue -o glitch.iso isodir