forked from pdomins/SO_TP2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
40 lines (31 loc) · 1.03 KB
/
Makefile
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
40
include Makefile.inc
KERNEL=kernel.bin
SOURCES=$(wildcard *.c)
DRIVERS=$(wildcard drivers/*.c)
INTERRUPTIONS=$(wildcard interruptions/*.c)
UTILITIES=$(wildcard utilities/*.c)
LIBRARIES=$(wildcard libraries/*.c)
SOURCES_ASM=$(wildcard asm/*.asm)
OBJECTS=$(SOURCES:.c=.o)
OBJECTS_DRIVERS=$(DRIVERS:.c=.o)
OBJECTS_INTERRUPTIONS=$(INTERRUPTIONS:.c=.o)
OBJECTS_UTILITIES=$(UTILITIES:.c=.o)
OBJECTS_LIBRARIES=$(LIBRARIES:.c=.o)
OBJECTS_ASM=$(SOURCES_ASM:.asm=.o)
LOADERSRC=loader.asm
#MM=-D BUDDY_MM
MM=-D FREE_LIST_MM
LOADEROBJECT=$(LOADERSRC:.asm=.o)
STATICLIBS=
all: $(KERNEL)
$(KERNEL): $(LOADEROBJECT) $(OBJECTS) $(STATICLIBS) $(OBJECTS_ASM) $(OBJECTS_DRIVERS) $(OBJECTS_INTERRUPTIONS) $(OBJECTS_UTILITIES) $(OBJECTS_LIBRARIES)
$(LD) $(LDFLAGS) -T kernel.ld -o $@ $^
%.o: %.c
$(GCC) $(GCCFLAGS) -I./include $(MM) -c $< -o $@
%.o : %.asm
$(ASM) $(ASMFLAGS) $< -o $@
$(LOADEROBJECT):
$(ASM) $(ASMFLAGS) $(LOADERSRC) -o $(LOADEROBJECT)
clean:
rm -rf asm/*.o *.o *.bin drivers/*.o interruptions/*.o utilities/*.o libraries/*.o
.PHONY: all clean