source: trunk/Makefile @ 277

Last change on this file since 277 was 277, checked in by lou, 14 years ago

Revise cbc build process for better control of solvers included in build
(COIN_USE_XXX -> CBC_USE_XXX). Add CbcEventHandler? for independence from
clp.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.7 KB
Line 
1# Look at and if necessary edit the following files:
2# - ../Makefiles/Makefile.location
3# - Makefile.Cbc
4
5# Define variables here to select the solvers that you want to incorporate into
6# the cbc build. Be sure that the solvers are available and that the
7# information in Makefile.location is correct for all selected solvers.
8# Check Makefile.Cbc to specify the optimisation level of the build.
9
10# Compile-time configuration for Cbc. There are basically two options:
11# (1)
12# Build cbc to use only clp as the underlying lp solver. This is the most
13# efficient configuration if you wish to take full advantage of capabilities
14# supported by clp but not available through the standard OSI interface, and
15# you have no interest in experimenting with other solvers.
16# (2)
17# Build cbc so that it can use some mix of one or more OSI solvers, not
18# necessarily including clp. Use this option if you want to experiment with
19# other solvers.
20
21# To specify a solver, add the name to the list here. Use the name given in
22# Makefile.location, without the COIN_lib prefix, e.g., Clp, Cpx, Dylp, Glpk,
23# etc. The default build uses Clp only. To use Clp and Dylp, you would say
24# CBC_SOLVERS := Clp Dylp
25
26CBC_SOLVERS := Clp
27
28# Regardless of the number of solvers specified, it's a good idea to set the
29# default solver. (All right, the real reason is it'll take too long to explain
30# what happens if you don't. Check the code in CbcMain if you must know.)
31# This must match one of the solver names given above, but all in lower case
32# letters (don't ask).
33
34cbcDefaultSolver := clp
35
36###############################################################################
37
38# Bring on the boilerplate. Makefile.coin will bring in Makefile.<O/S> and
39# Makefile.location.
40
41export CoinDir := $(shell cd ..; pwd)
42export MakefileDir := $(CoinDir)/Makefiles
43include ${MakefileDir}/Makefile.coin
44
45# First check that all solvers specified by the user have been configured in
46# Makefile.location.
47
48cbcMissingSolvers := $(filter-out \
49        $(patsubst COIN_libOsi%,%,$(CoinLibsDefined)),$(CBC_SOLVERS))
50
51ifneq ($(cbcMissingSolvers),)
52  $(foreach solver,$(cbcMissingSolvers), \
53    $(warning $(solver) is not configured in Makefiles/Makefile.location.) \
54    $(warning Probably the line 'CoinLibsDefined += COIN_lib$(solver)' is \
55      commented out))
56  $(error Please correct Makefile.location and try again.)
57endif
58
59# Figure out the configuration based on the value of CBC_SOLVERS. We need to
60# generate appropriate defines for the compilation command.
61
62CBC_DEFINES :=
63
64ifeq ($(CBC_SOLVERS),Clp)
65  CBC_ONLY_CLP := 1
66  CBC_DEFINES := CBC_ONLY_CLP CBC_USE_CLP
67else
68  CBC_ONLY_CLP := 0
69  CBC_DEFINES := $(foreach solver,$(CBC_SOLVERS), \
70      $(patsubst COIN_HAS_%,CBC_USE_%,\
71        $(filter COIN_HAS_%,$($(solver)Define))))
72endif
73CBC_DEFINES += CBC_DEFAULT_SOLVER="\"$(cbcDefaultSolver)\""
74export CBC_ONLY_CLP
75export CBC_DEFINES
76export CBC_SOLVERS
77
78$(warning CBC_DEFINES is $(CBC_DEFINES))
79
80$(warning Building cbc with solvers $(CBC_SOLVERS))
81
82# Pull together the full dependency list for cbc. You can't build cbc without
83# the Coin, Osi, and Cgl libraries. Add Coin and Osi later, for technical
84# reasons.
85
86libTgts := Cgl
87
88# This makefile fronts for two main programs down in the Test directory, cbc
89# and solve. solve will always want OsiClp and Vol (note: not OsiVol). Add them
90# here, if they're not already in CBC_SOLVERS, and add the list from
91# CBC_SOLVERS.
92
93libTgts += $(filter-out $(CBC_SOLVERS),Vol)
94libTgts += $(patsubst %,Osi%,$(CBC_SOLVERS))
95libTgts += $(filter-out $(libTgts),OsiClp)
96
97# Relocate the OsiXXX targets to the Osi directory, then prepend Coin and Osi.
98
99libTgts := Coin Osi $(patsubst Osi%,Osi/Osi%,$(libTgts))
100
101$(warning Complete dependency list is $(libTgts))
102
103###############################################################################
104
105.DELETE_ON_ERROR:
106
107.PHONY: default install clean library unitTest cbc solver solve \
108        libdepend libCbc doc
109
110default: install
111libCbc: library
112
113libCbc: library
114
115ifneq ($(filter COIN_libOsiCbc,$(CoinLibsDefined)),)
116        (cd $(CoinDir)/Osi/OsiCbc && $(MAKE) -f Makefile.lightweight install)
117endif
118
119install library: libdepend
120        ${MAKE} -f Makefile.Cbc $@
121
122# Build the dependencies. OsiCbc is its own strange animal, pick it off
123# separately.
124
125libdepend:
126        $(foreach tgt,$(libTgts),(cd $(CoinDir)/$(tgt) && $(MAKE) install) ; )
127ifneq ($(filter COIN_libOsiCbc,$(CoinLibsDefined)),)
128        (cd $(CoinDir)/Osi/OsiCbc && $(MAKE) -f Makefile.lightweight install)
129endif
130
131unitTest cbc:
132        (cd Test && ${MAKE} unitTest)
133
134solver:
135        (cd Test && ${MAKE} solver)
136
137solve:
138        (cd Test && ${MAKE} solver)
139
140clean:
141        @rm -rf Junk
142        @rm -rf $(UNAME)*
143        @rm -rf dep
144        @rm -rf Test/Junk
145        @rm -rf Test/$(UNAME)*
146        @rm -rf Test/dep
147        @rm -f cbc
148        @rm -f solve
149
150doc:
151        doxygen $(MakefileDir)/doxygen.conf
Note: See TracBrowser for help on using the repository browser.