source: trunk/Samples/Makefile.anywhere @ 576

Last change on this file since 576 was 576, checked in by forrest, 15 years ago

should work in any directory

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.6 KB
Line 
1#This makefile is designed to compile drivers from any directory
2OptLevel := -g
3
4DRIVER ?= driver
5
6
7
8# The location of COIN -Edit next line if necessary
9CoinDir := $(HOME)/COIN
10export MakefileDir := $(CoinDir)/Makefiles
11include ${MakefileDir}/Makefile.coin
12include ${MakefileDir}/Makefile.location
13
14IncDir :=
15IncDir += ${ClpIncDir}
16IncDir += ${CoinIncDir}
17IncDir += ${zlibIncDir}
18IncDir += ${bzlibIncDir}
19IncDir += ${readlineIncDir}
20IncDir += ${lapackIncDir}
21
22LibDir :=
23LibDir += ${ClpLibDir}
24LibDir += ${CoinLibDir}
25LibDir += ${zlibLibDir}
26LibDir += ${bzlibLibDir}
27LibDir += ${readlineLibDir}
28LibDir += ${lapackLibDir}
29LibDir += $(GlpkLibDir)
30
31LibName :=
32LibName += ${ClpLibName}
33LibName += ${CoinLibName}
34LibName += ${zlibLibName}
35LibName += ${bzlibLibName}
36LibName += ${readlineLibName}
37LibName += ${lapackLibName}
38LibName += $(GlpkLibName)
39
40Define :=
41Define += ${ClpDefine}
42Define += ${CoinDefine}
43Define += ${zlibDefine}
44Define += ${bzlibDefine}
45Define += ${readlineDefine}
46Define += ${lapackDefine}
47Define += ${taucsDefine}
48
49CXXFLAGS += $(OPTFLAG)
50
51###############################################################################
52
53space:= $(empty) $(empty)
54OptVersion := $(subst $(space),_,$(OptLevel))
55
56TARGETDIR := $(UNAME)$(OptVersion)
57DEPDIR := dep
58
59VPATH := . : include : Junk : ${TARGETDIR} : ${DEPDIR}
60
61#########################################################################
62
63CXXFLAGS += $(addprefix -I,${IncDir})
64CXXFLAGS += $(addprefix -D,${Define})
65
66LIBDIRS := ${LibDir}
67LIBS    := ${LibName}
68
69LDFLAGS := $(addprefix -L,$(LIBDIRS))
70LDFLAGS += $(call ifprefix,$(SHLINKPREFIX),$(LIBDIRS))
71LDFLAGS += $(patsubst lib%,-l%,$(basename $(LIBS)))
72
73#LDFLAGS += -lefence
74#LDFLAGS += -Wl,-static
75###############################################################################
76
77ifeq ($(DRIVER),driverC)
78    SRCEXT := c
79else
80    SRCEXT := cpp
81endif
82
83TESTSRC := $(DRIVER).$(SRCEXT)
84TESTOBJ := $(addprefix $(TARGETDIR)/, $(TESTSRC:.$(SRCEXT)=.o))
85TESTDEP := $(addprefix $(DEPDIR)/, $(TESTSRC:.$(SRCEXT)=.d))
86
87###############################################################################
88# This one must be right before the rules
89
90include ${MakefileDir}/Makefile.rules
91
92###############################################################################
93
94.DELETE_ON_ERROR:
95
96.PHONY: default clean doc unitTest libdepend
97
98default: testit
99
100###############################################################################
101
102
103testit : libdepend $(TESTOBJ)
104        @rm -rf Junk
105        @echo ""
106        @echo Creating testit
107        @rm -f $@
108        $(CXX) $(CXXFLAGS) -o $@ $(TESTOBJ) $(LDFLAGS) $(SYSLD) -lm
109
110###############################################################################
111
112-include $(TESTDEP)
Note: See TracBrowser for help on using the repository browser.