日期:2014-05-16  浏览次数:20784 次

问一个简单的makefile的问题!
最开始是这样的:

#!/bin/tcsh -f
set targetDir="../ffmpeg-libs/i386"
if (! -d $targetDir ) mkdir $targetDir

rm -f $targetDir/*.a

make clean

#./configure --arch=i386 --extra-cflags='-arch i386' --extra-ldflags='-arch i386'  --disable-encoders --disable-debug --disable-mmx


./configure \
--cc=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc \
--as='gas-preprocessor.pl /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc' \
--nm="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/nm" \
--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk \
--target-os=darwin \
--arch=i386 \
--cpu=i386 \
--extra-cflags='-arch i386 -miphoneos-version-min=4.3 -mdynamic-no-pic' \
--extra-ldflags='-arch i386 -miphoneos-version-min=4.3 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk' \
--prefix=compiled/i386 \
--enable-cross-compile \
--enable-nonfree \
--enable-gpl \
--disable-armv5te \
--disable-swscale-alpha \
--disable-doc \
--disable-ffmpeg \
--disable-ffplay \
--disable-ffprobe \
--disable-ffserver \
--disable-asm \
--disable-debug


make

mv libavcodec/libavcodec.a $targetDir
mv libavdevice/libavdevice.a $targetDir
mv libavformat/libavformat.a $targetDir
mv libavutil/libavutil.a $targetDir
mv libswscale/libswscale.a $targetDir


我把if (! -d $targetDir) mkdir $targetDir修改成
if [! -d $targetDir ] mkdir $targetDir;fi

还是有问题,请问,正确的写法应该是怎样的?

求助一下各位!谢啦
Makefile if[] targetDir

------解决方案--------------------
引用:
Quote: 引用:

if [ ! -d $targetDir ];then mkdir $targetDir
fi

也不行,这到底是怎么了。


#!/bin/bash
targetDir="../ffmpeg-libs/i386"
if [ ! -d $targetDir ];then mkdir -p $targetDir
fi

rm -f $targetDir/*.a
 
make clean
……


修改成这样,[]是bash的写法