# -*-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) # 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 remote-top.log rm -f run_command.log lamboot.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 pc_collect: ( cd src && \ $(MAKE) FROM_PARENT=src/ pre_and_post_processing/pc_collect.x ) pc_reduce: ( cd src && \ $(MAKE) FROM_PARENT=src/ pre_and_post_processing/pc_reduce.x ) pc_distribute: ( cd src && \ $(MAKE) FROM_PARENT=src/ pre_and_post_processing/pc_distribute.x ) pc_distribute_z: ( cd src && \ $(MAKE) FROM_PARENT=src/ pre_and_post_processing/pc_distribute_z.x ) pc_extract: ( cd src && \ $(MAKE) FROM_PARENT=src/ pre_and_post_processing/pc_extract.x ) pc_configtest: ( cd src && \ $(MAKE) FROM_PARENT=src/ pre_and_post_processing/pc_configtest.x ) pc_tecplot: ( cd src && \ $(MAKE) FROM_PARENT=src/ pre_and_post_processing/pc_tecplot.x ) pc_tecplot_solid: ( cd src && \ $(MAKE) FROM_PARENT=src/ pre_and_post_processing/pc_tecplot_solid.x ) pc_meanfield_collect: ( cd src && \ $(MAKE) FROM_PARENT=src/ experimental/pc_meanfield_collect.x ) pc_h5collect: ( cd src && \ $(MAKE) FROM_PARENT=src/ experimental/pc_h5collect.x ) # 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|4) \ desired_precision='single'; \ echo '# Default flags: 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; \ case '$(MPICOMM)' in \ mpicomm) \ echo 'MPICOMM=mpicomm_double' >> src/Makefile.inc; \ ;; \ mpicomm_) \ echo 'MPICOMM=mpicomm_double_' >> src/Makefile.inc; \ ;; \ esac; \ ;; \ *) \ 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;