Makefile: add .c files as prerequisites where needed
[glg-os.git] / Makefile
blob6e9c4b55e647076782eb4d3aabc316c2225fe00f
1 TGT = i686-elf
2 CC = $(TGT)-gcc
3 AS = $(TGT)-as
4 INCS = -I.
5 FLAGS := -O2 -ffreestanding
6 CFLAGS += -std=gnu99
7 CFLAGS += -Wall -Wextra -pedantic
8 CFLAGS += -Werror -pedantic-errors
9 CFLAGS += $(FLAGS)
10 LFLAGS := -T linker.ld -nostdlib
11 LFLAGS += $(FLAGS)
14 os.bin: boot.o kernel.o
15 $(CC) $(LFLAGS) -o os.bin terminal.o utils.o boot.o kernel.o
17 boot.o:
18 $(AS) boot.s -o boot.o
20 kernel.o: terminal.o kernel.c
21 $(CC) $(CFLAGS) -c kernel.c -o kernel.o
23 terminal.o: utils.o terminal.c
24 $(CC) $(CFLAGS) -c terminal.c -o terminal.o
26 utils.o: utils.c
27 $(CC) $(CFLAGS) -c utils.c -o utils.o
29 clean:
30 rm -rf iso/
31 rm -rf *.iso
32 rm -rf *.o
33 rm -rf *.bin
36 iso: os.bin
37 mkdir -p iso/boot/grub
38 cp os.bin iso/boot
39 cp grub.cfg iso/boot/grub
40 grub-mkrescue -o os.iso iso/