summaryrefslogtreecommitdiff
path: root/kernel/Makefile
blob: c6cf24e5df2cd66375a61aaab7305564528f2504 (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
TARGET = kernel.o

SRCS = $(wildcard *.c)
ASMS = $(wildcard *.s)
OBJS = $(SRCS:.c=.o) $(ASMS:.s=.o)

CFLAGS = -m32 -I../include -ffreestanding -nostdinc -nostdlib -fno-stack-protector -fno-pie -gstabs+
LDFLAGS = -m elf_i386 -r
ASMFLAGS = -f elf32

CC = gcc $(CFLAGS)
LD = ld $(LDFLAGS)
ASM = nasm $(ASMFLAGS)

all: build

build: $(TARGET)

.s.o:
	$(ASM) -o $*.o $^

.c.o:
	$(CC) -c -o $*.o $^

$(TARGET): $(OBJS)
	$(LD) -o $(TARGET) $(OBJS)

clean:
	rm -f $(OBJS)
	rm -f $(TARGET)