File: scafc

package info (click to toggle)
pdp 1%3A0.14.1%2Bdarcs20180201-6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 3,228 kB
  • sloc: ansic: 22,424; asm: 2,088; makefile: 537; perl: 145; sh: 108; cpp: 4
file content (43 lines) | stat: -rwxr-xr-x 696 bytes parent folder | download
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
#!/bin/sh
#scaf->scafo compiler

if [ -z "$1" ]; then
	echo
	echo "scaf rules compiler"
	echo "usage:"
	echo "    scafc source [dest]"
	echo
	exit 0
fi

if [ -z "$2" ]; then
	DEST=$1o
else
	DEST=$2
fi

if ! test -f $1
then
	echo "source module $1 not found."
	exit 1
fi

SCAFDIR=`dirname $0`
if ! test -f $SCAFDIR/scafc.pl;
then
	SCAFDIR=`dirname $SCAFDIR`
	SCAFDIR="$SCAFDIR/lib/scaf"
	if ! test -f $SCAFDIR/scafc.pl
	then
		echo "scaf library not found in $SCAFDIR"
		exit 1
	fi
fi

TMP_S=`mktemp --suffix .S`
$SCAFDIR/scafc.pl -I$SCAFDIR $1 > $TMP_S \
&& cat $TMP_S \
&& gcc -x assembler-with-cpp -I$SCAFDIR -shared -o $DEST $TMP_S \
&& strip --strip-unneeded $DEST \
&& rm $TMP_S \
|| exit 1