Skip to content

Commit e35a014

Browse files
committed
scons variables
1 parent afd8ece commit e35a014

File tree

10 files changed

+40
-2
lines changed

10 files changed

+40
-2
lines changed

c/interactive/subnormal.c

+4
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,9 @@ int main(void) {
7070
assert(0.0f < smallest_subnormal);
7171
assert(!isnormal(smallest_subnormal));
7272

73+
/* Check that we can add two submormals. */
74+
float smallest_subnormal_2x = smallest_subnormal + smallest_subnormal;
75+
assert(lkmc_float32_equal(smallest_subnormal_2x, 0, 0, 2));
76+
7377
return EXIT_SUCCESS;
7478
}

scons/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Tested on SCons v2.3.0.
2424
1. [Install](install/)
2525
1. Compiler parameters
2626
1. [Define](define/)
27-
1. [CFLAGS](cflags/)
27+
1. [CCFLAGS](ccflags/)
2828
1. Infrastructure
2929
1. [test](test)
3030
1. [clean](clean)
File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
env = Environment()
22
std = ARGUMENTS.get('std', 'c99')
3-
env.Append(CCFLAGS=('-std=' + std))
43
env.Append(CCFLAGS='-Werror')
4+
env.Append(CCFLAGS=('-std=' + std))
55
env.Program(target='main.out', source=['main.c'])
File renamed without changes.
File renamed without changes.

scons/variables/README.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Variables
2+
3+
How to use `Variables` for setting command line variables and `Help`.
4+
5+
Try out help with:
6+
7+
scons -h
8+
scons -H

scons/variables/SConstruct

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
variables = Variables(None, ARGUMENTS)
2+
variables.Add('X', 'Value of X', 1)
3+
variables.Add('Y', 'Value of Y', 2)
4+
env = Environment(variables=variables)
5+
env.Append(CPPDEFINES={
6+
'X': '${X}',
7+
'Y': '${Y}',
8+
})
9+
env.Program(
10+
source=['main.c'],
11+
target='main.out',
12+
)
13+
Help(variables.GenerateHelpText(env))

scons/variables/main.c

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
int main(void) {
2+
return X + Y;
3+
}

scons/variables/test

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env bash
2+
set -eu
3+
scons --clean
4+
scons
5+
./main.out
6+
[ $? = 3 ]
7+
scons --clean
8+
scons X=3 Y=4
9+
./main.out
10+
[ $? = 7 ]

0 commit comments

Comments
 (0)