使用shell脚本编译C程序 [英] using a shell script to compile your C programs
问题描述
你觉得这个方法有什么问题吗?例如。我写了一个shell
脚本a.sh包含:
cc -o test file1.c file2.c file3.c
>
然后执行shell脚本(sh a.sh)来编译并创建
可执行文件。这个方法和写一个
make文件有什么区别?
pereges写道:
< blockquote class =post_quotes>
你觉得这个方法有什么问题吗?例如。我写了一个shell
脚本a.sh包含:
cc -o test file1.c file2.c file3.c
>
然后执行shell脚本(sh a.sh)来编译并创建
可执行文件。这个方法和写一个
make文件有什么区别?
这里不是主题,请尝试comp.unix.programmer
但是:使用makefile会确保目标得到每当源发生变化(即比目标更新)时,重新构建
,一个shell
脚本总是无条件地编译,无论它是否是
实际上是必要的。
再见,Jojo
5月9日,08:14,Joachim Schmitz < nospam.j ... @ schmitz-digital.de>
写道:
pereges写道:
你觉得这个方法有什么问题吗?例如。我写了一个shell
脚本a.sh包含:
cc -o test file1.c file2.c file3。 c
然后执行shell脚本(sh a.sh)来编译并创建
可执行文件。这个方法和写一个
make文件有什么区别?
这里不是主题,请尝试comp.unix.programmer
我认为这很多这里比主题更好......
comp.unix.programmer基本上他是
询问编译方法不是
如何编写shell脚本和makefile>
不是特定于Unix的。
但是:使用makefile会确保目标重新构建
每当源发生变化(即比目标更新)时,shell
脚本总是无条件地编译,无论它是否实际上是必要的。
这是一个热门回复。
pereges说:
你觉得这个方法有什么问题吗?例如。我写了一个shell
脚本a.sh包含:
cc -o test file1.c file2.c file3.c
>
然后执行shell脚本(sh a.sh)来编译并创建
可执行文件。这个方法和写一个
make文件有什么区别?
使文件保存在打字和拼写上。你更愿意
记住并输入:这......
Do you see anything wrong about this method ? For eg. I write a shell
script a.sh containing :
cc -o test file1.c file2.c file3.c
and then execute the shell script ( sh a.sh) to compile and create the
executable. What is the difference between this method and writing a
make file ?
pereges wrote:Do you see anything wrong about this method ? For eg. I write a shell
script a.sh containing :
cc -o test file1.c file2.c file3.c
and then execute the shell script ( sh a.sh) to compile and create the
executable. What is the difference between this method and writing a
make file ?Not really topical here, try comp.unix.programmer
But: using a makefile would ensure that the target gets build afresh
whenever the source has changed (i.e is newer than the target), a shell
script would always compile, unconditionally, regardless whether it is
acctually neccessary.
Bye, Jojo
On 9 May, 08:14, "Joachim Schmitz" <nospam.j...@schmitz-digital.de>
wrote:pereges wrote:Do you see anything wrong about this method ? For eg. I write a shell
script a.sh containing :
cc -o test file1.c file2.c file3.c
and then execute the shell script ( sh a.sh) to compile and create the
executable. What is the difference between this method and writing a
make file ?
Not really topical here, try comp.unix.programmerI think it''s a lot more topical here than
comp.unix.programmer Essentially he''s
asking about compiling methodology not
how to write a shell script and makefiles
are not Unix specific.
But: using a makefile would ensure that the target gets build afresh
whenever the source has changed (i.e is newer than the target), a shell
script would always compile, unconditionally, regardless whether it is
acctually neccessary.And this is a topical reply.
pereges said:
Do you see anything wrong about this method ? For eg. I write a shell
script a.sh containing :
cc -o test file1.c file2.c file3.c
and then execute the shell script ( sh a.sh) to compile and create the
executable. What is the difference between this method and writing a
make file ?Make files save on typing and braining. Which would you rather have to
remember and type: this...
这篇关于使用shell脚本编译C程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!