source: ThirdParty/ASL/trunk/compile_Unix_ASL.in @ 781

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

Uncomment removal of compdir. Minor typo.

  • Property svn:executable set to *
File size: 3.0 KB
Line 
1#!/bin/sh
2
3# Script to compile the Ampl Solver Library on Unix systems. 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.u, 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
17# Remove the old compilation directory, if present, and create a new one. Then
18# copy the sources. The wildcards given to ls will produce duplicates, which
19# may result in a warning as the files are linked or copied.
20
21rm -rf $compdir
22$mkinstalldirs $compdir
23files=`cd $abs_source_dir/solvers ; ls *.[chs] *.[ch]0 *.hd arith.* makefile* *.bat amplsolv.lbc`
24
25cd $compdir
26for file in $files ; do
27  rm -f $file
28  @LN_S@ $abs_source_dir/solvers/$file $file
29done
30
31# Acquire the system details.
32
33sys_details=`uname -sr`
34
35sed -e "/sysdetails_ASL/s/System_details/$sys_details/" details.c0 > details.c
36
37# Adjust solvers/makefile.u for the system at hand. Really all we're doing
38# is trying to automate the instructions in makefile.u. If you have build
39# problems, a good thing to do is compare the shell code here with makefile.u,
40# to see if it contains instructions that are not automated here. The final
41# result is left in makefile.coin
42
43# Allow make to decide the name of the archive program and the appropriate
44# flags. makefile.u hardwires `ar' and sets ARFLAGS = ruv. Since we trash the
45# entire build and start from scratch, the `u' in ruv stands for `useless'.
46
47sed -e 's/\<ar\>/\$(AR)/g' \
48    -e 's/^ARFLAGS =/# ARFLAGS =/' < makefile.u > makefile.coin
49
50# If we're in a fake unix environment on a Windows box, the default compiler
51# output file is a.exe, not a.out.
52
53if test "x@EXEEXT@" = "x.exe" ; then
54  sed -e 's/a\.out/a.exe/' < makefile.coin > makefile.coin.tmp
55  mv makefile.coin.tmp makefile.coin
56fi
57
58# System-specific tweaks.
59# On Solaris x86, we need to build fpsetprec.s. Add it to the dependency list
60# for amplsolver.a
61# In the original configure.ac, there was a case here that adjusted the
62# makefile.u rule that builds details.c from details.c0. We've done that
63# above. Also, the edit rule in the original configure.ac didn't match the
64# text in makefile.u. So I'm going to leave it out and see what breaks.
65# -- lh, 071019 --
66
67case "@build@" in
68  *86-*-solaris*)
69    sed -e 's/^amplsolver.a:/amplsolver.a: fpsetprec.s/' \
70      < makefile.coin > makefile.coin.tmp
71    mv makefile.coin.tmp makefile.coin
72    ;;
73esac
74
75# That's it, we can do the build.
76# A last detail: makefile.u will try to force CC=cc. We need to make sure
77# that we stay with our chosen compiler. It will try and force CFLAGS, too, but
78# configure has already put the appropriate information into ASLMAKEFLAGS.
79
80make -f makefile.coin @ASLMAKEFLAGS@ CC="@CC@"
81mv amplsolver.a ../$libampl
82mv stdio1.h arith.h funcadd0.@OBJEXT@ ..
83cd ..
84rm -rf $compdir
85
Note: See TracBrowser for help on using the repository browser.