-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
154 lines (127 loc) · 5.38 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
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
#
# top-level makefile for pepc
#
ROOTDIR = $(shell pwd)
REVISION = $(shell git describe --all --long --dirty)
include tools/build/makefile.paths
include makefile.defs
ALLFRONTENDS = $(shell ls $(FRONTENDDIR))
RED=\e[0;31m
GREEN=\e[0;32m
BC=\e[1m# bold
UL=\e[4m# underline
NC=\e[0m# No Color, default font
help: info
@printf "$(HELP)\n"
@echo ""
info:
@printf "======== $(UL)make info$(NC)\n"
@printf "==== target architecture : $(BC)$(MACH)$(NC)\n"
@printf "==== code version : $(BC)$(REVISION)$(NC)\n"
@printf "==== pepc directory : $(BC)$(ROOTDIR)$(NC)\n"
@printf "==== available frontends : $(BC)$(ALLFRONTENDS)$(NC)\n"
@if [ "$(MACH)" = "linux_intel" ]; then printf "$(RED)If you experience memory or threading issues with Intel's compiler or OpenMP runtime, look into the OMP_STACKSIZE environment variable (and increase it).$(NC)\n"; fi
@echo ""
buildenv:
@printf "======== $(UL)build environment$(NC)\n"
@printf "== CPP : $(BC)$(CPP)$(NC)\n"
@printf "== CPPFLAGS : $(BC)$(CPPFLAGS)$(NC)\n"
@printf "== FCPRE : $(BC)$(FCPRE)$(NC)\n"
@printf "== FC : $(BC)$(FC)$(NC)\n"
@printf "== FFLAGS : $(BC)$(FFLAGS)$(NC)\n"
@printf "== CCPRE : $(BC)$(CCPRE)$(NC)\n"
@printf "== CC : $(BC)$(CC)$(NC)\n"
@printf "== CFLAGS : $(BC)$(CFLAGS)$(NC)\n"
@printf "== LDPRE : $(BC)$(LDPRE)$(NC)\n"
@printf "== LD : $(BC)$(LD)$(NC)\n"
@printf "== LDFLAGS : $(BC)$(LDFLAGS)$(NC)\n"
@echo ""
readme:
cat README.md | less
all:
-$(MAKE) $(MFLAGS) -k $(ALLFRONTENDS)
@echo ""
$(MAKE) $(MFLAGS) allresult
allresult:
@printf "======== $(UL)build all results$(NC)\n"
@for f in $(ALLFRONTENDS); do if [ -e ${BINDIR}/$$f ]; then printf "== %-20s $(GREEN)OK$(NC)\n" $$f ; else printf "== %-20s $(RED)FAILED$(NC)\n" $$f; E="FAILED"; fi; done; if [ "x$$E" = "xFAILED" ] ; then exit 127; fi
@echo ""
libsl: $(LIBDIR)/libsl.a
$(LIBDIR)/libsl.a: $(LIBDIR)
@printf "==== $(UL)building libsl$(NC)\n"
@ln -sf "$(ROOTDIR)/makefile.defs" "$(SLPEPCDIR)/makefile.defs"
@$(MAKE) -C "$(SLPEPCDIR)" $(MFLAGS)
@cp -p "$(SLPEPCDIR)/libsl.a" "$(LIBDIR)/libsl.a"
libopa: $(LIBDIR)/libopa.a
$(LIBDIR)/libopa.a: $(LIBDIR)
@printf "==== $(UL)building openpa$(NC)\n"
@ROOTDIR="$(ROOTDIR)" $(MAKE) -C "$(OPADIR)" $(MFLAGS)
clean:
@printf "==== $(UL)cleaning build directory and binaries in bin directory$(NC)\n"
@$(RM) makefile.envs
@$(RM) "$(BUILDDIR)" $(addprefix $(BINDIR)/, $(ALLFRONTENDS))
@echo ""
cleanlib:
@printf "==== $(UL)cleaning libraries$(NC)\n"
@$(RM) "$(LIBDIR)"
@ln -sf "$(ROOTDIR)/makefile.defs" "$(SLPEPCDIR)/makefile.defs"
@cd src/treecode/sl_pepc && $(MAKE) $(MFLAGS) clean
@ROOTDIR="$(ROOTDIR)" $(MAKE) -C "$(OPADIR)" $(MFLAGS) clean
@echo ""
cleandoc:
@printf "==== $(UL)cleaning Doxygen documentation$(NC)\n"
@$(RM) "$(DOCDIR)"
cleanall: cleanlib cleandoc clean
@-$(RM) "$(BINDIR)"
@printf "==== $(UL)all cleaned$(NC)\n"
allclean: cleanall
pepc-%: pepclogo info buildenv $(LIBDIR)/libsl.a $(LIBDIR)/libopa.a
@if [ "$(MACH)" = "linux_nvhpc" ]; then if [ "$@" = "pepc-v" ]; then printf "======== $(RED)Frontend $@ broken with NVHPC, c.f. #18. Aborting.$(NC)\n"; false; fi; fi
@if [ ! -d "$(FRONTENDDIR)/$@" ]; then printf "======== $(RED)Frontend $@ does not exist. Aborting.$(NC)\n"; false; fi
@printf "======== start building frontend $(BC){ $@ }$(NC)\n"
@printf "==== date: $(BC)$(shell "date")$(NC)\n"
@printf "==== make target: $(BC)$@$(NC)\n"
@mkdir -p "$(BUILDDIR)/$(MACH)/$@"
@mkdir -p "$(BINDIR)"
@-$(RM) "$(BINDIR)/$@"
@FRONTEND="$@" ROOTDIR="$(ROOTDIR)" REVISION="$(REVISION)" WORKDIR="$(BUILDDIR)/$(MACH)/$@" $(MAKE) $(MFLAGS) -f "$(MAKEDIR)/makefile.prepare"
@cp -p "$(BUILDDIR)/$(MACH)/$@/$@" "$(BINDIR)"
@echo ""
@printf "======== $(GREEN)successfully built frontend { $@ } :-)$(NC)\n"
@echo ""
$(LIBDIR):
@mkdir "$(LIBDIR)"
$(DOCDIR):
@mkdir -p "$(DOCDIR)"
doc: $(DOCDIR) $(TOOLSDIR)/Doxyfile
@printf "======== start building Doxygen documentation\n"
@doxygen "$(TOOLSDIR)/Doxyfile"
@printf "=== you can view the source code documentation by opening $(BOLD)$(DOCDIR)/index.html$(NC) with your favourite web browser\n"
MAKEFILEDEFSINFO = "\n\n\
!!! To be able to build pepc, you first have to create a \n\
file called 'makefile.defs' inside the pepc root directory. \n\
A number of example files is contained in the\n\
'makefiles' directory. They usually can be used use by creating a symbolic link\n\n\
> ln -sf makefiles/makefile.defs.extension ./makefile.defs\n\n\
After creating this link to a certain file, a call of\n\n\
> make help\n\n\
might give you further information. Additionally, consider calling\n\n\
> make readme\n\n\
for a detailed description of what has to be done for getting pepc running.\n\
For some special configuration you might have to adapt\n\
the makefile.defs file to refelct your particular setup\n\
(copiler names, pathes, etc.)\n\
"
makefile.defs:
@printf $(MAKEFILEDEFSINFO)
@echo ""
@exit 1
pepclogo:
@echo " _____ ____ _____ _____ "
@echo " /\ _ \`\/\ __\/\ _ \`\/\ __\`\ The "
@echo " \ \ \L\ \ \ \_L\ \ \L\ \ \ \/\_\ Pretty Efficient "
@echo " \ \ ,__/\ \ _\\ \ ,__/\ \ \/_/_ Parallel Coulomb "
@echo " \ \ \/ \ \ \_L\ \ \/ \ \ \_\ \ Solver "
@echo " \ \_\ \ \____\ \_\ \ \____/ "
@echo " \/_/ \/____/\/_/ \/___/ [email protected] "
@echo ""