forked from spevans/swift-project1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makedefs
44 lines (33 loc) · 1.26 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
UNAME_S := $(shell uname -s)
CC := clang
CFLAGS := -Wall -std=gnu11 -Wextra -Werror -fno-builtin -fno-stack-protector -fno-common -mno-red-zone -I$(TOPDIR)/include
NASM := nasm
NASM_FLAGS := -Werror -p$(TOPDIR)/include/macros.asm
MODULE_DIR := $(TOPDIR)/modules
# The normal swift-3 compiler
SWIFT3DIR := $(shell readlink -f ~/swift-3)
SWIFT3C := $(SWIFT3DIR)/usr/bin/swiftc
# The path to the kernel-lib swift compiler
SWIFTDIR := $(shell readlink -f ~/swift-kernel)
SWIFT := $(SWIFTDIR)/usr/bin/swift
SWIFTC := $(SWIFTDIR)/usr/bin/swiftc
SWIFTLIB := $(SWIFTDIR)/usr/lib/swift_static/linux/libswiftCore.a
SWIFTC_FLAGS := -gnone $(OPTO_FLAG) -Xfrontend -disable-red-zone -Xcc -mno-red-zone -parse-as-library -import-objc-header $(TOPDIR)/include/kernel.h -I$(MODULE_DIR) -warnings-as-errors
ifndef USE_FP
CFLAGS := $(CFLAGS) -mno-mmx -mno-sse -mno-sse2
SWIFTC_FLAGS := $(SWIFTC_FLAGS) -Xcc -mno-mmx -Xcc -mno-sse -Xcc -mno-sse2
endif
ifdef BUILD_ONONE
SWIFTC_FLAGS += -Onone
SWIFTLIB += $(SWIFTDIR)/usr/lib/swift_static/linux/libswiftSwiftOnoneSupport.a
else
SWIFTC_FLAGS +=-O
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 $@ $<