Project Home
Project Home
Trackers
Trackers
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Adding PRE_TARGET causes make to fail from command line: (5 Items)
   
Adding PRE_TARGET causes make to fail from command line  
I have many projects, which use the PRE_TARGET rule to update SVN information in the project.

When using this extra macro the project no longer builds using the command line.

After spending a few days figuring out why my projects would not build from the command line, I narrowed it down to this
 issue.

I am using IDE version 6.4.0, and QNX version 6.4.1, on winXp.
To test this, I created a "QNX C Proejct" using the new project wizard.  Then added a PRE_TARGET definition.

PRE_TARGET=DO_SOMETHING
DO_SOMETHING :
	$(TOUCH_HOST) $(PROJECT_ROOT)/did.something.txt


After that, the project would not build from the command line.

Am I doing something wrong?
Is there a way to make this work?

Cheers

Adrian
Re: Adding PRE_TARGET causes make to fail from command line  
On a related note, it is confusing that the two macros I'm using, PRE_TARGET and 
POST_CLEAN require different syntax.
Further to that, there is no mention of the required syntax in http://www.qnx.com/developers/docs/6.4.1/neutrino/prog/
make_convent.html

I have found (by trial and error) that the following works:

PRE_TARGET=DO_SOMETHING
DO_SOMETHING :
	$(TOUCH_HOST) $(PROJECT_ROOT)/did.something.txt

POST_CLEAN=$(TOUCH_HOST) $(PROJECT_ROOT)/did.something.txt


So the PRE_TARGET requires a new target, whereas the POST_CLEAN requires commands directly.

A note for each macro in the help could help others in the future.
Even better would be to pick one method (I prefer a list of targets) and use it consistently for these macros.
Re: Adding PRE_TARGET causes make to fail from command line  
Hi, Adrian,

I have raised a bug report internally to address the problem of the documentation describing the PRE_TARGET and 
POST_TARGET in the same terms as the other variables/macros.

I think it makes sense that PRE_TARGET and POST_TARGET should reference targets, because that is the surest way to 
arrange for pre-stuff to be done absolutely before everything else and post-stuff absolutely after everything else.  
Otherwise, it's rather convenient to be able to do something like:

define POST_BUILD
$(RM_HOST) $(HOME)/bin/$@
$(CP_HOST) $@ $(HOME)/bin
enddef

(for lack of a better example).  Some of these macros can even make use of the special make variables, like $@ above.

PRE_BUILD may be able to substitute for PRE_TARGET if its actions can be performed after ensuring the dependencies of 
your build target, but as you're invoking SVN actions I doubt that this would work for you.

Apart from that, I can't imagine why adding a redundant POST_CLEAN macro should make the PRE_TARGET work.  Could you 
provide a sample project that demonstrates the problem?

Cheers,

Christian


On 18/04/10 08:36 PM, Adrian Higgins wrote: 

	On a related note, it is confusing that the two macros I'm using, PRE_TARGET and 
	POST_CLEAN require different syntax.
	Further to that, there is no mention of the required syntax in http://www.qnx.com/developers/docs/6.4.1/neutrino/prog/
make_convent.html
	
	I have found (by trial and error) that the following works:
	
	PRE_TARGET=DO_SOMETHING
	DO_SOMETHING :
		$(TOUCH_HOST) $(PROJECT_ROOT)/did.something.txt
	
	POST_CLEAN=$(TOUCH_HOST) $(PROJECT_ROOT)/did.something.txt
	
	
	So the PRE_TARGET requires a new target, whereas the POST_CLEAN requires commands directly.
	
	A note for each macro in the help could help others in the future.
	Even better would be to pick one method (I prefer a list of targets) and use it consistently for these macros.
	
	
	
	_______________________________________________
	
	General
	http://community.qnx.com/sf/go/post52000
	
	  



-- 
Christian W. Damus
Software Developer, IDE Team
QNX Software Systems <http://www.qnx.com/>;  
Re: Adding PRE_TARGET causes make to fail from command line  
As stated in OP, a NEW project will exhibit this issue.

Have you tried this?

If it does not, I'm happy to post a project somewhere (would need instructions on where and how).

Cheers

Adrian
Re: Adding PRE_TARGET causes make to fail from command line  
Hi, Adrian,

Yes, I have tried this, on Linux and Win32 platforms.  With IDE 4.6 targeting SDP 6.4.1, I can add


PRE_TARGET=DO_SOMETHING
DO_SOMETHING :
	$(TOUCH_HOST) $(PROJECT_ROOT)/did.something.txt

at any place before the qtargets.mk include and it works in the IDE and on the command line.

After qtargets.mk, of course, it has no effect.  But in neither case does it break the build.

If you can export a sample project to ZIP file using the IDE's "File -> Export..." wizard, just attach it to a reply 
post or e-mail.  I'll be happy to take a further look.

Can you think of any patches or other content that you may have installed/modified in the $QNX_TARGET/usr/include/mk 
that would have changed the way the recursive makefiles behave?

Cheers,

Christian


On 06/05/10 09:46 PM, Adrian Higgins wrote: 

	As stated in OP, a NEW project will exhibit this issue.
	
	Have you tried this?
	
	If it does not, I'm happy to post a project somewhere (would need instructions on where and how).
	
	Cheers
	
	Adrian
	
	
	
	_______________________________________________
	
	General
	http://community.qnx.com/sf/go/post53722
	
	  



-- 
Christian W. Damus
Software Developer, IDE Team
QNX Software Systems <http://www.qnx.com/>;