source: trunk/Test/Makefile.test @ 305

Last change on this file since 305 was 305, checked in by lou, 15 years ago

warning -> info

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.3 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# cbc will build without OsiCbc, but you can't run the miplib test suite
18# without it. Disabling OsiCbc in Makefile.location simply excludes OsiCbc from
19# the link. In the current COIN makefile architecture, building Cbc and Osi
20# leads inevitably to building OsiCbc.
21
22ifneq ($(filter COIN_libOsiCbc,$(CoinLibsDefined)),)
23  CXXFLAGS += -DCBC_USE_CBC
24  CBC_SOLVERS += Cbc
25else
26  $(warning OsiCbc not enabled in CoinLibsDefined. You will not be able to)
27  $(warning run the `cbc -miplib' command. Edit Makefile.location to enable)
28  $(warning OsiCbc.)
29endif
30
31# Include files, library directory and name, compile-time defines.  Start out
32# by adding libCbc.
33
34IncDir := $(CbcIncDir)
35LibDir := $(CbcLibDir)
36LibName := $(CbcLibName)
37Define := $(CBC_DEFINES) $(CbcDefine)
38
39# Add the requested libOsiXXX libraries.
40
41IncDir += $(foreach solver,$(CBC_SOLVERS),$(Osi$(solver)IncDir))
42LibDir += $(foreach solver,$(CBC_SOLVERS),$(Osi$(solver)LibDir))
43LibName += $(foreach solver,$(CBC_SOLVERS),$(Osi$(solver)LibName))
44Define += $(foreach solver,$(CBC_SOLVERS),$(Osi$(solver)Define))
45
46# Add the requested libXXX libraries (excepting libCbc, which is already in).
47
48CBC_SOLVERS := $(filter-out Cbc,$(CBC_SOLVERS))
49IncDir += $(foreach solver,$(CBC_SOLVERS),$($(solver)IncDir))
50LibDir += $(foreach solver,$(CBC_SOLVERS),$($(solver)LibDir))
51LibName += $(foreach solver,$(CBC_SOLVERS),$($(solver)LibName))
52Define += $(foreach lib,$(CBC_SOLVERS),$($(lib)Define))
53
54# If Clp is in the mix, and Vol is available, we need to bring libVol
55# into the mix. (Only the library is required.)
56
57ifneq ($(filter Clp,$(CBC_SOLVERS)),)
58  ifneq ($(filter COIN_libVol,$(CoinLibsDefined)),)
59    LibDir += $(VolLibDir)
60    LibName += $(VolLibName)
61  endif
62endif
63
64# Add the required base libraries: Cgl, Osi, and Coin.
65
66IncDir += $(foreach lib,Cgl Osi Coin,$($(lib)IncDir))
67LibDir += $(foreach lib,Cgl Osi Coin,$($(lib)LibDir))
68LibName += $(foreach lib,Cgl Osi Coin,$($(lib)LibName))
69Define += $(foreach lib,Cgl Osi Coin,$($(lib)Define))
70
71# And a few other potentially useful libraries: z, bz, readline. Unfortunately
72# the naming conventions are irregular.
73
74utilLibs := $(filter \
75    $(patsubst COIN_%,%,$(CoinLibsDefined)),libz libbz readline)
76utilLibs := $(patsubst lib%z,%zlib,$(utilLibs))
77
78IncDir += $(foreach lib,$(utilLibs),$($(lib)IncDir))
79LibDir += $(foreach lib,$(utilLibs),$($(lib)LibDir))
80LibName += $(foreach lib,$(utilLibs),$($(lib)LibName))
81Define += $(foreach lib,$(utilLibs),$($(lib)Define))
82
83# Strip redundancy from IncDir, LibDir. Reordering should not be harmful for
84# these, under normal circumstances.
85
86IncDir := ./include $(sort $(IncDir))
87LibDir := $(sort $(LibDir))
88
89# Uncomment these to see what's been ordered for the build.
90
91# $(info IncDir is $(IncDir))
92# $(info LibDir is $(LibDir))
93# $(info LibName is $(LibName))
94# $(info Define is $(Define))
95
96##############################################################################
97# You should not need to edit below this line.
98##############################################################################
99
100CXXFLAGS += $(OPTFLAG)
101ifeq ($(OptLevel),-g)
102    CXXFLAGS += -DCBC_DEBUG
103endif
104
105TESTSRC := CbcMain.cpp
106TESTSRC += CbcParam.cpp
107TESTSRC += unitTest.cpp
108
109###############################################################################
110
111space:= $(empty) $(empty)
112OptVersion := $(subst $(space),_,$(OptLevel))
113
114TARGETDIR := $(UNAME)$(OptVersion)
115DEPDIR := dep
116
117VPATH := . : include : Junk : ${TARGETDIR} : ${DEPDIR}
118
119#########################################################################
120
121CXXFLAGS += $(addprefix -I,${IncDir})
122CXXFLAGS += $(addprefix -D,${Define})
123
124LIBDIRS := ${LibDir}
125LIBS    := ${LibName}
126
127LDFLAGS := $(addprefix -L,$(LIBDIRS))
128LDFLAGS += $(call ifprefix,$(SHLINKPREFIX),$(LIBDIRS))
129LDFLAGS += $(patsubst lib%,-l%,$(basename $(LIBS)))
130
131ifeq ($(findstring Linux,${UNAME}),Linux)
132        CXXFLAGS +=     -DREADLINE
133endif
134#LDFLAGS += -lefence
135
136###############################################################################
137
138TESTOBJ := $(addprefix $(TARGETDIR)/, $(TESTSRC:.cpp=.o))
139TESTDEP := $(addprefix $(DEPDIR)/, $(TESTSRC:.cpp=.d))
140
141###############################################################################
142# This one must be right before the rules
143
144include ${MakefileDir}/Makefile.rules
145
146###############################################################################
147
148.DELETE_ON_ERROR:
149
150.PHONY: cbc unitTest
151
152cbc unitTest: $(TARGETDIR)/cbc
153
154$(TARGETDIR)/cbc : $(TESTOBJ)
155        @rm -rf Junk
156        @echo ""
157        @echo Creating cbc
158        @mkdir -p $(TARGETDIR)
159        @rm -f $@
160        $(CXX) $(CXXFLAGS) -o $@ $(TESTOBJ) $(LDFLAGS) $(SYSLD) -lm
161        ${CP} $@ ..
162
163###############################################################################
164
165%::
166        @mkdir -p Junk
167        touch Junk/$(notdir $@)
168
169###############################################################################
170
171-include $(TESTDEP)
Note: See TracBrowser for help on using the repository browser.