summaryrefslogtreecommitdiff
path: root/Makefile
blob: 90ffa6c78dffcf8d99703fcafe738538c1193968 (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
NAME            = kfs
SRC             = $(wildcard src/*.c src/crt0.S)

LDSCRIPT        = kfs.ld

CPPFLAGS       +=
LDFLAGS        += -T $(LDSCRIPT) -nostdlib -Wl,--build-id=none -m32
CFLAGS         += -W -Wall -Wextra -std=gnu99 -g \
                  -nostdinc -fno-builtin -fno-stack-protector -m32
QEMUFLAGS       =

CC              = gcc
QEMU            = qemu-system-i386

OBJ             = $(SRC:.c=.o)

all: $(NAME)

$(NAME): $(OBJ) $(LDSCRIPT)
	$(CC) -o $@ $^ $(LDFLAGS)

clean:
	$(RM) $(OBJ)
	$(RM) $(NAME)

mrproper: clean

distclean: mrproper
	$(RM) $(addsuffix ~,$(SRC))
	$(RM) $(wildcard $(addsuffix .sw*,$(addprefix .,$(SRC))))

boot: all
	$(QEMU) -kernel $(NAME) $(QEMUFLAGS)

debug: all
	$(QEMU) -kernel $(NAME) -s -S $(QEMUFLAGS)

.PHONY: all clean mrproper distclean boot