Makefile (1276B)
1 FIG != basename $(PWD) 2 3 default: ../$(FIG).pdf 4 5 sim.output00001.txt: ../fig-stick_slip_stress/sim.output00001.txt 6 cp ../fig-stick_slip_stress/sim.output*.txt . 7 8 timeseries.txt: sim.output00001.txt 9 /bin/sh -c '\ 10 rm -f $@; \ 11 for f in sim.output*.txt; do \ 12 tail -n 1 "$$f" | cut -f2-6 >> $@; \ 13 done' 14 15 max_strainrate_depth.txt: sim.output00001.txt 16 /bin/sh -c '\ 17 rm -f $@; \ 18 for f in sim.output*.txt; do \ 19 awk " \ 20 BEGIN{getline; depth=8.0; max=0.0} \ 21 NF{ \ 22 if (\$$6 >= max && \$$6+0 > 1e-300) \ 23 { \ 24 max=\$$6; \ 25 depth=\$$1; \ 26 } \ 27 } \ 28 END{ \ 29 print depth,\"\t\",max \ 30 }" \ 31 "$$f" >> $@; \ 32 done' 33 34 sediment_flux.txt: sim.output00001.txt 35 /bin/sh -c '\ 36 rm -f $@; \ 37 for f in sim.output*.txt; do \ 38 awk " \ 39 BEGIN{getline; integral=0.0} \ 40 NF{ \ 41 if (NR > 1) \ 42 { \ 43 integral+=(\$$2+v_prev)/2.0*(\$$1-z_prev); \ 44 } \ 45 z_prev=\$$1; \ 46 v_prev=\$$2; \ 47 } \ 48 END{ \ 49 print integral \ 50 }" \ 51 "$$f" >> $@; \ 52 done' 53 54 timeseries_combined.txt: timeseries.txt max_strainrate_depth.txt sediment_flux.txt 55 paste timeseries.txt max_strainrate_depth.txt sediment_flux.txt > $@ 56 57 ../$(FIG).pdf: fig.gp timeseries_combined.txt 58 gnuplot fig.gp > $@ 59 60 clean: 61 rm -f *.txt 62 rm -f ../$(FIG).pdf 63 64 .PHONY: default clean