summaryrefslogtreecommitdiff
path: root/Makefile
blob: 66da24e400008bb2762d1b90e904fe314b2caf76 (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
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)
	$(CC) -o $@ $^ $(LDFLAGS)

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

mrproper: clean

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

boot: all
	qemu-system-i386 -kernel $(NAME)

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

.PHONY: all clean mrproper distclean boot