Welcome to the TechSpot OpenBoards. Please read the FAQ if you have any questions. Login to participate.

Go Back   TechSpot OpenBoards > OS & Software > The Alternative OS

make rules file

Reply
Bookmark / Share this page
Thread Tools
  #1  
Old 12-14-2005
Newcomer, in training
 
Location: st. louis
Member since: Jan 2005, 27 posts
make rules file

Hi, anyone explain the following lines in the
/usr/share/lib/make/make.rules(symbols):

.c.a:
$(COMPILE.c) -o $% $<
$(AR) $(ARFLAGS) $@ $%
$(RM) $%
and
.c~.o:
$(GET) $(GFLAGS) -P $< > $*.c
$(CC) $(CFLAGS) -c $*.c
If you could, please, thank you
Reply With Quote
  #2  
Old 12-14-2005
Nodsu's Avatar
TS Special Forces
 
Location: Estonia
Member since: Feb 2002, 9,430 posts
System specs
Someone's schoolwork again?

These are suffix rules and show what make is supposed to do when it is requested to process a source ending with .c and a target ending with .a for example.
Reply With Quote
You can remove this banner by registering, join the TS Community for free.
  #3  
Old 12-14-2005
jobeard's Avatar
TechSpot Evangelist
 
Location: Southern Calif.
Member since: Apr 2005, 6,615 posts
Quote:
Originally Posted by deki
Hi, anyone explain the following lines in the
/usr/share/lib/make/make.rules(symbols):
.c.a:
$(COMPILE.c) -o $% $<
$(AR) $(ARFLAGS) $@ $%
$(RM) $%
and
.c~.o:
$(GET) $(GFLAGS) -P $< > $*.c
$(CC) $(CFLAGS) -c $*.c
If you could, please, thank you
rules are formed from a syntax object: action
.c.a: a rule to make a .A thing from a .C thing
$(COMPILE.c) -o $% $< an action to assemble it
$(AR) $(ARFLAGS) $@ $% an action to archive it
$(RM) $% an action to delete the .a thing once archived


.c~.o: rule to create a .o from a .c source
$(GET) $(GFLAGS) -P $< > $*.c action to fetch the source file
$(CC) $(CFLAGS) -c $*.c and action to compile it

understand, $(xxx) are macros defined elsewhere and therefore can literally be anything. I've suggested typical action knowing what the rule: imply.

Try google for 'GNU Make' for online reference material
Reply With Quote
  #4  
Old 12-14-2005
Newcomer, in training
 
Location: st. louis
Member since: Jan 2005, 27 posts
Thank you,by the way I have one of the worst teachers and he did not do a
good job explaining.
Reply With Quote
  #5  
Old 12-14-2005
jobeard's Avatar
TechSpot Evangelist
 
Location: Southern Calif.
Member since: Apr 2005, 6,615 posts
MAKE is a wonderfull tool.
Normally the 'default' rules (ie those built into the product) just do the right thing,
but you can teach it how to do every step. The non-default rule that
is really neat is the ability to ensure that your copy of the source is up-to-date
with respect to the source management system (sccs, rcs, or cvs).

the rules are hierarchial, so each step of the process can be controlled by you.

typically, the first rule is all:
all: config, build, install

config:

build:

install: mkdirs, copyfiles, setperms

mkdirs:

copyfiles:

setperms:
the white-spaces between the rules are critical; they are the delimiters of the actions associated to the rule immediately above.

by this example, the following are all valid invocations of this makefile;
make all
make config
make build
make mkdirs
this ought to stimulate some reading and usage for the tool.
Reply With Quote
  #6  
Old 12-14-2005
Newcomer, in training
 
Location: st. louis
Member since: Jan 2005, 27 posts
Thank you now its clear!
Reply With Quote
  #7  
Old 12-15-2005
Mictlantecuhtli's Avatar
TS Special Forces
 
Location: Finland
Member since: Feb 2002, 4,751 posts
System specs
Quote:
Originally Posted by jobeard
the rules are hierarchial, so each step of the process can be controlled by you.

typically, the first rule is all:
all: config, build, install

config:

build:

install: mkdirs, copyfiles, setperms

mkdirs:

copyfiles:

setperms:
Eh, this all depends on the contents of Makefile.
Reply With Quote
You can remove this banner by registering, join the TS Community for free.
  #8  
Old 12-15-2005
Newcomer, in training
 
Location: st. louis
Member since: Jan 2005, 27 posts
Just to make sure:

Difference between My make.rules and Built in make.rules:
Mine: If I have my own make.rule file the make must comply to my rules,
and build the objects accordingly.

Built in: I dont have to worry about rules that the make is going by,
the only thing I need is write my own makefile with my own depencencies
and commands.
Reply With Quote
  #9  
Old 12-16-2005
jobeard's Avatar
TechSpot Evangelist
 
Location: Southern Calif.
Member since: Apr 2005, 6,615 posts
Quote:
Originally Posted by deki
Just to make sure:

Difference between My make.rules and Built in make.rules:
Mine: If I have my own make.rule file the make must comply to my rules,
and build the objects accordingly.

Built in: I dont have to worry about rules that the make is going by,
the only thing I need is write my own makefile with my own depencencies
and commands.
Basically correct. Be aware however, that your rules are overrides to the defaults. You override what you NEED and just leave the rest alone:-)

Quote:
Originally Posted by Mictlantecuhtli
Eh, this all depends on the contents of Makefile.
but of course. Should have been more clearly stated as
'for the sample rules above...'
Reply With Quote
Reply
Thread Tools

Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
freaky chkdsk.. NeoION Windows OS 90 03-16-2007 08:24 PM
NERO invalid write state worntilltorn Misc. Software & Utilities 2 10-15-2005 01:55 AM
help for reinstalling windows for hp 6355 blackcat9ca Windows OS 7 06-08-2005 03:05 AM
deleting rules on chains Adeyinka The Alternative OS 1 10-12-2003 01:09 AM


All times are GMT -4. The time now is 06:04 AM.