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

Last change on this file since 725 was 725, checked in by lou, 12 years ago

Changes to build ASL on Solaris / x86. Introduce compile_Unix_ASL.in. Tweaks to
eliminate comptry.bat in compile_MS_ASL.in; solves problem with cygwin / cl.

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