Forum Topic - Recursive makefile dependency problem: (5 Items)
   
Recursive makefile dependency problem  
Hi all,

 

We use QNX 6.2.1 and 6.5.0, the recursive makefile system and build from
the command line. I'm trying to improve the way dependencies are
handled.

 

Currently we use EXTRA_CCDEPS to specify all of our header files. This
correctly picks up on a change to a header but it causes a full build to
occur.

 

On a different platform with a simpler makefile we use the -MD option to
GCC to generate dependency files and then -include these files. This
picks up on a change to a header file and causes a partial build to
occur. This is the behaviour I'd like to set up in QNX.

 

I've found these two topics which are related to my problem:

 

http://community.qnx.com/sf/discussion/do/listPosts/projects.toolchain/d
iscussion.core_development_tools.topc20111

 

http://community.qnx.com/sf/discussion/do/listPosts/projects.toolchain/d
iscussion.core_development_tools.topc8391

 

Unfortunately I haven't figured out to create the behaviour I'd like
whilst using the recursive makefile system.

 

I'm fairly new to QNX and to makefiles, so apologies if I've missed
something obvious.

 

Kind regards,

 

Stephen

--------------------------------------------------------------------------------------------------
This email and any attachments are confidential and are for the use of the addressee only. If you are not the addressee,
 you must not use or disclose the contents to any other person. Please immediately notify the sender and delete the 
email. Statements and opinions expressed here may not represent those of the company. Email correspondence is monitored 
by the company. This information may be subject to export control regulation. You are obliged to comply with such 
regulations.

Renishaw plc (company number 1106260), Wotton Travel Limited (company number 01973158) and Renishaw Advanced Materials 
Limited (company number 04632041), are companies registered in England and Wales with a registered office at New Mills, 
Wotton-under-Edge, Gloucestershire, GL12 8JR, United Kingdom, Telephone +44 1453 524524. 
--------------------------------------------------------------------------------------------------
Attachment: HTML sf-attachment-mime4218 5.78 KB
Re: Recursive makefile dependency problem  
Hi Stephen,

In fact we use just such a solution with QNX's recursive make for our projects.   This is from QNX 6.3.2 with GCC 3.3.5,
 so you might have to modify this for your specific QNX and GCC versions - I know the older GCC used in QNX 6.2.1 
doesn't support -MP, for example.   Here is the makefile fragment we use:

# Auto-generate dependencies
CCFLAGS+=-Wp,-MD,$*.d -Wp,-MP,
# Clean them up when we're done
EXTRA_CLEAN+=*.d
# Include the relevant makefiles, but don't get upset if they're not there
-include $(addsuffix .d,$(basename $(notdir $(SRCS))))

Hope this helps some,

-Will
Re: Recursive makefile dependency problem  
Hi Will,

That is exactly what I was looking for. Thanks very much for taking the time to post this.

I don't think -MP will affect us and I've switched to -MMD as I don't see the need to include the system header files.

This all works perfectly for 6.5.0, but I have one problem with 6.2.1. I get an error when doing a clean (even though 
the clean seems to work correctly):

1>  make -j 1 -Cx86 -fMakefile clean
1>  make[1]: Entering directory `C:/myProject/x86'
1>  make -j 1 -CDEV -fMakefile clean
1>../../common.mk(107): error : no file name for `-include'
1>  make[2]: Entering directory `C:/myProject/x86/DEV'
1>  C:/QNXsdk/host/win32/x86/usr/bin/rm -f oak-DEV  *.pinfo *.o *.err *.map mapfile *.sym  *.d 
1>  make[2]: Leaving directory `C:/myProject/x86/DEV'
1>  make[1]: Leaving directory `C:/myProject/x86'

Could I check where in common.mk you have your -include? Or if you have any ideas why I'm getting this error?

Many thanks,

Stephen
Re: Recursive makefile dependency problem  
Hi Stephen,

I suspect the older version of make has a bug where it gets upset if the macro expands to no files.   Try:

-include $(addsuffix .d,$(basename $(notdir $(SRCS)))) some_dummy_file

just to keep it happy.   The dummy file doesn't need to actually exist - the "-" in front of the include suppresses the 
"include file missing" error.

-Will
Re: Recursive makefile dependency problem  
Hi Will,

That's perfect. I think I now have our builds working the way I'd like.

Many thanks for your help with this.

Stephen