File: stubcc

package info (click to toggle)
ocamlnet 4.1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 51,764 kB
  • ctags: 16,446
  • sloc: ml: 148,419; ansic: 10,989; sh: 1,885; makefile: 1,355
file content (49 lines) | stat: -rwxr-xr-x 910 bytes parent folder | download | duplicates (5)
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
#! /bin/sh

# usage:
# stubcc [-I<dir> ...] file.c

set -e

# Look at the arguments:
ccopt=""
file=""
ocamlc="ocamlc"
while [ $# -gt 0 ]; do
    case "$1" in
	-ccopt)
		ccopt="$ccopt $2"; shift 2 ;;
	-ocamlc)
	        ocamlc="$2"; shift 2 ;;
	-*)
		ccopt="$ccopt $1"; shift ;;
	*.c)
		file="$1"; shift ;;
	*)
		echo "Don't know what to do with: $1"; exit 1 ;;
    esac
done

system=`$ocamlc -config | grep system | sed -e 's/system: //'`
version=`$ocamlc -version`

case "$version" in
        3.09|3.09.*|3.10|3.10.*)
		case "$system" in
			mingw*)
				bfile=`basename "$file" .c`
				dfile=`dirname "$file"`
				$ocamlc -verbose -c -ccopt "$ccopt" -ccopt -DCAML_DLL "$file"
				mv "$dfile/$bfile.o" "$dfile/$bfile.d.o"
				$ocamlc -verbose -c -ccopt "$ccopt" "$file"
				;;
			*)
				$ocamlc -verbose -c -ccopt "$ccopt" "$file" 
				;;
		esac
		;;
	*)
		$ocamlc -verbose -c -ccopt "$ccopt" "$file"
		;;
esac