[ Date Index ]
[ Thread Index ]
[ <= Previous by date /
thread ]
[ Next by date /
thread => ]
Re: [LUG] shell programming continuued
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. This may sound
lazy however if I get better at programming c I need a way to ensure I
can adapt, there is no point getting to the point where I have 2 / 3
source files and still do things the hardway. So I guess starting
correctly is the best way forward, it's a shame the book does not
introduce make files from the start and then tell you how to compile the
program using cc, using as the book uses borland and ms C, and using
makefiles, perhaps I need a c programming book that is aimed at Linux
users.
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.
Looking at make files in the book Linux programming by wrox press, page
368, It looks somewhat confusing,
Paul
Robin Cornelius wrote:
On Saturday 28 May 2005 20:21, PAUL SUTTON wrote:
Hi
/#/bin/bash/
*echo* "please enter file name (source):"
*read* name
/#compile user specified c source file in to a object file (file.o)/
*cc* -c $name
*ls* -l
*echo* "please enter filename (final binary name):"
*read* binary
/#compile object code into final binary - binary objectname.o/
*cc* -o $binary $binary.o
/#display long directory listings, with file permissions displayed, /
/#ls -l $name $binary/
Isn't this just the job of a makefile? or is the purpose to try out shell
scripting?
--
The Mailing List for the Devon & Cornwall LUG
Mail majordomo@xxxxxxxxxxxxx with "unsubscribe list" in the
message body to unsubscribe. FAQ: www.dcglug.org.uk/linux_adm/list-faq.html