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 NETWORK_SYNTHESIS_MODEL_OBJS=$(OBJ_MOD_DIR)/module_network_synthesis.o export NETWORK_SYNTHESIS_MODEL_OBJS NETWORK_SYNTHESIS_MODEL_MODULE=$(OBJ_MOD_DIR)/module_network_synthesis.o $(OBJ_MOD_DIR)/module_network_synthesis.mod export NETWORK_SYNTHESIS_MODEL_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) \ $(NETWORK_SYNTHESIS_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) \ $(NETWORK_SYNTHESIS_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_NETWORK_SYNTHESIS \ 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 \ write_FH_input_file 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_NETWORK_SYNTHESIS: ( cd NETWORK_SYNTHESIS ; $(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) write_FH_input_file: write_FH_input_file.F90 WRITE_FH2_IPFILE/create_grid.F90 \ WRITE_FH2_IPFILE/get_grid_type.F90 \ WRITE_FH2_IPFILE/set_segments_from_grid.F90 $(FC) $(FLAGS) -o $(EXECUTABLE_DIR)/write_FH_input_file write_FH_input_file.F90 $(TYPE_SPEC_OBJS) 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 $(EXECUTABLE_DIR)/write_FH_input_file* ) ( 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