source: trunk/Test/Makefile.test @ 280

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

Suppressed a few prints. Reorder libraries for static link (thanks, Pierre!).

  • 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# Cbc should build without OsiCbc, but you can't run the miplib test suite
28# without it.
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 to enable)
39  $(warning OsiCbc.)
40endif
41
42# Add the requested solver libraries: libXXX and libOsiXXX
43
44IncDir += $(foreach lib,$(CBC_SOLVERS),$($(lib)IncDir))
45LibDir += $(foreach lib,$(CBC_SOLVERS),$($(lib)LibDir))
46LibName += $(foreach lib,$(CBC_SOLVERS),$($(lib)LibName))
47Define += $(foreach lib,$(CBC_SOLVERS),$($(lib)Define))
48IncDir += $(foreach lib,$(CBC_SOLVERS),$(Osi$(lib)IncDir))
49LibDir += $(foreach lib,$(CBC_SOLVERS),$(Osi$(lib)LibDir))
50LibName += $(foreach lib,$(CBC_SOLVERS),$(Osi$(lib)LibName))
51Define += $(foreach lib,$(CBC_SOLVERS),$(Osi$(lib)Define))
52
53# Add the required libraries: Coin, Osi, Cgl
54
55IncDir += $(foreach lib,Cgl Osi Coin,$($(lib)IncDir))
56LibDir += $(foreach lib,Cgl Osi Coin,$($(lib)LibDir))
57LibName += $(foreach lib,Cgl Osi Coin,$($(lib)LibName))
58Define += $(foreach lib,Cgl Osi Coin,$($(lib)Define))
59
60# And a few other potentially useful libraries: z, bz, readline. Unfortunately
61# the naming conventions are irregular.
62
63utilLibs := $(filter \
64    $(patsubst COIN_%,%,$(CoinLibsDefined)),libz libbz readline)
65utilLibs := $(patsubst lib%z,%zlib,$(utilLibs))
66
67IncDir += $(foreach lib,$(utilLibs),$($(lib)IncDir))
68LibDir += $(foreach lib,$(utilLibs),$($(lib)LibDir))
69LibName += $(foreach lib,$(utilLibs),$($(lib)LibName))
70Define += $(foreach lib,$(utilLibs),$($(lib)Define))
71
72# Strip redundancy from IncDir, LibDir. Reordering should not be harmful for
73# these, under normal circumstances.
74
75IncDir := ./include $(sort $(IncDir))
76LibDir := $(sort $(LibDir))
77
78# Uncomment these to see just what's been ordered for the build.
79
80# $(warning IncDir is $(IncDir))
81# $(warning LibDir is $(LibDir))
82# $(warning LibName is $(LibName))
83# $(warning Define is $(Define))
84
85##############################################################################
86# You should not need to edit below this line.
87##############################################################################
88
89CXXFLAGS += $(OPTFLAG)
90ifeq ($(OptLevel),-g)
91    CXXFLAGS += -DCBC_DEBUG
92endif
93
94TESTSRC := CbcMain.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.