Automatically generate syscalls.h and syscalls.c as well
[monolithium.git] / Makefile
1 .PHONY: all clean crt kernel library manager tests generate
2
3 GENERATED_SOURCES = sdk/syscall_enum.h kernel/src/syscall_table.inl library/src/wrappers.c
4
5 all: livecd.iso tests
6
7 crt:
8         $(MAKE) -C crt all
9
10 kernel: generate crt
11         $(MAKE) -C kernel all
12
13 library: generate crt
14         $(MAKE) -C library all
15
16 manager: library
17         $(MAKE) -C manager all
18
19 tests:
20         $(MAKE) -C tests all
21
22 generate: $(GENERATED_SOURCES)
23
24 sdk/syscall_enum.h: $(wildcard sdk/*.h) syscalls.awk
25         @echo 'Generating system call sources/headers...'
26         sort sdk/* | awk -v enum_file=sdk/syscall_enum.h -v table_file=kernel/src/syscall_table.inl -v wrappers_file=library/src/wrappers.c -f syscalls.awk
27
28 kernel/src/syscall_table.inl: sdk/syscall_enum.h
29
30 library/src/wrappers.c: sdk/syscall_enum.h
31
32 livecd.iso: kernel library manager
33         mkdir -p livecd/boot/grub
34         cp kernel/monolithium livecd/boot/monolithium
35         cp manager/manager livecd/manager
36         cp grub.cfg livecd/boot/grub/grub.cfg
37         grub-mkrescue -o $@ livecd
38
39 clean:
40         $(MAKE) -C crt clean
41         $(MAKE) -C kernel clean
42         $(MAKE) -C library clean
43         $(MAKE) -C manager clean
44         $(MAKE) -C tests clean
45         rm -f $(GENERATED_SOURCES) livecd.iso