2011-12-14 46 views
0

我在我的.profile中有一個函數,我需要在makefile中創建它(我創建的第一個函數)。至於我可以告訴做出不允許交互方式定義的函數或別名makefile中的函數

我怎麼還讓使用該功能?這是我.profile定義:

matlabs(){ 
    /Applications/Matlab.app/bin/matlab -nodesktop -nosplash -nojvm -r "disp('MATLAB:');${1}; quit();" | tail -n +11 
} 

而且我想這樣做在生成文件:

num.txt : finance.m 
    matlabs finance 

回答

1

的Makefile沒有shell腳本。你可以做的是從你的matlabs函數中創建一個shell腳本;把下面的可執行文件matlabs某處你PATH

#!/bin/sh 
/Applications/Matlab.app/bin/matlab -nodesktop -nosplash -nojvm \ 
    -r "disp('MATLAB:');${1}; quit();" \ 
    | tail -n +11 

另外,如果你不希望Makefile依賴於外部腳本,你需要經常做這種轉變,你可以定義一個隱含的它的Makefile規則:

%.txt : %.m 
     @/Applications/Matlab.app/bin/matlab -nodesktop -nosplash -nojvm \ 
      -r "disp('MATLAB:'); $<; quit();" \ 
      | tail -n +11 > "[email protected]"