This repository has been archived by the owner on Jun 23, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
.sources
110 lines (101 loc) · 3.48 KB
/
.sources
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/* Copyright (c) 2017 Griefer@Work *
* *
* This software is provided 'as-is', without any express or implied *
* warranty. In no event will the authors be held liable for any damages *
* arising from the use of this software. *
* *
* Permission is granted to anyone to use this software for any purpose, *
* including commercial applications, and to alter it and redistribute it *
* freely, subject to the following restrictions: *
* *
* 1. The origin of this software must not be misrepresented; you must not *
* claim that you wrote the original software. If you use this software *
* in a product, an acknowledgement in the product documentation would be *
* appreciated but is not required. *
* 2. Altered source versions must be plainly marked as such, and must not be *
* misrepresented as being the original software. *
* 3. This notice may not be removed or altered from any source distribution. *
*/
#define __STATIC_LIBGCC \
LIBPATH(CONFIG_GCC_LIBPATH) \
LIB("gcc") C_FLAGS("-static-libgcc")
#define __NOSTDLIB \
C_FLAGS("-nostdlib") \
L_FLAGS("-nostdlib")
/* Pre-defined project types:
* >> BEGIN APPLICATION("my_app")
* >> SET_OUTPUT("/bin/apps/my_app")
* >> SET_DISKFILE("/bin/my_app")
* >>
* >> SOURCE("/apps/my_app/*.c")
* >> END
*/
#define ARCHIVE(name) \
PROJECT(name) \
SET_ARCHIVER("ar")
#define LIBRARY(name) \
PROJECT(name) \
__NOSTDLIB \
__STATIC_LIBGCC \
L_FLAGS("-shared") \
C_FLAGS("-fPIC")
#define APPLICATION_NOSTDLIB(name) \
PROJECT(name) \
__NOSTDLIB \
__STATIC_LIBGCC
#define APPLICATION(name) \
APPLICATION_NOSTDLIB(name) \
LIBPATH(CONFIG_LIB_PATH) \
LIB("c") \
PROJ_DEP("libc") \
PROJ_DEP("_start") \
OBJECT(CONFIG_LIB_PATH "/crt0.o")
#ifdef TARGET_X86_64
/* XXX: Technically, `--nmagic' would work better (because KOS doesn't care for
* segment alignments), but that seems to break compile-time dynamic linking... */
# define __MODULE_FIX L_FLAGS("-z","max-page-size=0x1000")
#else
# define __MODULE_FIX /* nothing */
#endif
#define MODULE_NOSTDLIB(name) \
PROJECT(name) \
__STATIC_LIBGCC \
__NOSTDLIB \
__MODULE_FIX \
L_FLAGS("--shared") \
C_FLAGS("-fPIC") \
LINKER_SCRIPT("/src/arch/" CONFIG_TARGET_NAME "/module.ld")
#define STATIC_MODULE(name) \
MODULE_NOSTDLIB(name) \
PROJ_DEP("kernel") \
STATIC_SYMBOLS(run_kernel_binary)
#define MODULE(name) \
MODULE_NOSTDLIB(name) \
LIBPATH("/bin/mod")
/* Define some default macros for the platform */
DEFINE("__KOS__")
DEFINE("__ELF__")
INCLUDE("/include")
INCLUDE("/include/" CONFIG_TARGET_NAME)
C_FLAGS("-nostdlib")
P_FLAGS("-nostdlib")
/* Configure default warning behavior. */
C_FLAGS("-ffreestanding")
C_FLAGS("-Wall")
C_FLAGS("-Wextra")
C_FLAGS("-Wno-nonnull-compare")
C_FLAGS("-Wno-comment")
C_FLAGS("-Wno-strict-aliasing")
C_FLAGS("-Wno-unused-parameter") /* TODO: Remove me */
#ifdef TARGET_I386
C_FLAGS("-m32")
P_FLAGS("-m32")
#endif
if (config_debug) {
C_FLAGS("-fstack-protector-strong")
C_FLAGS("-g")
}
#include "apps/.sources"
#include "libs/.sources"
#include "src/.sources"
#include "misc/.sources"