2011-06-26 10 views
-2

変数を頻繁に変更した後に.ccファイルをコンパイルする必要がある状況があります。 私のスクリプトは、私はそれが最初 CDスクリプトからmakeを呼び出す

を言うことによってシェルスクリプトでディレクトリに変更してからメイク続いコンパイルしようとするの.ccファイル

内の変数を変更します。 私のすべてのシェル命令は、.shファイルに保存されます。

私はこれを実行したときしかし、私はエラーに

make: *** No targets specified and no makefile found. Stop. 

を取得するが、私は手動でディレクトリと型に行くときには、それが動作します。

なぜシェルスクリプトがmakeを動作させることができないのですか?

EDIT私はこれはおそらく数回の反復を取るスクリプトを

#! /bin/sh 
# simDir=/home/amm/ns-projects/EURANE/Release 



simtime=21 
high_users=5 
low_users=3 
rm user_throughput.txt qos_throughput.txt 
echo "Iteration,Users, Low, High,Low average,High average, Average cell througput" >> qos_throughput.txt 



for((husers = 1; husers <= $high_users; husers++))  ### Outer for loop ### 

do 

for((lusers = 1 ; lusers <= $low_users; lusers++)) ### Inner for loop ### 
do     

       total_users=0 
       let total_users=$husers+$lusers 
       echo "$total_users $husers $lusers" 
       #Configure the sh file 
       num_users=0 
       cd /home/chanditha/EURANE_multi_cells_itpp/simulation_scripts 
       printf -v num_users "NUM_USERS=\"%d\"" $total_users 
       rm hsdpa_ftp_4cells.sh 
       perl -pe "s/.*/$num_users/ if $. == 5" hsdpa_ftp_4cells_old.sh > hsdpa_ftp_4cells.sh 
       chmod u+x hsdpa_ftp_4cells.sh 


       #Configure the awk file 
       cd /home/chanditha/EURANE_multi_cells_itpp/simulation_scripts/scripts 
       awkline=0 
       printf -v awkline "class_cuttoff=max_flow-%d;" $husers 
       rm tcp_performance_4cells.awk 
       perl -pe "s/.*/$awkline/ if $. == 137" tcp_performance_4cells_old.awk > tcp_performance_4cells.awk 




       #Change the directory and go to the .cc file 
       cd /home/chanditha/ns-allinone-2.30/ns-2.30/umts 
       printf -v cut_off "int cut_off = flow_max_-%d;" $husers; 
       rm hsdpalink.cc 
       perl -pe "s/.*/$cut_off/ if $. == 2109" hsdpalink_old.cc > hsdpalink.cc 
       #Make it 
        make clean && make 

done 

      cd /home/chanditha/EURANE_multi_cells_itpp/simulation_scripts 
      ./hsdpa_ftp_4cells_run_all.sh 
done 
+0

シェルスクリプトを含める必要があります。さもなければ私達ができることは野生の推測です。 – geekosaur

+0

'をシェルスクリプト内のディレクトリに変更します。cd' - パス 'pwd'を確認します。 –

+0

あなたはmakeがシェルで動作すると言っています..どのディレクトリですか? –

答えて

1

を追加しました。このスクリプトを実行して、何が起こるか教えてください:

cd /home/chanditha/ns-allinone-2.30/ns-2.30/umts 
make 

また、アーキテクチャ全体が揺れて聞こえます。スクリプトを使ってソース内の変数を変更し、再コンパイルしますか?天国のために、パラメータファイルを使用します:スクリプトはそれを書き込み、実行可能ファイルはそれを読み取ります。