forked from ckaestne/TypeChef-LinuxAnalysis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jcpp.sh
executable file
·58 lines (40 loc) · 1.23 KB
/
jcpp.sh
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/bash -e
#!/bin/bash -vxe
#javaOpts='-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1044'
javaOpts=''
javaOpts='$javaOpts -Xmx4G -Xms128m -Xss10m'
# For Java compiled stuff!
basePath=.
#mainClass="org.anarres.cpp.Main"
mainClass="de.fosd.typechef.Frontend"
# Brute argument parsing
# The right thing to do would be to be a gcc replacement, parse its flags and
# select the ones we care about.
if [ $# -lt 1 ]; then
echo "Not enough arguments!" >&2
exit 1
fi
inp=$1
shift
if [ -z "$inp" ]; then
echo "inp not defined!" >&2
exit 1
fi
outBase="$(dirname $inp)/$(basename $inp .c)"
outDbg="$outBase.dbg"
outErr="$outBase.err"
outTime="$outBase.time"
# Beware: the embedded for loop requotes the passed argument. That's dark magic,
# don't ever try to touch it. It simplifies your life as a user of this program
# though!
echo "==Partially preprocessing $inp"
echo $partialPreprocFlags
#cmdline="/local/ifdeftoif/TypeChef/typechef.sh \
#cmdline="../TypeChef/typechef.sh \
cmdline="/local/ifdeftoif/TypeChef/typechef.sh \
$(for arg in $partialPreprocFlags "$@"; do echo -n "\"$arg\" "; done) \
'$inp' 2> '$outErr' |tee '$outDbg'"
echo $cmdline
bash -c "time $cmdline" \
2> "$outTime" || true
cat "$outErr" 1>&2