forked from pencil-code/pencil-code
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.parent
148 lines (129 loc) · 4.5 KB
/
Makefile.parent
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
# -*-Makefile-*- (for Emacs) vim:set filetype=make: (for vim)
#
# Makefile.parent
#
# Pencil Code Makefile for run directories that builds the code in the
# src/ subdirectory by running `make' there.
#
include src/Makefile.local
# Legacy stuff for adapt-mkfile users:
legacy_default: Makefile_inc Fortran_standard
touch src/.build-history
echo $(USER)"@"`hostname` "("`date`")" >> src/.build-history
( cd src && \
$(MAKE) FROM_PARENT=src/ ADAPT_MKFILE=$(ADAPT_MKFILE) \
-f Makefile.src Makefile && \
$(MAKE) FROM_PARENT=src/ \
)
# Build the code:
default_to_be: Makefile_inc Fortran_standard
touch src/.build-history
echo $(USER)"@"`hostname` "("`date`")" >> src/.build-history
( cd src && \
echo "===== " $(MAKE) FROM_PARENT=src/ -f Makefile.src code "====="; \
$(MAKE) FROM_PARENT=src/ -f Makefile.src default_to_be \
)
# Use calculated dependencies instead:
depend dep:
(cd src; $(MAKE) FROM_PARENT=src/ -f Makefile.src depend)
# Slender src/ directory:
slender:
(cd src; $(MAKE) FROM_PARENT=src/ -f Makefile.src slender)
# Clean up most files:
clean:
(cd src; $(MAKE) FROM_PARENT=src/ -f Makefile.src clean)
# Clean up even more files:
cleann:
(cd src; $(MAKE) FROM_PARENT=src/ -f Makefile.src cleann)
# Same thing:
cleanall: cleann
# Clean up log files.
cleanlog: qoutclean
rm -f *.log lamhosts
# Try to remove everything generated by pc_setupsrc, compilation, etc.
distclean: cleann cleanlog
rm -f {getconf,start,run,start_run}.csh
(cd src; $(MAKE) FROM_PARENT=src/ -f Makefile.src distclean)
rm -f Makefile
# Compile with -g
debug:
(cd src; $(MAKE) FROM_PARENT=src/ debug)
# Clean up files produced by common queuing systems:
qoutclean:
rm -f start.csh.[eo][0-9]* start.csh.[0-9]*out
rm -f run.csh.[eo][0-9]* run.csh.[0-9]*out
rm -f start_run.csh.[eo][0-9]* start_run.csh.[0-9]*out
rm -f start.csh.p[eo][0-9]* start.csh.p[0-9]*out
rm -f run.csh.p[eo][0-9]* run.csh.p[0-9]*out
rm -f start_run.csh.p[eo][0-9]* start_run.csh.p[0-9]*out
# Clean up files produced by running MPI
mpiclean:
rm -f copy-snapshots.log copy-snapshots2.log lamhosts lamboot.log remote-top.log
# Divine our configuration
semiauto-conf:
$(MAKE) -s cleanall
@(cd src; $(MAKE) -s FROM_PARENT=src/ semiauto-conf)
# Compile tools for collecting, downscaling, and distributing data cubes
tools: default
# MR: which is the target "default"?
pc_collect pc_collect_pvar pc_reduce pc_distribute pc_distribute_z pc_extract pc_configtest pc_tecplot pc_tecplot_solid: Makefile_inc
( cd src && \
$(MAKE) FROM_PARENT=src/ pre_and_post_processing/[email protected] )
pc_meanfield_collect pc_h5collect: Makefile_inc
( cd src && \
$(MAKE) FROM_PARENT=src/ experimental/[email protected] )
read_all_videofiles read_videofiles combine_videofiles read_vectorfiles start run: Makefile_inc
( cd src && \
$(MAKE) FROM_PARENT=src/ [email protected] )
fast: Makefile_inc
( cd src && \
$(MAKE) FROM_PARENT=src/ fast )
helper_min: Makefile_inc
( cd src && \
$(MAKE) FROM_PARENT=src/ helper_min )
#
# This should be triggered automatically, only if "pencil-code/src/Makefile.src" has changed, but is currently inactive:
setupsrc_inc: $(PENCIL_HOME)/src/Makefile.src
pc_setupsrc
# Manually trigger "pc_setupsrc"
setup: setupsrc_inc
# Create Makefile.inc, but need this to be a `phony' target (i.e. not a
# filename as target), so this file is always written.
# Don't know whether .PHONY declaration is portable, so we just slightly
# rename the target.
Makefile_inc:
@echo "MAKING src/Makefile.inc"
@printf \
"%s\n" \
'# src/Makefile.inc -*-Makefile-*- (for Emacs)' \
'# ----------------' \
'' \
"# This file was automatically generated at `date` by 'make'." \
'# Its main role is to set the precision (single vs. double) of a' \
'# run for compilation.' \
'' > src/Makefile.inc
@case "$(REAL_PRECISION)" in \
''|default|single|4) \
desired_precision='single'; \
echo '# Setting: single precision' >> src/Makefile.inc; \
;; \
double|8) \
desired_precision='double'; \
echo 'FFLAGS_GENERAL=$$(FFLAGS_DOUBLE)' >> src/Makefile.inc; \
echo 'CFLAGS_GENERAL=$$(CFLAGS_DOUBLE)' >> src/Makefile.inc; \
;; \
*) \
echo "What is REAL_PRECISION=$(REAL_PRECISION) supposed to mean?"; \
exit 1; \
;; \
esac; \
./src/scripts/precision-check src/.current-precision "$$desired_precision"
Fortran_standard:
@case "$(FILE_IO)" in \
'file_io_f2003') \
echo "FSTD=$(FSTD_2003)" > src/Makefile-standard.inc; \
;; \
*) \
echo "FSTD=$(FSTD_95)" > src/Makefile-standard.inc; \
;; \
esac;