-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
43 lines (33 loc) · 782 Bytes
/
Makefile
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
PROJ := k
TARGET := $(PROJ)
OBJS := kernel.o \
arch/loader.o \
arch/x86.o \
arch/arch.o \
arch/process.o \
arch/paging.o \
arch/screen.o \
arch/multitask.o \
lib/lib.o \
lib/memory.o \
lib/kprintf.o
CC := gcc
LD := ld
AS := nasm
CFLAGS := -std=c99 -m32 -nostdlib -nostartfiles -nodefaultlibs -nostdinc -fno-builtin -fno-stack-protector -I. -Ilib
LDFLAGS := -melf_i386 -T linker.ld
ASFLAGS := -f elf
.PHONY : build clean
all: image
build: $(TARGET).bin
$(TARGET).bin : $(OBJS)
$(LD) $(LDFLAGS) -o $@ $(OBJS)
.s.o:
$(AS) $(ASFLAGS) $<
image: $(TARGET).img
$(TARGET).img: $(TARGET).bin
cat grub/stage1 grub/stage2 grub/pad $(TARGET).bin > $(TARGET).img
clean :
@rm -fv *.img
@rm -fv *.bin
@rm -fv $(OBJS)