-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathElitefile_Example
126 lines (90 loc) · 2.84 KB
/
Elitefile_Example
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
required_version is 0.1
set ProjectName as "Elite"
set COMPILER as "gcc"
set fn as "for"
set commandline as "argument"
set echo as "println"
set make_arg as "make"
set Linux as "linux"
set FreeBSD as "freebsd"
set HOME as env "HOME"
set COMPILER_PATH as "/usr/bin/{COMPILER}"
set LINKS as link "stdc++fs"
set STANDARD as std "c++17"
set OUTPUT as outfile "example"
set sources as "example.cpp"
use add_source sources "test.cpp"
# Start signal
$fn signal "start" [
print "CPU Architecture: "
for specific "x86" [ println "x86" ]
for specific "x86_64" [ println "x86_64" ]
for specific "mips" [ println "mips" ]
for specific "powerpc" [ println "powerpc" ]
for specific "powerpc64"[ println "powerpc64" ]
for specific "arm" [ println "arm" ]
for specific "aarch64" [ println "aarch64" ]
use append ProjectName "build"
$echo "test.cpp file added: {sources}"
$echo "Hello, {ProjectName}!"
println "Default compiler is: {COMPILER}"
println suppress "Suppressed stdout."
use exec suppress "echo Suppressed syscall"
set echo as "print"
$echo "Huh!"
set echo as "println"
# Prints newline
$echo
$echo $HOME
if eq "{ProjectName}" "Elitebuild" [
println "ProjectName checked."
]
if uneq "{COMPILER}" "gcc" [
println "Your compiler seemsly not GCC, unoptimized."
]
if uneq "{HOME}" env "PWD" [
println "Current directory isn't {HOME}!"
print "Current dir is: " println env "PWD"
]
# You can also use $ProjectName instead of formatter
# Platform-specific functions.
$fn specific "{Linux}" [
for exists "{COMPILER_PATH}" [
println "Compiler path found: {COMPILER_PATH} {LINKS} {STANDARD} {OUTPUT}"
]
println "Linux-based"
]
for $commandline "{make_arg}" [
println "There's nothing to do."
]
for argument "hi" [
println "Hi!"
]
for specific "{FreeBSD}" [
println "{FreeBSD}"
]
# for argument("make") [
# for specific("linux") [
# use commandline(
# $COMPILER,
# $arguments,
# $flags
# )
# print "hello, world"
#
# use commandline(
# "echo",
# "hello, world"
# )
# ]
# ]
set gech as "gech"
println $gech
unset gech
print $gech
# {...} default formatter
for specific "{Linux}" [ use exec "echo Hello, Elitebuild from syscall! (for Linux-based)" ]
for specific "{FreeBSD}" [ use exec "echo Hello, Elitebuild from syscall! (for FreeBSD)" ]
for specific "{Linux}" [ use exec "uname --a" ]
for specific "linux" [ use signal "exit" ]
]