-
Notifications
You must be signed in to change notification settings - Fork 2
/
makefile
86 lines (70 loc) · 2.76 KB
/
makefile
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
###############################################################################
#
# makefile template for the sources
#
###############################################################################
# -----------------------------------------------------------------------------
# Setting up the variables
# -----------------------------------------------------------------------------
LIBNAME = libBCS.so
CPPSRC = source/BCS.cpp\
source/BCSCoreSolver.cpp\
source/BCS_cfunctions.cpp
OBJ = $(CPPSRC:.cpp=.o)
LIBS = -larpack -liomp5 -lpthread
CC = icc
CXX = icpc
CFLAGS = -fPIC -openmp #fPIC also OK for icpc
LDFLAGS = -shared
# =============================================================================
# Targets & Rules
# =============================================================================
all:
@echo
@echo ' +++ Building $(LIBNAME)...'
@echo
$(MAKE) $(LIBNAME)
@if test $?; then \
echo; echo '*************** FAILED! ***************' ; echo; \
else \
echo; echo ' +++ $(LIBNAME) has been built successfully!'; \
echo; \
fi
# -----------------------------------------------------------------------------
# The default way to compile all source modules
# -----------------------------------------------------------------------------
%.o: %.for makefile
@echo; echo "Compiling $(@:.o=.for) ..."
$(FF) -c $(FFLAGS) $(SFLAGS) $(@:.o=.for) -o $@
%.o: %.c makefile
@echo; echo "Compiling $(@:.o=.c) ..."
$(CC) -c $(CFLAGS) $(SFLAGS) $(@:.o=.c) -o $@
%.o: %.cpp makefile
@echo; echo "Compiling $(@:.o=.cpp) ..."
$(CXX) -c $(CFLAGS) $(SFLAGS) $(DEFS) $(@:.o=.cpp) -o $@
# -----------------------------------------------------------------------------
# Link everything together
# -----------------------------------------------------------------------------
$(LIBNAME): makefile $(OBJ)
@echo; echo "Linker: creating $(LIBNAME) ..."
$(CXX) $(LDFLAGS) $(SFLAGS) -Wl,-soname,$(LIBNAME) -o $(LIBNAME) $(OBJ) $(LIBS)
# -----------------------------------------------------------------------------
# Create everything newly from scratch
# -----------------------------------------------------------------------------
new: clean all
# -----------------------------------------------------------------------------
# Clean up all files
# -----------------------------------------------------------------------------
clean:
@echo -n ' +++ Cleaning all object files ... '
@echo -n $(OBJ)
@rm -f $(OBJ)
@echo -n $(LIBNAME)
@rm -f $(LIBNAME)
@echo 'Done.'
#-----------------------------------------------------------------------------
# Make the documentation
#----------------------------------------------------------------------------
doc:
@doxygen .doc-config
# ====================== End of file 'makefile.in' ========================== #