Makefile: Use the more portable printf over `echo -e`
authorW. Trevor King <wking@tremily.us>
Fri, 22 Feb 2013 16:33:10 +0000 (11:33 -0500)
committerW. Trevor King <wking@tremily.us>
Fri, 22 Feb 2013 16:33:13 +0000 (11:33 -0500)
See POSIX-2008 for details:

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/echo.html
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/printf.html

Makefile

index ec3bc3e262f98a22960cc35d451c047010afc5ea..45ccbbaeb0f974db026de214c8f6ec6d2ccc4589 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -145,23 +145,23 @@ run: angle-vs-y0.png time-vs-y0.png trajectories.png \
 
 .SECONDEXPANSION:
 final-vs-y0.data: scatter
-       echo -e "# y0\ttime\tangle\tenergy" > "$@"
+       printf "# y0\ttime\tangle\tenergy\n" > "$@"
        for y0 in $$(seq 0 0.0008 0.8); do \
-               echo -en "$$y0\t" >> "$@"; \
+               printf "%s\t" "$$y0" >> "$@"; \
                ./scatter --y0 "$$y0" --final >> "$@"; \
        done
 
 .SECONDEXPANSION:
 final-vs-y0-zoom.data: scatter
-       echo -e "# y0\ttime\tangle\tenergy" > "$@"
+       printf "# y0\ttime\tangle\tenergy\n" > "$@"
        for y0 in $$(seq 0.2772 0.0000008 0.2780); do \
-               echo -en "$$y0\t" >> "$@"; \
+               printf "%s\t" "$$y" >> "$@"; \
                ./scatter --y0 "$$y0" --final >> "$@"; \
        done
 
 .SECONDEXPANSION:
 trajectories.data: scatter
-       echo -e "# t\tx\ty\tv_x\tv_y\tenergy" > "$@"
+       printf "# time\tx\ty\tv_x\tv_y\tenergy\n" > "$@"
        for y0 in 0.024 0.0312 0.277672 0.277776 0.2784 0.3024; do \
                ./scatter --y0 "$$y0" >> "$@"; \
                echo '' >> "$@"; \
@@ -172,10 +172,10 @@ trajectories.data: scatter
 #              for E in $$(seq 0.1 0.00107421875 1.2); do 
 .SECONDEXPANSION:
 final-vs-y0-E.data: scatter
-       echo -e "# y0\tinitial energy\ttime\tangle\tenergy" > "$@"
+       printf "# y0\tinitial energy\ttime\tangle\tenergy\n" > "$@"
        for y0 in $$(seq 0.0 0.1 0.8); do \
                for E in $$(seq 0.1 0.1 1.2); do \
-                       echo -en "$$y0\t$$E\t" >> "$@"; \
+                       printf "%s\t%s\t" "$$y0" "$$E" >> "$@"; \
                        ./scatter --y0 "$$y0" --vx0-energy "$$E" --final >> "$@"; \
                done \
        done