开发者

Makefile on terminal

开发者 https://www.devze.com 2023-01-10 18:16 出处:网络
I have seen a \"basic M开发者_C百科akefile tutorial\" today, but I still don\'t understand a few things:

I have seen a "basic M开发者_C百科akefile tutorial" today, but I still don't understand a few things:

  1. What does the '&' character do in the line: "emacs Makefile &" ?
  2. After I have opened the emacs editor and created the Makefile file, how do I use it in order to compile my "source_code.c" file??

Thanks in advance,

Sagiftw


&

The & puts the processing being started into the background so that the terminal will continue to accept and process commands while emacs runs. If you forget the &, you can achive the same affect by typing <control>-z, to suspend the process and get the prompt back and then

$ bg

to resume the suspended process in the background. There is more in the "Job Control" section of the man page.

Using a makefile

To use a makefile, invoke make in the same directory as the file:

$ make

or, if you want a particular target rather than the default one you must specify it

$ make target

If the makefile is in an different directory from where you want to use it (why?), or does not have one of the default names (which depend on what version of make you are using) you may have to specify the filename

$ make -f MyMakefile target


Calling make without sepcifing a particular target causes make to execute the first target mentioned in the Makefile.

If called without the -f option, GNU Make looks for the following filenames to use as Makefiles:

  • GNUmakefile
  • makefile
  • Makefile

You should name the file Makefile because this is common. If you'd use features that are GNU make only, use GNUmakefile.

0

精彩评论

暂无评论...
验证码 换一张
取 消