source: ThirdParty/ASL/trunk/compile_MS_ASL.in @ 1871

Last change on this file since 1871 was 1269, checked in by andreasw, 11 years ago

make sure an error causes make to stop when compile_* script commands file

  • Property svn:executable set to *
File size: 2.1 KB
Line 
1#!/bin/sh
2
3set -e
4
5# Script to compile the Ampl Solver Library using cl/link. Why this approach?
6# Well, we don't want to get into the business of creating (and maintaining)
7# the full set of autotools source files for the ASL. This approach tries to
8# leverage makefile.vc, which comes with ASL.
9
10# To support VPATH builds, the strategy is to copy the sources to the build
11# directory, build, and then erase the sources when we're done. Start by
12# copying the sources.
13
14# set -x
15mkinstalldirs="@install_sh@ -d"
16abs_source_dir=@abs_source_dir@
17compdir=compdir
18
19rm -rf $compdir
20$mkinstalldirs $compdir
21files=`cd $abs_source_dir/solvers; ls *.[chs] *.[ch]0 *.hd arith.* makefile* *.bat amplsolv.lbc`
22cd $compdir
23for file in $files
24do
25  cp $abs_source_dir/solvers/$file $file;\
26done
27
28# Acquire the cl version and create details.c
29# (This is not doing to right thing if we are using the Microsoft compiler)
30
31clver=`cl 2>&1 | egrep '^Microsoft' | sed -e 's/.*Version \(.*\)/\1/'`
32clver="Microsoft cl $clver"
33
34sed -e "s/System_details/$clver/" details.c0 > details.c
35
36# Adjust solvers/makefile.vc for the situation at hand. When building with cl
37# under cygwin, we can't execute comptry.bat. The sole purpose of comptry.bat
38# is to retry the compile with -DNO_LONG_LONG in an environment where long long
39# does not exist. Since we've already tested for long long in configure and set
40# ASLMAKEFLAGS accordingly, we can discard comptry.bat without worry.
41
42sed -e 's/comptry\.bat \$(CC)/$(CC)/' makefile.vc > makefile.coin
43
44# Do the build. CFLAGS specified on the command line (as a result of autoconf
45# replacing ASLMAKEFLAGS) will override the specs in makefile.vc, ensuring that
46# ASL is built with the same compiler flags as other code. Makefile.vc also
47# forces CC=cl, but since Coin only uses makefile.vc for the cl compiler,
48# there's no need to override it here.
49
50# It turns out that Gnu make always sets MAKEFLAGS to --unix, and nmake tries
51# to process this, resulting in error U1065. Clear MAKEFLAGS to fix the
52# problem.
53
54libampl=@AMPLSOLVER_A@
55MAKEFLAGS=
56nmake -f makefile.coin @ASLMAKEFLAGS@ CC="@CC@"
57mv amplsolv.lib ../$libampl
58mv stdio1.h arith.h funcadd0.obj ..
59cd ..
60rm -rf $compdir
Note: See TracBrowser for help on using the repository browser.