LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Why makefile doesn't accept plain spaces instead of tabulation (https://www.linuxquestions.org/questions/linux-software-2/why-makefile-doesnt-accept-plain-spaces-instead-of-tabulation-679809/)

jf.argentino 10-29-2008 01:05 PM

Why makefile doesn't accept plain spaces instead of tabulation
 
Hello,

I use make since many years now and it's a great tool for sure, but I can't understand why there's still a need for tabulation instead of simple spaces for command lines! If anybody know the reason I'll be happy if it can share it!

Cheers.

TB0ne 10-29-2008 01:32 PM

Quote:

Originally Posted by jf.argentino (Post 3325217)
Hello,

I use make since many years now and it's a great tool for sure, but I can't understand why there's still a need for tabulation instead of simple spaces for command lines! If anybody know the reason I'll be happy if it can share it!

Cheers.

It's a way of delimiting commands versus other statements in a makefile. Commands in a makefile start with a tab, so

Code:

foobar: foobar.o
      gcc -c foobar.c

Says that in order to make the foobar (name, before the : ), foobar.o is used (spaces are used to delimit objects, since multiple objects can be used for one program). The next line that starts with a tab is the command that's run to produce the object(s), (gcc -c foobar.c).


All times are GMT -5. The time now is 06:55 AM.