Read on full site | Join TechSpot! (it's free) | Bookmark / Share this



make rules file

deki
12-14-2005, 12:12 PM
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

Nodsu
12-14-2005, 12:45 PM
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.

Ad
12-14-2005, 12:45 PM
  

jobeard
12-14-2005, 12:58 PM
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

deki
12-14-2005, 01:57 PM
Thank you,by the way I have one of the worst teachers and he did not do a
good job explaining.

jobeard
12-14-2005, 02:36 PM
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.

deki
12-14-2005, 07:20 PM
Thank you now its clear!

Mictlantecuhtli
12-15-2005, 11:00 AM
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.

deki
12-15-2005, 08:26 PM
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.

jobeard
12-16-2005, 05:22 PM
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:-)

Eh, this all depends on the contents of Makefile.
but of course. Should have been more clearly stated as
'for the sample rules above...'

Post a reply, see related topics & more

Tip: Download Advanced SystemCare 3 Free - Clean, Repair, Protect & Optimize your PC.



 Top Technology News

TechSpot Blog: Disable Windows automatic check for solutions after a program crashes

Weekend Open Forum: Google Chrome OS and the future of cloud computing

Tech Tip of the Week: Unearth Region-Specific Windows 7 Themes

Sony: PlayStation 3 to be 3D-capable via firmware update

iSuppli: DDR3 to account for over half of DRAM shipments by Q2 2010

Facebook named third most popular video website behind YouTube and Hulu

Patriot introduces new PS-100 SSD series

Sony working on digital store for music, movies, books

More Tech News

  
 Software Downloads

Norton Virus Definitions 2003-07 November 20, 2009

AVG Anti-Virus Updates November 20, 2009

Norton Virus Definitions 2008-09 November 20, 2009

avast! Virus Definitions November 20, 2009

McAfee SuperDAT Update 5808

Kaspersky Anti-Virus Update November 20, 2009

Google SketchUp 7.1.6087

More Downloads



Copyright © 1998-2009 TechSpot.com. TechSpot is a registered trademark. All Rights Reserved.