File: make-package

package info (click to toggle)
coq-stdpp 1.11.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 1,696 kB
  • sloc: makefile: 52; sh: 35; sed: 1
file content (41 lines) | stat: -rwxr-xr-x 1,203 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
#!/bin/sh
set -e
# Helper script to build and/or install just one package out of this repository.
# Assumes that all the other packages it depends on have been installed already!

# Make sure we get a GNU version of make.
# This is exactly how opam determines which make executable to use.
OS=$(uname)
MAKE="make"
if [ $OS == "FreeBSD" ] || [ $OS == "OpenBSD" ] ||\
       [ $OS == "NetBSD" ] || [ $OS == "DragonFly" ]; then
    MAKE="gmake"
fi

PROJECT="$1"
shift

COQFILE="_CoqProject.$PROJECT"
MAKEFILE="Makefile.package.$PROJECT"

if ! grep -E -q "^$PROJECT/" _CoqProject; then
    echo "No files in $PROJECT/ found in _CoqProject; this does not seem to be a valid project name."
    exit 1
fi

# Generate _CoqProject file and Makefile
rm -f "$COQFILE"
# Get the right "-Q" line.
grep -E "^-Q $PROJECT[ /]" _CoqProject >> "$COQFILE"
# Get everything until the first empty line except for the "-Q" lines.
sed -n '/./!q;p' _CoqProject | grep -E -v "^-Q " >> "$COQFILE"
# Get the files.
grep -E "^$PROJECT/" _CoqProject >> "$COQFILE"
# Now we can run coq_makefile.
"${COQBIN}coq_makefile" -f "$COQFILE" -o "$MAKEFILE"

# Run build
$MAKE -f "$MAKEFILE" "$@"

# Cleanup
rm -f ".$MAKEFILE.d" "$MAKEFILE"*