summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugeniy Mikhailov <evgmik@gmail.com>2016-10-25 23:53:01 -0400
committerEugeniy Mikhailov <evgmik@gmail.com>2016-10-25 23:53:01 -0400
commit3b0ce7619631ecdca8f8a595b3a73fe02b97e5d9 (patch)
tree197eaa4247491fa7c868abc8ea814debb2851a03
parentf4eca53e38cccb0c5c84ac6f0d7e0725cb62bcf4 (diff)
downloadmakefile_templates-3b0ce7619631ecdca8f8a595b3a73fe02b97e5d9.tar.gz
makefile_templates-3b0ce7619631ecdca8f8a595b3a73fe02b97e5d9.zip
matlab plots are done via pipe
-rw-r--r--matlab_eps.mk19
1 files changed, 15 insertions, 4 deletions
diff --git a/matlab_eps.mk b/matlab_eps.mk
index 71e0f13..c184896 100644
--- a/matlab_eps.mk
+++ b/matlab_eps.mk
@@ -3,11 +3,17 @@
CLEAN_TARGETS += clean_matlab_eps_targets
REAL_CLEAN_TARGETS += real_clean_matlab_eps_targets
-MATLAB ?= matlab -nodesktop -nosplash
-MATLAB_INITIATE_FIGURE = "h=figure('visible', 'off');"
+# MATLAB ?= matlab -nodesktop -nosplash
+# MATLAB_quit = quit
+MATLAB ?= cmd2screen.sh
+MATLAB_quit ?=
+MATLAB_CLEAR = "clear;"
+MATLAB_STORE_OLDPWD = "oldpwd=pwd;"
+MATLAB_RESTORE_OLDPWD = "cd(oldpwd);"
+MATLAB_PWD = "cd '$(CURDIR)';"
+MATLAB_INITIATE_FIGURE = "h=figure('visible', 'off'); clf;"
MATLAB_EPS_PRINT_strt = print('-depsc',
MATLAB_EPS_PRINT_stop = );
-MATLAB_quit = quit
matlab_sources = $(wildcard plot_*.m)
@@ -19,9 +25,14 @@ copy_matlab_pdf_targets: dest_dir_matlab $(matlab_pdf_targets)
$(matlab_eps_targets): %.eps : plot_%.m
tmp=`mktemp`; \
- echo $(MATLAB_INITIATE_FIGURE) > $${tmp}; \
+ touch $${tmp}; \
+ echo $(MATLAB_CLEAR) >> $${tmp}; \
+ echo $(MATLAB_STORE_OLDPWD) >> $${tmp}; \
+ echo $(MATLAB_PWD) >> $${tmp}; \
+ echo $(MATLAB_INITIATE_FIGURE) >> $${tmp}; \
cat $< >> $${tmp}; \
echo "$(MATLAB_EPS_PRINT_strt)'$@'$(MATLAB_EPS_PRINT_stop)" >> $${tmp}; \
+ echo $(MATLAB_RESTORE_OLDPWD) >> $${tmp}; \
echo "$(MATLAB_quit)" >> $${tmp}; \
cat $${tmp} | $(MATLAB); \
rm -f $${tmp}