D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] shell programming continuued

 

On Saturday 28 May 2005 22:01, PAUL SUTTON wrote:
I want to try out shell scripting,  However I acknowledge that make 
files are probably the better solution,

As I am working through a book I don't want to keep having to type cc -c 
etc each time I want to compile a program, 
at the moment I am just using single program.c files.  

A C programming book?

Ok, you can be really lazy with gcc/cc anyway, just "gcc programname.c" will 
produce an executable a.out, For *simple* stuff forget all that -c -o ... 
stuff gcc can worry about that for you and invoke the linker all in one step. 
If you do need to pass a flag to the preprocessor or linker then there are 
options for that. Even multi file programs can be compiled with "gcc file1.c 
file2.c file3.c" that should save you a lot of hastle!


If I go for make files,  can I simply type make program1,  and have it 
compile then type and ssave the next program as program2. and then just 
simply type make program2,  and have it compile, if I have to rewrite 
the make file each time then I may as well just use the cc command twice 
from the command line.

No you need to edit the makefile so for simple one file programs it isn't 
worth it

-- 
Robin Cornelius
---------------------------------------------------
robin@xxxxxxxxxxxxxxxxxxxxx
http://www.cornelius.demon.co.uk
http://sourceforge.net/projects/rt2400
GPG Key ID: 0x729A79A23B7EE764
http://www.biglumber.com/x/web?qs=0x729A79A23B7EE764

Attachment: pgpCen2JoNtEN.pgp
Description: PGP signature