Project Home
Project Home
Trackers
Trackers
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Blank environment variables in post-build actions: (6 Items)
   
Blank environment variables in post-build actions  
I want to add some post-build actions to my QNX Momentics static library project.  It seems like QNX_TARGET and VARIANT 
are blank while CPU and BUILDNAME are properly populated.  With the post build actions below I expected:

   c:\test1.txt = "libhutilcpp_g.a"
   c:\test2.txt = "armle"
   c:\test3.txt = "C:/proj/cf/trunk/target/qnx6/"
   c:\test4.txt = "-v7"

The test1.txt file contained what I expected.  The test2.txt file contained "arm" instead of "armle" even though my 
build variants was set to ARM v7 (Little Endian).  The test3.txt and test4.txt files were completly blank. 

#===== POST_BUILD - extra steps to do after building the image.
define POST_BUILD
-@echo $(BUILDNAME) > c:\test1.txt
-@echo $(CPU) > c:\test2.txt
-@echo $(QNX_TRAGET) > c:\test3.txt
-@echo $(VARIANT) > c:\test4.txt
-$(if $(filter AR, $(BUILD_TYPE)), @$(CP_HOST) $(BUILDNAME) $(QNX_TARGET)/$(CPU)$(VARIANT)/lib)
-@cp $(PROJECT_ROOT)/*.h $(QNX_TARGET)/usr/include
endef

The build products are all OK.  Any ideas on why these are blank would be appreciated.

 - Pete
Re: Blank environment variables in post-build actions  
Also, why don't the post-build actions show up in the console?  It may have something to do with the '-@', but I am not 
sure about that.
Re: Blank environment variables in post-build actions  
Hi, Peter,

The '@' modifier on the command suppresses echoing of the command invocation.  The '-' modifier indicates that an error 
result from the command should not halt the build.

Cheers,

Christian


On 2012-02-14, at 6:20 PM, Peter Stephens wrote:

> Also, why don't the post-build actions show up in the console?  It may have something to do with the '-@', but I am 
not sure about that.
> 
> 
> 
> _______________________________________________
> 
> General
> http://community.qnx.com/sf/go/post91580
> 
Re: Blank environment variables in post-build actions  
Thanks for the quick reply Christian.  This is good information to have around. - Pete
Re: Blank environment variables in post-build actions  
Hi, Peter,

Your makefile snippet misspells $(QNX_TARGET) as $(QNX_TRAGET).  That should explain why this one is blank.

The $(CPU) variable is literally just the CPU architecture, which is ARM in your case.  For 'armle', you want $(CPUDIR),
 which combines the CPU architecture with endianness.  For 'armle-v7', you would want $(CPUVARDIR), which includes 
architecture-specific variants.  Thus your path construction in the copy command (using $(CP_HOST) macro) should 
probably be $(QNX_TARGET)/$(CPUVARDIR)/lib.  However, this command would seem to be duplicating what the standard 'make 
install' target already does.

The variants in effect in the current build directory are provided by $(VARIANT_LIST), not $(VARIANT).

HTH,

Christian


On 2012-02-14, at 6:16 PM, Peter Stephens wrote:

> I want to add some post-build actions to my QNX Momentics static library project.  It seems like QNX_TARGET and 
VARIANT are blank while CPU and BUILDNAME are properly populated.  With the post build actions below I expected:
> 
>   c:\test1.txt = "libhutilcpp_g.a"
>   c:\test2.txt = "armle"
>   c:\test3.txt = "C:/proj/cf/trunk/target/qnx6/"
>   c:\test4.txt = "-v7"
> 
> The test1.txt file contained what I expected.  The test2.txt file contained "arm" instead of "armle" even though my 
build variants was set to ARM v7 (Little Endian).  The test3.txt and test4.txt files were completly blank. 
> 
> #===== POST_BUILD - extra steps to do after building the image.
> define POST_BUILD
> -@echo $(BUILDNAME) > c:\test1.txt
> -@echo $(CPU) > c:\test2.txt
> -@echo $(QNX_TRAGET) > c:\test3.txt
> -@echo $(VARIANT) > c:\test4.txt
> -$(if $(filter AR, $(BUILD_TYPE)), @$(CP_HOST) $(BUILDNAME) $(QNX_TARGET)/$(CPU)$(VARIANT)/lib)
> -@cp $(PROJECT_ROOT)/*.h $(QNX_TARGET)/usr/include
> endef
> 
> The build products are all OK.  Any ideas on why these are blank would be appreciated.
> 
> - Pete
> 
> 
> 
> 
> _______________________________________________
> 
> General
> http://community.qnx.com/sf/go/post91579
> 
Re: Blank environment variables in post-build actions  
Thanks Christian,  With your help this is what it finally comes down to.

#===== POST_BUILD - extra steps to do after building the image.
define POST_BUILD
-$(if $(filter AR, $(BUILD_TYPE)), @$(CP_HOST) $(BUILDNAME) $(QNX_TARGET)/$(CPUVARDIR)/lib/)
-$(if $(filter AR, $(BUILD_TYPE)), @$(CP_HOST) $(PROJECT_ROOT)/*.h $(QNX_TARGET)/usr/include/)
endef

The reason I didn't want the regular install was twofold:  I wanted to have the include files copied at the same time 
and I also wanted the whole thing to happen with each build at this point to avoid an extra double-click.

 - Pete