bash脚本进行大规模程序编译

如果有多个模块需要编译,并把编译结果复制出来,显示编译花费时间和完成后的版本信息,可行使用类似下面的编译脚本。

#!/bin/bash

timeStart=`date +'%Y-%m-%d %H:%M:%S'`
start_seconds=`date +%s `
echo   '**************************************   xxMaker 1.0   **************************************'
echo   '***************************************** Start @' $timeStart '*****************************************'
echo '********Clean make....********'
	make clean
echo '********Start make....********'
	make 
echo '********make done********'

echo  '********remove update folder...********'
	rm -rf update
echo '********create update folder...********'
	mkdir -p update/APPs update/RSs 
echo '********copy all module together...********'

	APP_LIST='moudle_1 moudle_2 moudle_3 '
	RSRC_LIST='xx/Views'
	
	count=0
	for i in $APP_LIST
 	do
  		cp source/makedir/$i/$i ./update/APPS/
		count=` expr  $count + 1 `
	done
echo '********'$count 'files copied********'
	count=0
	for i in $RSRC_LIST
	 do
   		cp -r source/res/$i  ./update/RSRC/
		count=` expr  $count + 1 `
	done
echo '********' $count  'Rsrc folders copied********'
echo '********copy Version.h ...********'
	mkdir -p update/VERSION
	cp source/version/version.h ./update/VERSION
	cat  ./update/VERSION/xxversion.h 
echo  '********Version.h Copied********'

timeEnd=`date +'%Y-%m-%d %H:%M:%S'`
end_seconds=`date +%s `
cost_time=$[ $end_seconds - $start_seconds ]
cost_Min=` expr  $cost_time / 60 `
cost_S=` expr  $cost_time % 60 `

echo   '*****************************************Finished  @' $timeEnd '*****************************************'
echo   '    ********====' $timeStart  ' -->'  $timeEnd '   === Totally took: ' $cost_Min 'Minutes and ' $cost_S 'seconds===********     '
echo  '*****************************************     xxMaker1.0    All  Done        *****************************************'

————————————————————————
需要500关注,拜托顺手点个关注,谢谢

你可能感兴趣的:(bash脚本编程技能点积累,速查备忘,bash,多模块自动编译脚本)