forked from tcew/OCCA2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
99 lines (80 loc) · 3.64 KB
/
makefile
File metadata and controls
99 lines (80 loc) · 3.64 KB
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
ifndef OCCA_DIR
OCCA_DIR = $(shell pwd)
endif
include ${OCCA_DIR}/scripts/makefile
#---[ WORKING PATHS ]-----------------------------
compilerFlags += -fPIC
FcompilerFlags += -fPIC
lPath = lib
occaIPath = ${OCCA_DIR}/$(iPath)
occaOPath = ${OCCA_DIR}/$(oPath)
occaSPath = ${OCCA_DIR}/$(sPath)
occaLPath = ${OCCA_DIR}/$(lPath)
#=================================================
#---[ COMPILATION ]-------------------------------
headers = $(wildcard $(occaIPath)/*.hpp) $(wildcard $(occaIPath)/*.tpp)
sources = $(wildcard $(occaSPath)/*.cpp)
csources = $(wildcard $(occaSPath)/*.c)
fsources = $(wildcard $(occaSPath)/*.f90)
objects = $(subst $(occaSPath)/,$(occaOPath)/,$(sources:.cpp=.o)) \
$(subst $(occaSPath)/,$(occaOPath)/,$(csources:.c=.o))
ifdef OCCA_FORTRAN_ENABLED
ifeq ($(OCCA_FORTRAN_ENABLED), 1)
objects += $(subst $(occaSPath)/,$(occaOPath)/,$(fsources:.f90=.o))
endif
endif
ifdef OCCA_DEVELOPER
ifeq ($(OCCA_DEVELOPER), 1)
developerDependencies = $(occaOPath)/occaKernelDefines.o
else
developerDependencies =
endif
else
developerDependencies =
endif
$(occaLPath)/libocca.so:$(objects) $(headers)
$(compiler) $(compilerFlags) -shared -o $(occaLPath)/libocca.so $(flags) $(objects) $(paths) $(filter-out -locca, $(links))
$(occaOPath)/%.o:$(occaSPath)/%.cpp $(occaIPath)/%.hpp$(wildcard $(subst $(occaSPath)/,$(occaIPath)/,$(<:.cpp=.hpp))) $(wildcard $(subst $(occaSPath)/,$(occaIPath)/,$(<:.cpp=.tpp))) $(developerDependencies)
$(compiler) $(compilerFlags) -o $@ $(flags) -c $(paths) $<
$(occaOPath)/%.o:$(occaSPath)/%.c $(occaIPath)/occaCBase.hpp $(developerDependencies)
$(compiler) $(compilerFlags) -o $@ $(flags) -c $(paths) $<
$(occaOPath)/occaFTypes.o:$(occaSPath)/occaFTypes.f90
$(Fcompiler) $(FcompilerFlags) $(FcompilerModFlag) $(occaLPath) -o $@ -c $<
$(occaOPath)/occaFTypes.mod:$(occaSPath)/occaFTypes.f90 $(occaOPath)/occaFTypes.o
@true
$(occaOPath)/occaF.o:$(occaSPath)/occaF.f90 $(occaOPath)/occaFTypes.mod
$(Fcompiler) $(FcompilerFlags) $(FcompilerModFlag) $(occaLPath) -o $@ -c $<
$(occaOPath)/%.o:$(occaSPath)/%.c $(occaIPath)/occaCBase.hpp $(developerDependencies)
$(compiler) $(compilerFlags) -o $@ $(flags) -c $(paths) $<
$(occaOPath)/occaCOI.o:$(occaSPath)/occaCOI.cpp $(occaIPath)/occaCOI.hpp
$(compiler) $(compilerFlags) -o $@ $(flags) -Wl,--enable-new-dtags -c $(paths) $<
ifdef OCCA_DEVELOPER
ifeq ($(OCCA_DEVELOPER), 1)
$(occaOPath)/occaKernelDefines.o: \
$(occaIPath)/defines/occaOpenMPDefines.hpp \
$(occaIPath)/defines/occaOpenCLDefines.hpp \
$(occaIPath)/defines/occaCUDADefines.hpp \
$(occaIPath)/defines/occaPthreadsDefines.hpp \
$(occaIPath)/defines/occaCOIDefines.hpp \
$(occaIPath)/defines/occaCOIMain.hpp \
$(occaIPath)/occaKernelDefines.hpp
$(compiler) $(compilerFlags) -o $(occaOPath)/occaKernelDefines.o $(flags) -c $(paths) $(occaSPath)/occaKernelDefines.cpp
$(OCCA_DIR)/scripts/occaKernelDefinesGenerator:\
$(occaIPath)/defines/occaOpenMPDefines.hpp \
$(occaIPath)/defines/occaOpenCLDefines.hpp \
$(occaIPath)/defines/occaCUDADefines.hpp \
$(occaIPath)/defines/occaPthreadsDefines.hpp \
$(occaIPath)/defines/occaCOIDefines.hpp \
$(occaIPath)/defines/occaCOIMain.hpp
$(compiler) -o $(OCCA_DIR)/scripts/occaKernelDefinesGenerator $(OCCA_DIR)/scripts/occaKernelDefinesGenerator.cpp
$(occaIPath)/occaKernelDefines.hpp:$(OCCA_DIR)/scripts/occaKernelDefinesGenerator
$(OCCA_DIR)/scripts/occaKernelDefinesGenerator $(OCCA_DIR)
endif
endif
clean:
rm -f $(occaOPath)/*;
rm -f ${OCCA_DIR}/scripts/main;
rm -f $(occaLPath)/libocca.a;
rm -f $(occaLPath)/*.mod;
rm -f $(OCCA_DIR)/scripts/occaKernelDefinesGenerator
#=================================================