aboutsummaryrefslogtreecommitdiff
path: root/mk
blob: f4de64b9660d2a3761cbd785b15ada5572790bc8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!./mach

SUBDIRS := lib ${ARCH} devices src

${ARCH}_LDFLAGS  += -T ${ROOTDIR}${ARCH}/linker.ld

TARGETBIN += glitch
glitch.OBJS += ${ARCH}/arch.a src/kernel.a devices/devs.a lib/libk.a

lib/libk.a:
	@${MAKE} -C lib -f ../root.mk libk.a
i686/arch.a:
	@${MAKE} -C ${ARCH} -f ../root.mk arch.a
devices/devs.a:
	@${MAKE} -C devices -f ../root.mk devs.a
src/kernel.a:
	@${MAKE} -C src -f ../root.mk kernel.a
kconfig:
	@${MAKE} -C tools/kconfig -f ../../root.mk

run: glitch.iso
	qemu-system-i386 -accel kvm -machine pc -cdrom $^ -d cpu_reset -display gtk,zoom-to-fit=on

# configure targets
.config: Kconfig
	@alldefconfig

config.mk: .config ${ARCH}/toolchain.mk
	@cat .config > $@
	@echo -e '\n## toolchain.mk' >> $@
	@cat ${ARCH}/toolchain.mk >> $@

# iso image
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
	@i686-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

clean: clean_subdirs
clean_subdirs:
	@for d in ${SUBDIRS}; do make -C $$d -f ../root.mk clean; done

test: test_subdirs
test_subdirs:
	@for d in ${SUBDIRS}; do make -C $$d -f ../root.mk test.quiet; done

valgrind: valgrind_subdirs
valgrind_subdirs:
	@for d in ${SUBDIRS}; do make -C $$d -f ../root.mk valgrind.quiet; done