-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathMakefile.in
261 lines (208 loc) · 7.7 KB
/
Makefile.in
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
#######################################################################
# Makefile for compiling BBarolo and pyBBarolo codes
#######################################################################
#######################################################################
# General settings and variables
#######################################################################
FLAGS = -O2 -ftree-vectorize -fPIC -Wuninitialized -std=c++17 @OPENMP_CXXFLAGS@ @CFLAGS@
#-march=native
#FLAGS = -O0 -g -fbounds-check -Wall -Wextra -std=c++17 @OPENMP_CXXFLAGS@ @CFLAGS@
#FLAGS = -fast -Wall @OPENMP_CXXFLAGS@ @CFLAGS@
#WCSFLAGS = `pkg-config --cflags --libs wcslib`
CC = @CC@ $(CFLAGS) $(FLAGS)
CXX = @CXX@ $(CFLAGS) $(FLAGS)
LINK= @CXX@ $(CFLAGS) $(FLAGS) -flto
INSTALL = @INSTALL@
LN_S = @LN_S@
OPS = @OP@
BASE = @BASEDIR@
INSTALLDIR = @prefix@/bin
LIBDIR = @prefix@/lib
INCDIR = @prefix@/include/bbarolo
V = @PACKAGE_VERSION@
EXEC-STUB = BBarolo
EXEC = $(EXEC-STUB)-$(V)
LIB = libBBarolo-$(V).a
LIB_LN = libBBarolo.a
SHAREDLIB = @SHRLD@
#SHAREDFLAGS = -shared -Wl,-soname,@SHRLIB@
LIBSO = @SHRLIB@
LIBSO_LN = @SHRLN@
CFITSIOINC = @CFITSIOINC@
CFITSIOLIB = @CFITSIOLIB@
FFTW3INC = @FFTW3INC@
FFTW3LIB = @FFTW3LIB@
WCSINC = @WCSINC@
WCSLIB = @WCSLIB@
PYINC = @PYTHON_INCLUDE@
PYLIB = @PYTHON_LIBS@
OPT = @GNUPLOT@ @FFTW3@ @HAVEPYTHON@ @HAVEMPI@
STATICGCC = -static
ifeq ($(OPS),MACOS)
OPT += -DMACOS
STATICGCC = -static-libgcc -static-libstdc++
endif
#OPT += -DDOUBLE_PRECISION
OTHERLIB = -lm
CINC = -I$(BASE) $(FFTW3INC) $(CFITSIOINC) $(WCSINC) #$(PYINC)
LIBS = $(FFTW3LIB) $(CFITSIOLIB) $(WCSLIB) $(OTHERLIB) #$(PYLIB)
STATICLIBS = @STATICLIBS@ -lcurl -lz
#$(PYLIB)/libpython3.6.a
ARRAYDIR = $(BASE)/Arrays
MAPDIR = $(BASE)/Map
UTILDIR = $(BASE)/Utilities
TASKDIR = $(BASE)/Tasks
PYBBDIR = $(BASE)/../pyBBarolo
OBJDIR = $(BASE)/Build
HEADS := $(wildcard $(BASE)/*.h*)\
$(wildcard $(ARRAYDIR)/*.h*)\
$(wildcard $(MAPDIR)/*.h*)\
$(wildcard $(UTILDIR)/*.h*)\
$(wildcard $(TASKDIR)/*.h*)\
SOURCES := $(BASE)/BB_interface.cpp\
$(wildcard $(ARRAYDIR)/*.cpp)\
$(wildcard $(MAPDIR)/*.cpp)\
$(wildcard $(UTILDIR)/*.cpp)\
$(wildcard $(TASKDIR)/*.cpp)\
OBJECTS := $(addprefix $(OBJDIR)/,$(notdir $(SOURCES:.cpp=.o)))
DEPENDS := $(OBJECTS:%.o=%.d)
# VPATH set a search list for both prerequisites and targets of rules
VPATH := $(dir $(SOURCES))
.PHONY: lib linux install installall uninstall clean cleanup cleanest cleangui\
gui justgui all static guistatic guistaticlinux mpi pybb pybbdist pybbinst
#######################################################################
# Compiling and installation rules for BBarolo
#######################################################################
$(EXEC-STUB) : $(OBJDIR) $(OBJECTS)
$(LINK) -o $@ $(CINC) $(BASE)/bbarolo.cpp $(OBJECTS) $(LIBS) $(OPT)
# $(LINK) -o $@ $(OBJECTS) $(LIBS) $(OPT)
-include $(DEPENDS)
#$(OBJECTS) : $(HEADS)
$(OBJDIR) :
mkdir -p $(OBJDIR)
$(OBJDIR)/%.o: %.cpp
$(CXX) $(OPT) -MMD -c $< -o $@ $(CINC)
lib : $(OBJDIR) $(OBJECTS)
ar cq $(LIB) $(OBJECTS)
@RANLIB@ $(LIB)
$(SHAREDLIB) $(CINC) $(LIBS) -o $(LIBSO) $(OBJECTS)
rm -rf $(LIBSO_LN) $(LIB_LN)
$(LN_S) $(LIBSO) $(LIBSO_LN)
$(LN_S) $(LIB) $(LIB_LN)
# $(CXX) $(SHAREDFLAGS) -o $(LIBSO) $(OBJECTS)
linux : $(OBJECTS)
$(LINK) -o BBarololinux $(OBJECTS) $(LIBS)
static: $(OBJDIR) $(OBJECTS)
$(LINK) -o $(EXEC-STUB) $(CINC) $(BASE)/bbarolo.cpp $(OBJECTS) $(STATICLIBS) $(OPT) $(STATICGCC)
ifeq ($(OPS),LINUX)
strip -s $(EXEC-STUB)
endif
install : $(EXEC-STUB)
$(INSTALL) -d -m 2755 $(INSTALLDIR)
ifneq ("$(wildcard BBarolo)","")
cp $(EXEC-STUB) $(EXEC)
$(RM) $(INSTALLDIR)/$(EXEC-STUB) $(INSTALLDIR)/$(EXEC)
$(INSTALL) -m 755 $(EXEC) $(INSTALLDIR)
$(LN_S) $(INSTALLDIR)/$(EXEC) $(INSTALLDIR)/$(EXEC-STUB)
$(RM) $(EXEC)
endif
ifneq ("$(wildcard BBarolo_MPI)","")
$(RM) $(INSTALLDIR)/BBarolo_MPI
$(INSTALL) -m 755 BBarolo_MPI $(INSTALLDIR)
endif
installall : lib install
-test ! -f $(LIB) || $(INSTALL) -d -m 2755 $(LIBDIR)
-test ! -f $(LIB) || $(INSTALL) -m 644 $(LIB) $(LIBDIR)
-test ! -f $(LIB) || cd $(LIBDIR) && $(RM) $(LIB_LN) && $(LN_S) $(LIB) $(LIB_LN)
-test ! -f $(LIBSO) || $(INSTALL) -m 755 $(LIBSO) $(LIBDIR) && \
if [ "@SHRLN@" != "" ] ; then \
cd $(LIBDIR) && $(RM) $(LIBSO_LN) && $(LN_S) $(LIBSO) $(LIBSO_LN); \
fi
$(INSTALL) -d -m 2755 $(INCDIR)
$(INSTALL) -d -m 2755 $(INCDIR)/Arrays
$(INSTALL) -m 644 $(ARRAYDIR)/*.hh $(INCDIR)/Arrays
$(INSTALL) -d -m 2755 $(INCDIR)/Map
$(INSTALL) -m 644 $(MAPDIR)/*.hh $(INCDIR)/Map
$(INSTALL) -d -m 2755 $(INCDIR)/Utilities
$(INSTALL) -m 644 $(UTILDIR)/*.hh $(INCDIR)/Utilities
uninstall :
$(RM) $(INSTALLDIR)/$(EXEC-STUB) $(INSTALLDIR)/$(EXEC) $(INSTALLDIR)/BBarolo_MPI
cd $(LIBDIR) && $(RM) $(LIB) $(LIB_LN) $(LIBSO) $(LIBSO_LN)
$(RM) -r $(INCDIR)
mpi: $(OBJDIR) $(OBJECTS)
mpicxx $(FLAGS) -DMPI -o BBarolo_MPI $(CINC) $(BASE)/bbarolo.cpp $(OBJECTS) $(LIBS) $(OPT)
all : $(EXEC-STUB) gui
#######################################################################
# Rules to make the Graphical User Interface
#######################################################################
gui : $(EXEC-STUB)
cd ./src/GUI && mv BbaroloGUI.pro BbaroloGUI.or && \
cp BbaroloGUI.or BbaroloGUI.pro && \
echo "QMAKE_CC = $(CC) $(OPT) " >> BbaroloGUI.pro &&\
echo "QMAKE_CXX = $(CXX) $(OPT) " >> BbaroloGUI.pro &&\
echo "QMAKE_LINK = $(CXX) $(OPT) " >> BbaroloGUI.pro &&\
echo "QMAKE_LFLAGS -= -stdlib=libc++" >> BbaroloGUI.pro && \
echo "QMAKE_CFLAGS -= -stdlib=libc++" >> BbaroloGUI.pro && \
echo "QMAKE_CXXFLAGS -= -stdlib=libc++" >> BbaroloGUI.pro && \
echo "LIBS += $(LIBS) -static-libgcc -static-libstdc++" >> BbaroloGUI.pro && \
qmake && \
rm BbaroloGUI.pro && mv BbaroloGUI.or BbaroloGUI.pro && \
make
ifeq ($(OPS),MACOS)
cp BBarolo ./BBaroloGUI.app/Contents/MacOS/
endif
justgui : $(EXEC-STUB)
cd ./src/GUI && make
ifeq ($(OPS),MACOS)
cp BBarolo ./BBaroloGUI.app/Contents/MacOS/
endif
guistatic : static
rm -rf ./BBaroloGUI.app/Contents/Resources/qt.conf
macdeployqt ./BBaroloGUI.app
cp BBarolo ./BBaroloGUI.app/Contents/MacOS/
guistaticlinux : $(EXEC-STUB)
cd ./src/GUI && mv BbaroloGUI.pro BbaroloGUI.or && \
cp BbaroloGUI.or BbaroloGUI.pro && \
echo "LIBS += $(STATICLIBS) -static-libgcc -static-libstdc++ " >> BbaroloGUI.pro && \
echo "QMAKE_FLAGS += $(OPT) $(CINC)" >> BbaroloGUI.pro && \
echo "QMAKE_FLAGS -= -stdlib=libc++" >> BbaroloGUI.pro && \
echo "QMAKE_LFLAGS -= -stdlib=libc++" >> BbaroloGUI.pro && \
echo "QMAKE_CC = $(CC)" >> BbaroloGUI.pro &&\
echo "QMAKE_CXX = $(CXX)" >> BbaroloGUI.pro &&\
echo "QMAKE_LINK = $(CXX)" >> BbaroloGUI.pro &&\
export PATH=/home/edt/Downloads/qt/bin/:$(PATH) &&\
qmake -config release &&\
rm BbaroloGUI.pro && mv BbaroloGUI.or BbaroloGUI.pro && \
make && \
cd ../.. &&\
$(LINK) -o BBarolo $(OBJECTS) $(STATICLIBS) -static-libgcc -static-libstdc++
#######################################################################
# Rules to make pyBBarolo
#######################################################################
pybb : lib
mv $(LIB) $(PYBBDIR)
mv $(LIB_LN) $(PYBBDIR)
mv $(LIBSO) $(PYBBDIR)
mv $(LIBSO_LN) $(PYBBDIR)
pybbdist : pybb
# python setup.py sdist upload
# python setup.py sdist
python -m build --sdist
twine upload --repository-url https://upload.pypi.org/legacy/ dist/*
rm -rf build dist MANIFEST
pybbinst : pybb
# python setup.py install
pip install .
rm -rf build dist MANIFEST
rm -rf pyBBarolo/BBarolo pyBBarolo/libBB*
#######################################################################
# Cleaning rules
#######################################################################
clean : cleanup
rm -rf $(OBJDIR) $(LIB) $(LIBSO) $(LIB_LN) $(LIBSO_LN)
cleanest : clean
rm -rf Makefile $(EXEC) $(EXEC-STUB)
cleanup :
rm -rf autom4te.cache config.log config.status setup.log
cleangui :
cd $(BASE)/GUI && make clean