source: trunk/Test/Makefile.test @ 289

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

General cleanup.

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