diff options
author | Eugeniy Mikhailov <evgmik@gmail.com> | 2015-08-31 10:49:42 -0400 |
---|---|---|
committer | Eugeniy Mikhailov <evgmik@gmail.com> | 2015-08-31 10:49:42 -0400 |
commit | bc537b60cc04614b8481a2c56a350e2311e31fcf (patch) | |
tree | 2664dea299f7ad18d79dc1f06e241c3d9829aaf2 | |
parent | 0dd842d2cd4c0394c8212733795b4a1e039c37ed (diff) | |
download | makefile_templates-bc537b60cc04614b8481a2c56a350e2311e31fcf.tar.gz makefile_templates-bc537b60cc04614b8481a2c56a350e2311e31fcf.zip |
added makefile to generate figures with matlab
-rw-r--r-- | matlab_eps.mk | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/matlab_eps.mk b/matlab_eps.mk new file mode 100644 index 0000000..d3d7ae8 --- /dev/null +++ b/matlab_eps.mk @@ -0,0 +1,43 @@ +# -*- make -*- + +CLEAN_TARGETS += clean_matlab_eps_targets +REAL_CLEAN_TARGETS += real_clean_matlab_eps_targets + +MATLAB ?= matlab -nodesktop -nojvm -nosplash +MATLAB_EPS_PRINT_strt = print('-depsc', +MATLAB_EPS_PRINT_stop = ); +MATLAB_quit = quit + + +matlab_sources = $(wildcard plot_*.m) +matlab_eps_targets = $(matlab_sources:plot_%.m=%.eps) +matlab_pdf_targets = $(matlab_eps_targets:%.eps=$(pics_destdir)/%.pdf) + + +copy_matlab_pdf_targets: dest_dir_matlab $(matlab_pdf_targets) + +$(matlab_eps_targets): %.eps : plot_%.m + tmp=`mktemp`; \ + cat $< > $${tmp}; \ + echo "$(MATLAB_EPS_PRINT_strt)'$@'$(MATLAB_EPS_PRINT_stop)" >> $${tmp}; \ + echo "$(MATLAB_quit)" >> $${tmp}; \ + cat $${tmp} | $(MATLAB); \ + rm -f $${tmp} + +$(matlab_pdf_targets): $(pics_destdir)/%.pdf : %.eps + epstopdf --autorotate=All --outfile=$@ $< + +clean_matlab_eps_targets: +ifneq ($(strip $(matlab_eps_targets)),) + rm -f $(matlab_eps_targets) +endif + +real_clean_matlab_eps_targets: clean_matlab_eps_targets +ifneq ($(strip $(matlab_pdf_targets)),) + rm -f $(matlab_pdf_targets) +endif + +dest_dir_matlab: + $(INSTALL) -d -m 0755 $(pics_destdir) + +.INTERMEDIATE: $(matlab_eps_targets) |