help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: help make target .INTERMEDIATE .SECONDARY


From: Vad N
Subject: Re: help make target .INTERMEDIATE .SECONDARY
Date: Mon, 17 Mar 2008 11:02:25 +0200

Hi.
 
I confronted with difficulties when try to write simple makefile with "special targets" (.SECONDARY)/
 
book: "Managing Projects with GNU make, 3rd Edition" say :
 
"Prerequisites of this special target are treated as intermediate files but are never automatically deleted. The most common use of .SECONDARY is to mark object files stored in libraries. Normally these object files will be deleted as soon as they are added to an archive. Sometimes it is more convenient during development to keep these object files, but still use the make support for updating archives".
 
Normally these object files will be deleted as soon as they are added to an archive, but I create makefile to ensure in this behaviour and to my regret i found that all object still locate in my directory when archive was created
 
my Makefile is:
 
sources = main.c
objects = main.o
CC = gcc
 
.SECONDARY : $(objects)
 
main : $(sources)
          $(AR) rv $(objects)
          $(CC)  $(sources)
//---
I think that above makefile should delete all objects before running gcc command, and then gcc should yield message like this: "gcc: no input files"/
 
Please, help me with this .SECONDARY special targets
 
 
 
 
 
2008/3/14, John Calcote <address@hidden>:
Hi Vad,
>  learn make utility.
>
> And i want to know more about target modifiers
> aside from .PHONY, like this:
> .INTERMEDIATE .SECONDARY
>
> Please show me some simple examples of using this targets
Please check out the GNU make manual here:

http://www.gnu.org/software/make/manual

Look in section 10.4 under intermediate dependencies. .INTERMEDIATE and .SECONDARY both provide a mechanism for you to explicitly declare a target as an intermediate product. Section 10.4 explains why you might want to do this, and what the side effects are.

John



reply via email to

[Prev in Thread] Current Thread [Next in Thread]