source: trunk/Test/Makefile.test @ 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.8 KB
Line 
1# Select optimization (-O or -g). -O will be automatically bumped up to the
2# highest level of optimization the compiler supports. If want something in
3# between then specify the exact level you want, e.g., -O1 or -O2
4OptLevel := -g
5LibType := SHARED
6
7##############################################################################
8# You should not need to edit below this line unless you are configuring cbc
9# for multiple solvers, or for a single solver other than clp.
10##############################################################################
11
12# Bring on the boilerplate, yet again.
13
14MakefileDir := ../../Makefiles
15include ${MakefileDir}/Makefile.coin
16
17# Include files, library directory and name, compile-time defines.
18
19# Start out with empty vars. If for no other reason, we need this to establish
20# these variables as simply expanded.
21
22IncDir :=
23LibDir :=
24LibName :=
25Define := $(CBC_DEFINES)
26
27# Tell parameter handling to allow for CbcModel and OsiSolverInterface. You
28# can't run the miplib test suite without OsiCbc.
29
30CBC_SOLVERS += Cbc
31
32$(warning CBC_SOLVERS is $(CBC_SOLVERS))
33
34ifneq ($(filter COIN_libOsiCbc,$(CoinLibsDefined)),)
35  CXXFLAGS += -DCBC_USE_CBC
36else
37  $(warning OsiCbc not enabled in CoinLibsDefined. You will not be able to)
38  $(warning run the `cbc -miplib' command. Edit Makefile.location if you)
39  $(warning to enable OsiCbc.)
40endif
41
42
43# Add the required libraries: Coin, Osi, Cgl
44
45IncDir += $(foreach lib,Coin Osi Cgl,$($(lib)IncDir))
46LibDir += $(foreach lib,Coin Osi Cgl,$($(lib)LibDir))
47LibName += $(foreach lib,Coin Osi Cgl,$($(lib)LibName))
48Define += $(foreach lib,Coin Osi Cgl,$($(lib)Define))
49
50# Add the requested solver libraries: libXXX and libOsiXXX
51
52IncDir += $(foreach lib,$(CBC_SOLVERS),$($(lib)IncDir))
53LibDir += $(foreach lib,$(CBC_SOLVERS),$($(lib)LibDir))
54LibName += $(foreach lib,$(CBC_SOLVERS),$($(lib)LibName))
55Define += $(foreach lib,$(CBC_SOLVERS),$($(lib)Define))
56IncDir += $(foreach lib,$(CBC_SOLVERS),$(Osi$(lib)IncDir))
57LibDir += $(foreach lib,$(CBC_SOLVERS),$(Osi$(lib)LibDir))
58LibName += $(foreach lib,$(CBC_SOLVERS),$(Osi$(lib)LibName))
59Define += $(foreach lib,$(CBC_SOLVERS),$(Osi$(lib)Define))
60
61# And a few other potentially useful libraries: z, bz, readline. Unfortunately
62# the naming conventions are irregular.
63
64utilLibs := $(filter \
65    $(patsubst COIN_%,%,$(CoinLibsDefined)),libz libbz readline)
66utilLibs := $(patsubst lib%z,%zlib,$(utilLibs))
67
68IncDir += $(foreach lib,$(utilLibs),$($(lib)IncDir))
69LibDir += $(foreach lib,$(utilLibs),$($(lib)LibDir))
70LibName += $(foreach lib,$(utilLibs),$($(lib)LibName))
71Define += $(foreach lib,$(utilLibs),$($(lib)Define))
72
73# Strip redundancy from IncDir, LibDir. Reordering should not be harmful for
74# these, under normal circumstances.
75
76IncDir := ./include $(sort $(IncDir))
77LibDir := $(sort $(LibDir))
78
79$(warning IncDir is $(IncDir))
80$(warning LibDir is $(LibDir))
81$(warning LibName is $(LibName))
82$(warning Define is $(Define))
83
84##############################################################################
85# You should not need to edit below this line.
86##############################################################################
87
88CXXFLAGS += $(OPTFLAG)
89ifeq ($(OptLevel),-g)
90    CXXFLAGS += -DCBC_DEBUG
91endif
92
93TESTSRC := CbcMain.cpp
94#TESTSRC += CbcOrClpParam.cpp
95TESTSRC += CbcParam.cpp
96TESTSRC += unitTest.cpp
97
98###############################################################################
99
100space:= $(empty) $(empty)
101OptVersion := $(subst $(space),_,$(OptLevel))
102
103TARGETDIR := $(UNAME)$(OptVersion)
104DEPDIR := dep
105
106VPATH := . : include : Junk : ${TARGETDIR} : ${DEPDIR}
107
108#########################################################################
109
110CXXFLAGS += $(addprefix -I,${IncDir})
111CXXFLAGS += $(addprefix -D,${Define})
112
113LIBDIRS := ${LibDir}
114LIBS    := ${LibName}
115
116LDFLAGS := $(addprefix -L,$(LIBDIRS))
117LDFLAGS += $(call ifprefix,$(SHLINKPREFIX),$(LIBDIRS))
118LDFLAGS += $(patsubst lib%,-l%,$(basename $(LIBS)))
119
120ifeq ($(findstring Linux,${UNAME}),Linux)
121        CXXFLAGS +=     -DREADLINE
122endif
123#LDFLAGS += -lefence
124
125###############################################################################
126
127TESTOBJ := $(addprefix $(TARGETDIR)/, $(TESTSRC:.cpp=.o))
128TESTDEP := $(addprefix $(DEPDIR)/, $(TESTSRC:.cpp=.d))
129
130###############################################################################
131# This one must be right before the rules
132
133include ${MakefileDir}/Makefile.rules
134
135###############################################################################
136
137.DELETE_ON_ERROR:
138
139.PHONY: unitTest
140
141unitTest: $(TARGETDIR)/cbc
142
143$(TARGETDIR)/cbc : $(TESTOBJ)
144        @rm -rf Junk
145        @echo ""
146        @echo Creating cbc
147        @mkdir -p $(TARGETDIR)
148        @rm -f $@
149        $(CXX) $(CXXFLAGS) -o $@ $(TESTOBJ) $(LDFLAGS) $(SYSLD) -lm
150        ${CP} $@ ..
151
152###############################################################################
153
154%::
155        @mkdir -p Junk
156        touch Junk/$(notdir $@)
157
158###############################################################################
159
160-include $(TESTDEP)
Note: See TracBrowser for help on using the repository browser.