Makefile
9.41 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
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
262
263
264
265
266
SHELL = /bin/sh
#
# To run under unix systems including cygwin or mingw on windows make the software with the following:
# 'make'
#
# To make a native windows executable under mingw use
# 'make OS=WINDOWS'
#
# To clean all object files, module files and executables use
# 'make clean'
#
# Note that you may need to change the name of the fortran compiler (FC below)
# and FLAGS depending on your system. The setup below is suitable for gnufortran
#
FC=gfortran
#
ifeq ($(OS),WINDOWS)
MODE=WINDOWS
else
MODE=UNIX
endif
# Compilation flags, Option 1. Here we compile with bounds check - slow but good for development testing...
FLAGS= -D$(MODE) -cpp -std=f2008 -fbounds-check -finit-real=nan -finit-integer=nan -J$(OBJ_MOD_DIR) -I$(OBJ_MOD_DIR)
# Compilation flags, Option 1b. as for option 1 but we compile with -static (for Windows)
#FLAGS= -D$(MODE) -static -cpp -std=f2008 -fbounds-check -finit-real=nan -finit-integer=nan -J$(OBJ_MOD_DIR) -I$(OBJ_MOD_DIR)
# Compilation flags, Option 2. Compilation flags, Here we compile with optimisation - fastest
#FLAGS= -D$(MODE) -cpp -J$(OBJ_MOD_DIR) -I$(OBJ_MOD_DIR) -O4
# Compilation flags, Option 2b. as for option 2 but we compile with -static (for Windows)
#FLAGS= -D$(MODE) -static -cpp -J$(OBJ_MOD_DIR) -I$(OBJ_MOD_DIR) -O4
SRC_DIRECTORY:= $(shell pwd)
TOP_LEVEL_DIRECTORY:=$(shell dirname ${SRC_DIRECTORY})
EXECUTABLE_DIR=$(TOP_LEVEL_DIRECTORY)/bin
OBJ_MOD_DIR=$(TOP_LEVEL_DIRECTORY)/obj_mod
# export the directories, compiler name and flags
export OBJ_MOD_DIR
export FLAGS
export FC
# Specify the object files to compile in the sub-directories and the
# modules which are required to specify the dependencies correctly for a F90 project.
# Then we can export them so that they can be used in dependency lists.
# Note that the order of compilation has been arranged carefully
# such that compilation of files is only dependent on what has happened upstream in the make process
# If a fortran source file uses a module then the dependency must be on both the .mod and the .o file
# as the .mod file timestamp does not necessarily change when the module is recompiled if the contents of the mod file do not change
# see for example: https://gcc.gnu.org/ml/fortran/2007-11/msg00013.html
# Note also that gfortran creates module files with lower case names whatever the case of the module name in the .F90 file...
COMPILATION_DATE:= $(shell date)
include ../version_information.inc
TYPE_SPEC_OBJS= $(OBJ_MOD_DIR)/type_specifications.o
export TYPE_SPEC_OBJS
TYPE_SPEC_MODULE=$(OBJ_MOD_DIR)/type_specifications.mod $(TYPE_SPEC_OBJS)
export TYPE_SPEC_MODULE
GENERAL_MODULES_OBJS= $(OBJ_MOD_DIR)/constants.o \
$(OBJ_MOD_DIR)/general_module.o \
$(OBJ_MOD_DIR)/frequency_spec.o
export GENERAL_MODULES_OBJS
GENERAL_MODULE= $(OBJ_MOD_DIR)/general_module.o
export GENERAL_MODULE
CONSTANTS_MODULE=$(OBJ_MOD_DIR)/constants.mod $(OBJ_MOD_DIR)/constants.o
export CONSTANTS_MODULE
FREQ_MODULE=$(OBJ_MOD_DIR)/frequency_spec.mod $(OBJ_MOD_DIR)/frequency_spec.o
export FREQ_MODULE
EISPACK_OBJS=$(OBJ_MOD_DIR)/eispack.o
export EISPACK_OBJS
EISPACK_MODULE=$(OBJ_MOD_DIR)/eispack.o $(OBJ_MOD_DIR)/eispack.mod
export EISPACK_MODULE
MATHS_OBJS=$(OBJ_MOD_DIR)/maths.o
export MATHS_OBJS
MATHS_MODULE=$(OBJ_MOD_DIR)/maths.o $(OBJ_MOD_DIR)/maths.mod
export MATHS_MODULE
POLYNOMIAL_AND_FILTER_MODULES_OBJS=$(OBJ_MOD_DIR)/filter_module.o
export POLYNOMIAL_AND_FILTER_MODULES_OBJS
POLYNOMIAL_AND_FILTER_MODULE=$(OBJ_MOD_DIR)/filter_module.o $(OBJ_MOD_DIR)/filter_module.mod
export POLYNOMIAL_AND_FILTER_MODULES
SFILTER_FIT_OBJS=$(OBJ_MOD_DIR)/Sfilter_fit_module.o
export SFILTER_FIT_OBJS
SFILTER_FIT_MODULES=$(OBJ_MOD_DIR)/Sfilter_fit_module.o $(OBJ_MOD_DIR)/sfilter_fit_module.mod
export SFILTER_FIT_MODULES
CABLE_MODULE_OBJS=$(OBJ_MOD_DIR)/cable_module.o
export CABLE_MODULE_OBJS
CABLE_MODULE=$(OBJ_MOD_DIR)/cable_module.o $(OBJ_MOD_DIR)/cable_module.mod
export CABLE_MODULE
CABLE_BUNDLE_MODULE_OBJS=$(OBJ_MOD_DIR)/cable_bundle_module.o
export CABLE_BUNDLE_MODULE_OBJS
CABLE_BUNDLE_MODULE=$(OBJ_MOD_DIR)/cable_bundle_module.o $(OBJ_MOD_DIR)/cable_bundle_module.mod
export CABLE_BUNDLE_MODULE
SPICE_CABLE_BUNDLE_MODULE_OBJS=$(OBJ_MOD_DIR)/spice_cable_bundle_module.o \
$(OBJ_MOD_DIR)/circuit_symbol_module.o
export SPICE_CABLE_BUNDLE_MODULE_OBJS
SPICE_CABLE_BUNDLE_MODULE=$(OBJ_MOD_DIR)/spice_cable_bundle_module.o $(OBJ_MOD_DIR)/spice_cable_bundle_module.mod
export SPICE_CABLE_BUNDLE_MODULE
CIRCUIT_SYMBOL_MODULE=$(OBJ_MOD_DIR)/circuit_symbol_module.o $(OBJ_MOD_DIR)/circuit_symbol_module.mod
export CIRCUIT_SYMBOL_MODULE
PUL_PARAMETER_CALCULATION_OBJS=$(OBJ_MOD_DIR)/PUL_parameter_module.o
export PUL_PARAMETER_CALCULATION_OBJS
PUL_PARAMETER_MODULE=$(OBJ_MOD_DIR)/PUL_parameter_module.o $(OBJ_MOD_DIR)/pul_parameter_module.mod
export PUL_PARAMETER_MODULE
BUNDLE_DOMAIN_CREATION_OBJS=$(OBJ_MOD_DIR)/bundle_domain_creation.o
export BUNDLE_DOMAIN_CREATION_OBJS
BUNDLE_DOMAIN_CREATION_MODULE=$(OBJ_MOD_DIR)/bundle_domain_creation.o $(OBJ_MOD_DIR)/bundle_domain_creation.mod
export BUNDLE_DOMAIN_CREATION_MODULE
MTL_ANALYTIC_SOLUTION_OBJS= $(OBJ_MOD_DIR)/MTL_analytic_solution.o
export MTL_ANALYTIC_SOLUTION_OBJS
MTL_ANALYTIC_SOLUTION_MODULE=$(OBJ_MOD_DIR)/MTL_analytic_solution.o $(OBJ_MOD_DIR)/mtl_analytic_solution.mod
export MTL_ANALYTIC_SOLUTION_MODULE
CREATE_SPICE_CIRCUIT_MODEL_OBJS=$(OBJ_MOD_DIR)/create_spice_model.o
export CREATE_SPICE_CIRCUIT_MODEL_OBJS
CREATE_SPICE_CIRCUIT_MODEL_MODULE=$(OBJ_MOD_DIR)/create_spice_model.o $(OBJ_MOD_DIR)/create_spice_model.mod
export CREATE_SPICE_CIRCUIT_MODEL_MODULE
OBJS= \
$(TYPE_SPEC_OBJS) \
$(GENERAL_MODULES_OBJS) \
$(EISPACK_OBJS) \
$(MATHS_OBJS) \
$(POLYNOMIAL_AND_FILTER_MODULES_OBJS) \
$(SFILTER_FIT_OBJS) \
$(PUL_PARAMETER_CALCULATION_OBJS) \
$(CABLE_MODULE_OBJS) \
$(CABLE_BUNDLE_MODULE_OBJS) \
$(SPICE_CABLE_BUNDLE_MODULE_OBJS) \
$(BUNDLE_DOMAIN_CREATION_OBJS) \
$(MTL_ANALYTIC_SOLUTION_OBJS) \
$(CREATE_SPICE_CIRCUIT_MODEL_OBJS)
MODS= \
$(TYPE_SPEC_MODULE) \
$(CONSTANTS_MODULE) \
$(GENERAL_MODULE) \
$(FREQ_MODULE) \
$(EISPACK_MODULE) \
$(MATHS_MODULE) \
$(POLYNOMIAL_AND_FILTER_MODULES) \
$(SFILTER_FIT_MODULES) \
$(PUL_PARAMETER_MODULE) \
$(CABLE_MODULE) \
$(CABLE_BUNDLE_MODULE) \
$(SPICE_CABLE_BUNDLE_MODULE) \
$(CIRCUIT_SYMBOL_MODULE) \
$(BUNDLE_DOMAIN_CREATION_MODULE) \
$(MTL_ANALYTIC_SOLUTION_MODULE) \
$(CREATE_SPICE_CIRCUIT_MODEL_MODULE)
default: \
MAKE_COMPILATION_DATE \
MAKE_TYPE_SPECIFICATION_MODULE \
MAKE_GENERAL_MODULES \
MAKE_EISPACK \
MAKE_MATHS_MODULES \
MAKE_POLYNOMIAL_AND_FILTER_MODULES \
MAKE_SFILTER_FIT_MODULES \
MAKE_PUL_PARAMETER_CALCULATION \
MAKE_CABLE_MODULES \
MAKE_CABLE_BUNDLE_MODULES \
MAKE_SPICE_CABLE_BUNDLE_MODULES \
MAKE_BUNDLE_DOMAIN_CREATION \
MAKE_MTL_ANALYTIC_SOLUTION \
MAKE_CREATE_SPICE_CIRCUIT_MODEL \
cable_model_builder \
cable_bundle_model_builder \
spice_cable_bundle_model_builder \
shield_conductor_and_transfer_impedance_model_builder \
rational_function_fit \
compare_results
MAKE_COMPILATION_DATE:
echo "SPICE_CABLE_MODEL_BUILDER_compilation_date='$(COMPILATION_DATE)' " > compilation_date.inc
MAKE_TYPE_SPECIFICATION_MODULE:
( cd TYPE_SPECIFICATION_MODULE ; $(MAKE) )
MAKE_GENERAL_MODULES:
( cd GENERAL_MODULES ; $(MAKE) )
MAKE_EISPACK:
( cd EISPACK ; $(MAKE) )
MAKE_MATHS_MODULES:
( cd MATHS_MODULES ; $(MAKE) )
MAKE_POLYNOMIAL_AND_FILTER_MODULES:
( cd POLYNOMIAL_AND_FILTER_MODULES ; $(MAKE) )
MAKE_SFILTER_FIT_MODULES:
( cd SFILTER_FIT ; $(MAKE) )
MAKE_CABLE_MODULES:
( cd CABLE_MODULES ; $(MAKE) )
MAKE_CABLE_BUNDLE_MODULES:
( cd CABLE_BUNDLE_MODULES ; $(MAKE) )
MAKE_SPICE_CABLE_BUNDLE_MODULES:
( cd SPICE_CABLE_BUNDLE_MODULES ; $(MAKE) )
MAKE_BUNDLE_DOMAIN_CREATION:
( cd BUNDLE_DOMAIN_CREATION ; $(MAKE) )
MAKE_PUL_PARAMETER_CALCULATION:
( cd PUL_PARAMETER_CALCULATION ; $(MAKE) )
MAKE_MTL_ANALYTIC_SOLUTION:
( cd MTL_ANALYTIC_SOLUTION ; $(MAKE) )
MAKE_CREATE_SPICE_CIRCUIT_MODEL:
( cd CREATE_SPICE_CIRCUIT_MODEL ; $(MAKE) )
cable_model_builder: cable_model_builder.F90 $(MODS)
$(FC) $(FLAGS) -o $(EXECUTABLE_DIR)/cable_model_builder cable_model_builder.F90 $(OBJS) $(LIBS)
cable_bundle_model_builder: cable_bundle_model_builder.F90 $(MODS)
$(FC) $(FLAGS) -o $(EXECUTABLE_DIR)/cable_bundle_model_builder cable_bundle_model_builder.F90 $(OBJS) $(LIBS)
spice_cable_bundle_model_builder: spice_cable_bundle_model_builder.F90 $(MODS)
$(FC) $(FLAGS) -o $(EXECUTABLE_DIR)/spice_cable_bundle_model_builder spice_cable_bundle_model_builder.F90 $(OBJS) $(LIBS)
shield_conductor_and_transfer_impedance_model_builder: shield_conductor_and_transfer_impedance_model_builder.F90 $(MODS)
$(FC) $(FLAGS) -o $(EXECUTABLE_DIR)/shield_conductor_and_transfer_impedance_model_builder shield_conductor_and_transfer_impedance_model_builder.F90 $(OBJS) $(LIBS)
rational_function_fit: rational_function_fit.F90 $(MODS)
$(FC) $(FLAGS) -o $(EXECUTABLE_DIR)/rational_function_fit rational_function_fit.F90 $(OBJS) $(LIBS)
compare_results: compare_results.F90 $(TYPE_SPEC_MODULE)
$(FC) $(FLAGS) -o $(EXECUTABLE_DIR)/compare_results compare_results.F90 $(OBJS) $(LIBS)
clean:
( rm -f $(EXECUTABLE_DIR)/cable_model_builder* )
( rm -f $(EXECUTABLE_DIR)/cable_bundle_model_builder* )
( rm -f $(EXECUTABLE_DIR)/spice_cable_bundle_model_builder* )
( rm -f $(EXECUTABLE_DIR)/shield_conductor_and_transfer_impedance_model_builder* )
( rm -f $(EXECUTABLE_DIR)/rational_function_fit* )
( rm -f $(EXECUTABLE_DIR)/compare_results* )
( rm -f *.o )
( rm -f $(OBJ_MOD_DIR)/*.mod )
( rm -f $(OBJ_MOD_DIR)/*.o )
# note that on windows machines the executables will have a .exe extension