summaryrefslogtreecommitdiff
path: root/Makefile
blob: 3ccecb122c2dddac3dc5931156253ad216b8e934 (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
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

CC              = gcc

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

all: $(NAME)

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

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

mrproper: clean

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

boot: all
	$(shell qemu-system-x86_64 -kernel $(NAME) -nographic)

debug: all
	$(shell qemu-system-x86_64 -kernel $(NAME) -s -S)

.PHONY: all clean mrproper distclean boot