-
Notifications
You must be signed in to change notification settings - Fork 21
/
Makedefs
45 lines (34 loc) · 1.54 KB
/
Makedefs
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
UNAME_S := $(shell uname -s)
NASM := nasm
NASM_FLAGS := -Werror -p$(TOPDIR)/include/macros.asm
MODULE_DIR := $(TOPDIR)/modules
GITVER := $(shell git rev-parse HEAD)
# The normal swift compiler
SWIFT := swift
# The path to the kernel-lib swift compiler
KSWIFTDIR := $(shell echo ~/kstdlib-20190906)
KSWIFT := $(KSWIFTDIR)/usr/bin/swift
KSWIFTC := $(KSWIFTDIR)/usr/bin/swiftc
KSWIFTLIBDIR := $(KSWIFTDIR)/usr/lib/swift_static/linux
KSWIFTLIBS := $(KSWIFTLIBDIR)/libswiftCore.a $(KSWIFTLIBDIR)/x86_64/swiftrt.o
KSWIFTC_FLAGS := -gnone -Xfrontend -disable-red-zone -Xcc -mno-red-zone -Xfrontend -mcode-model=kernel -Xcc -mcmodel=kernel -parse-as-library -import-objc-header $(TOPDIR)/include/kernel.h -warnings-as-errors -Xcc -Wall -Xcc -Wextra -Xcc -std=gnu11 -Xfrontend -warn-long-function-bodies=60000 -DKERNEL -Xcc -DKERNELLIB=1
CC := $(KSWIFTDIR)/usr/bin/clang
CFLAGS := -ggdb -Wall -std=gnu11 -Wextra -Werror -fno-builtin -fno-stack-protector -fno-omit-frame-pointer -fno-common -mno-red-zone -mcmodel=kernel -I$(TOPDIR)/include
ifndef USE_FP
CFLAGS := $(CFLAGS) -mno-mmx -mno-sse -mno-sse2 -ffreestanding
KSWIFTC_FLAGS := $(KSWIFTC_FLAGS) -Xcc -mno-mmx -Xcc -mno-sse -Xcc -mno-sse2 -Xcc -ffreestanding -Xcc -mcmodel=kernel
endif
ifdef BUILD_ONONE
KSWIFTC_FLAGS += -Onone
KSWIFTLIBS += $(KSWIFTLIBDIR)/libswiftSwiftOnoneSupport.a
else
KSWIFTC_FLAGS +=-Osize -Xcc -O3
CFLAGS += -O3
endif
NASM_OBJ_FLAGS := -felf64
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
%.o: %.asm
$(NASM) $(NASM_FLAGS) $(NASM_OBJ_FLAGS) -o $@ $<
%.bin: %.asm
$(NASM) $(NASM_FLAGS) -fbin -o $@ $<