-
Notifications
You must be signed in to change notification settings - Fork 2
/
MyMakefile
145 lines (118 loc) · 4.1 KB
/
MyMakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# ====================================================
# Detect platform on which we're running (limited)
# ====================================================
ifeq ($(OS),Windows_NT)
PLATFORM=MinGW-Windows
else
PLATFORM=Linux
endif
# ====================================================
# Configurable items
# ====================================================
ifeq ($(PLATFORM),Linux)
GNUDIR = /usr/bin
SWIGDIR = /usr/local/bin
JAVADIR = /home/argus/jdk1.7.0_25
else
GNUDIR = c:/MinGW/bin
SWIGDIR = D:/Users/pwof/Documents/swig/swigwin-2.0.11
JAVADIR = c:/Progra~1/Java/jdk1.7.0_51
endif
LIBNAME = tauhitas
#MAJOR_VERSION = 1
#MINOR_VERSION = 0
JAVAPACKAGE = tauargus.extern.tauhitas
# ======================================================================
# Set directories for input and output files
# ======================================================================
BUILDDIR = build
DISTDIR = dist
ifdef debug
CONF = Debug
else
CONF = Release
endif
BUILDFILEDIR = $(BUILDDIR)/$(CONF)/$(PLATFORM)
DISTFILEDIR = $(DISTDIR)/$(CONF)/$(PLATFORM)
SRCDIR = .
OBJDIR = $(BUILDFILEDIR)
LIBDIR = $(DISTFILEDIR)
OUTDIR = $(DISTFILEDIR)
# ====================================================
# Non configurable items
# ====================================================
INCDIRS = $(JAVADIR)/include
ifeq ($(PLATFORM),Linux)
INCDIRS += $(JAVADIR)/include/linux
else
INCDIRS += $(JAVADIR)/include/Win32
endif
INCDIRS += ../Cplex/include/ilcplex
INCDIRS += ../XPress
INCDIRS += ../JJSource/InstallSCIP/scip-3.0.2/src
INCDIRS += ../JJSource/InstallSCIP/soplex-1.7.1/src
CXX = $(GNUDIR)/g++
SWIG = $(SWIGDIR)/swig
LINK = $(GNUDIR)/g++
SFLAGS = -c++ -I$(SRCDIR)/src -java -package $(JAVAPACKAGE) -outdir $(OUTDIR)
CFLAGS = $(INCLUDES) -Wall
ifeq ($(PLATFORM),Linux)
CFLAGS += -fPIC
endif
ifdef debug
CFLAGS += -D_DEBUG -g -DSECBOUNDS
else
CFLAGS += -DNDEBUG -O2 -DSECBOUNDS
endif
LDFLAGS = -shared
ifeq ($(PLATFORM),Linux)
LDFLAGS += $(CFLAGS) -Wl,-soname,$(SONAME)
else
LDFLAGS += -Wl,--subsystem,windows -Wl,--kill-at
endif
# Exclude source files needed for a COM dll for Visual Basic 6.0
#NOSOURCES = $(SRCDIR)/GhmiterANCO.cpp $(SRCDIR)/TauArgCtrl.cpp $(SRCDIR)/StdAfx.cpp $(SRCDIR)/NewTauArgus.cpp
SWIGSOURCES = $(wildcard $(SRCDIR)/*.swg)
GENERATED_SOURCES = $(patsubst $(SRCDIR)/%.swg,$(SRCDIR)/src/%_wrap.cpp,$(SWIGSOURCES))
#SOURCES = $(filter-out $(NOSOURCES),$(wildcard $(SRCDIR)/*.cpp))
SOURCES = $(wildcard $(SRCDIR)/src/*.cpp)
OBJECTS = $(patsubst $(SRCDIR)/src/%.cpp,$(OBJDIR)/%.o,$(SOURCES) $(GENERATED_SOURCES))
INCLUDES = $(INCDIRS:%=-I%)
ifeq ($(PLATFORM),Linux)
LIBBASENAME = lib$(LIBNAME).so
SONAME = $(LIBBASENAME) #.$(MAJOR_VERSION)
LIBFILENAME = $(SONAME) #.$(MINOR_VERSION)
else
LIBFILENAME = $(LIBNAME).dll
endif
TARGET = $(LIBDIR)/$(LIBFILENAME)
.PHONY: all clean
.SECONDARY: $(SRCDIR)/src/hitasctrl_wrap.cpp
all : $(OBJDIR) $(LIBDIR) $(TARGET)
clean :
rm -rf $(OBJDIR) $(LIBDIR)
rm -f $(SRCDIR)/src/*_wrap.*
LDFLAGS += -L../CSP/dist/Debug/MinGW-Windows
LDFLAGS += -L../Cplex/lib
LDFLAGS += -L../XPress
LDFLAGS += -L../JJSource/InstallSCIP/scip-3.0.2/lib
LDFLAGS += -L../JJSource/InstallSCIP/soplex-1.7.1/lib
LDFLAGS += -lcplex75 -lCSPlibXPRESS -lxprl -lxprs -lCSPlibSCIP -lscip -lnlpi.cppad -lobjscip -llpispx-3.0.2.mingw.x86.gnu.opt -lsoplex-1.7.1.mingw.x86.gnu.opt
$(TARGET) : $(OBJECTS)
$(LINK) $(LDFLAGS) -o $@ $^
# cp -p $(TARGET) /opt/lib
# ln -sf /opt/lib/$(LIBFILENAME) /opt/lib/$(SONAME)
# ln -sf /opt/lib/$(SONAME) /opt/lib/$(LIBBASENAME)
$(BUILDDIR) $(BUILDDIR)/$(CONF) $(OBJDIR) $(DISTDIR) $(DISTDIR)/$(CONF) $(LIBDIR) :
mkdir -p $@
# pull in dependency info for *existing* .o files
-include $(wildcard $(addsuffix .d, ${OBJECTS}))
#############################################################################
# Implicit rules
#############################################################################
# compile and generate dependency info
$(OBJDIR)/%.o : $(SRCDIR)/src/%.cpp
$(CXX) $(CFLAGS) -c -MMD -MP -MF [email protected] $< -o $@
$(OBJDIR)/%.o: makefile
$(SRCDIR)/src/hitasctrl_wrap.cpp : $(SRCDIR)/hitasctrl.swg
$(SWIG) $(SFLAGS) -o $@ $<