-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathMakefile
73 lines (55 loc) · 2.09 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
include .knightos/variables.make
AS=scas
OBJECTS=$(patsubst src/%.c,$(OUT)%.o,$(wildcard src/*.c))
OBJECTS+=$(patsubst src/knightos/%.c,$(OUT)knightos/%.o,$(wildcard src/knightos/*.c))
OBJECTS+=$(patsubst src/tios/%.c,$(OUT)tios/%.o,$(wildcard src/tios/*.c))
OBJECTS+=$(patsubst src/gpl/%.c,$(OUT)gpl/%.o,$(wildcard src/gpl/*.c))
OBJECTS+=$(patsubst src/%.asm,$(OUT)%.o,$(wildcard src/*.asm))
OBJECTS+=$(patsubst src/knightos/%.asm,$(OUT)knightos/%.o,$(wildcard src/knightos/*.asm))
OBJECTS+=$(patsubst src/tios/%.asm,$(OUT)tios/%.o,$(wildcard src/tios/*.asm))
OBJECTS+=$(patsubst src/gpl/%.asm,$(OUT)gpl/%.o,$(wildcard src/gpl/*.asm))
HEADERS=$(patsubst include/%.h,$(INC)%.h,$(wildcard include/*.h))
HEADERS+=$(patsubst include/knightos/%.h,$(INC)knightos/%.h,$(wildcard include/knightos/*.h))
HEADERS+=$(patsubst include/tios/%.h,$(INC)tios/%.h,$(wildcard include/tios/*.h))
HEADERS+=$(patsubst include/sys/%.h,$(INC)sys/%.h,$(wildcard include/sys/*.h))
HEADERS+=$(patsubst include/experimental/%.h,$(INC)experimental/%.h,$(wildcard include/experimental/*.h))
ALL_TARGETS:=$(SLIB)c $(HEADERS)
$(SLIB)c: dependencies $(OBJECTS)
mkdir -p $(SLIB)
scas -c $(OBJECTS) -o $(SLIB)c
$(INC)%.h: include/%.h
mkdir -p $(INC)
cp $< $@
$(INC)sys/%.h: include/sys/%.h
mkdir -p $(INC)sys/
cp $< $@
$(INC)experimental/%.h: include/experimental/%.h
mkdir -p $(INC)experimental/
cp $< $@
$(INC)knightos/%.h: include/knightos/%.h
mkdir -p $(INC)knightos/
cp $< $@
$(INC)tios/%.h: include/tios/%.h
mkdir -p $(INC)tios/
cp $< $@
include .knightos/sdk.make
$(OUT)%.o: src/%.asm
mkdir -p $(OUT)gpl/
$(AS) -c -I"$(INCLUDE)" -o $@ $<
$(OUT)gpl/%.o: src/gpl/%.asm
mkdir -p $(OUT)gpl/
$(AS) -c -I"$(INCLUDE)" -o $@ $<
$(OUT)gpl/%.o: $(OUT)gpl/%.asm
mkdir -p $(OUT)gpl/
$(AS) -c -I"$(INCLUDE)" -o $@ $<
$(OUT)%.o: $(OUT)gpl/%.asm
mkdir -p $(OUT)gpl/
$(AS) -c -I"$(INCLUDE)" -o $@ $<
$(OUT)%.o: $(OUT)%.asm
mkdir -p $(OUT)gpl/
$(AS) -c -I"$(INCLUDE)" -o $@ $<
$(OUT)%.asm: src/%.c $(HEADERS)
mkdir -p $(OUT)gpl/
mkdir -p $(OUT)knightos/
mkdir -p $(OUT)tios/
$(CC) -I.knightos/include/ -I./ -I./include/ -S --std-c99 $< -o $@