summaryrefslogtreecommitdiff
path: root/src/stem/Makefile
blob: 94e2000a32ef443f32d931e7f6d97a52e64a5fa1 (plain) (blame)
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
CC = gcc
CFLAGS = -nostdlib -nostartfiles -nodefaultlibs -fno-builtin -fno-stack-protector -Wall -Wextra

LD = ld
LDFLAGS = -T link.ld

ASM = nasm
AFLAGS = -f elf

OBJECTS = loader_.o kmain.o sys.o \
		  monitor.o timer.o \
		  idt.o idt_.o task.o task_.o\
		  lib/stdlib.o lib/bitset.o \
		  mem.o paging.o gdt.o heap.o
OUT = stem.elf

all: $(OBJECTS)
	echo "* Linking $(OUT)..."
	$(LD) $(LDFLAGS) $(OBJECTS) -o $(OUT) -Map stem.map

clean:
	rm *.o || exit 0
	rm $(OBJECTS) || exit 0

mrproper: clean
	rm $(OUT)

%.o: %.asm
	echo "* Compiling $<..."
	$(ASM) $(AFLAGS) -o $@ $<
	
%.o: %.c
	echo "* Compiling $<..."
	$(CC) -c $< -o $@ $(CFLAGS)