-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconfigure
More file actions
executable file
·57 lines (45 loc) · 1.12 KB
/
configure
File metadata and controls
executable file
·57 lines (45 loc) · 1.12 KB
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
#!/bin/sh -e
# PractRand configure script
#
# Accepts no arguments and only loads some defaults from environment
# variables. Example usage:
# $ CXX=g++ ./configure
# $ make -kj$(nproc)
# Or:
# $ CXX=g++ \
# CXXFLAGS='-ggdb3 -Og -fsanitize=address -fsanitize=undefined' \
# LDFLAGS='-fsanitize=address -fsanitize=undefined' \
# ./configure
# $ make -kj$(nproc)
CXX=${CXX:-c++}
CXXFLAGS=${CXXFLAGS:--std=c++14 -O3}
LDFLAGS=${LDFLAGS:-}
LDLIBS=${LDLIBS:-}
cat >Makefile <<EOF
.POSIX:
.SUFFIXES:
CXX = $CXX
CXXFLAGS = $CXXFLAGS
LDFLAGS = $LDFLAGS
LDLIBS = $LDLIBS
all: RNG_test
clean:
rm -f RNG_test \$(obj)
.SUFFIXES: .cpp .o
.cpp.o:
\$(CXX) -c -Iinclude -pthread \$(CXXFLAGS) -o \$@ \$<
EOF
for cpp in src/*.cpp src/RNGs/*.cpp src/RNGs/other/*.cpp tools/RNG_test.cpp; do
o="${cpp%*.cpp}".o
$CXX -Iinclude -pthread -MM -MT$o $cpp >>Makefile
obj="$(printf '%s \\\n %s' "$obj" $o)"
files="$files $o"
done
cat >>Makefile <<EOF
obj =$obj
RNG_test: \$(obj) Makefile
\$(CXX) -pthread \$(LDFLAGS) -o \$@ \$(obj) \$(LDLIBS)
EOF
for file in $files; do
printf '%s: Makefile\n' $file >>Makefile
done