forked from klange/taylor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
52 lines (38 loc) · 991 Bytes
/
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
# Taylor - Swift on bare metal
include util/util.mk
ARCH=i686
TARGET=${ARCH}-pc-none-elf
SWIFTC = swiftc
CC = clang-3.8
SWIFTFLAGS = -emit-ir -parse-as-library
CFLAGS = --target=${TARGET} -ffreestanding -Wno-override-module
YASM = yasm -f elf
LD = ld
OBJS = $(patsubst %.c,%.o,$(wildcard src/*.c))
OBJS += $(patsubst %.c,%.o,$(wildcard src/*/*.c))
OBJS += $(patsubst %.s,%.o,$(wildcard src/*.s))
OBJS += $(patsubst %.swift,%.o,$(wildcard src/*.swift))
OBJS += $(patsubst %.swift,%.o,$(wildcard src/*/*.swift))
all: taylor-kernel
taylor-kernel: ${OBJS}
@${BEG} "LD" $@
@${LD} -m elf_i386 -T link.ld -o $@ ${OBJS}
@${END} "LD" $@
%.o: %.swift
@${BEG} "SWIFT" $<
@${SWIFTC} ${SWIFTFLAGS} $< -o ${@:.o=}.ll
@${CC} ${CFLAGS} -c ${@:.o=}.ll -o $@
@${END} "SWIFT" $<
%.o: %.c
@${BEG} "CC" $<
@${CC} ${CFLAGS} -c $< -o $@
@${END} "CC" $<
%.o: %.s
@${BEG} "YASM" $<
@${YASM} -o $@ $<
@${END} "YASM" $<
.PHONY: clean
clean:
@-rm src/*.o
@-rm src/*.ll
@-rm taylor-kernel