Author Topic: header file dependencies  (Read 11889 times)

ngifford

  • Junior Community Member
  • Posts: 2
  • Hero Points: 0
header file dependencies
« on: July 24, 2006, 11:16:28 PM »
Hey everyone.  I'm having trouble with header file dependencies and need some help.  Here's what I want, but I don't know how to make it work with SlickEdit/gnumake.  I want header files that are included by a source file to be a build dependency for that source file.  So if I make a change to a header file and do a build, it will detect that all source files that include that header file also need to be rebuilt.

Note that I am using a Makefile that is auto-generated by SlickEdit, so I can't just go in and add the header files to the make targets.

Is this currently possible?

Thanks in advance,
Nick

jbezem

  • Community Member
  • Posts: 87
  • Hero Points: 8
Re: header file dependencies
« Reply #1 on: July 25, 2006, 06:43:15 AM »
I don't use SE auto-generated makefiles, since IMHO everyone should stay at his turf, and SE is an editor. But that's just my opinion.
However, build dependencies and their automatic updating is quite a hot topic in various make communities, and by no means trivial.
If you're using GNUmake, I'd suggest you check out the whitepaper section on http://make.paulandlesley.org/, and especially http://make.paulandlesley.org/autodep.html.
As I said, it's far from trivial, even for makefiles, and I hate build environments saying to check dependencies and not doing it correctly. Sadly, most dependency checkers I know have their hidden deficiencies, especially the flashing all-in-one GUIs...

FWIW,

Johan

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6882
  • Hero Points: 530
Re: header file dependencies
« Reply #2 on: July 25, 2006, 02:14:47 PM »
Hey everyone.  I'm having trouble with header file dependencies and need some help.  Here's what I want, but I don't know how to make it work with SlickEdit/gnumake.  I want header files that are included by a source file to be a build dependency for that source file.  So if I make a change to a header file and do a build, it will detect that all source files that include that header file also need to be rebuilt.

Note that I am using a Makefile that is auto-generated by SlickEdit, so I can't just go in and add the header files to the make targets.

Is this currently possible?

Thanks in advance,
Nick

You probably already know this but if you use the "built-in" project make facility no make file is required and depencies are automatically checked.  The down side is that you lose some features that make files have and other members of your team may not have SlickEdit.  SlickEdit's "built-in" project make facility does support rules but they are not accessible from the GUI.

ngifford

  • Junior Community Member
  • Posts: 2
  • Hero Points: 0
Re: header file dependencies
« Reply #3 on: July 25, 2006, 05:21:25 PM »
Thanks for the replies.  I guess I can see how the dependency stuff can be a can of worms.

Believe me, I would personally rather write/maintain my own makefile.  But this is a work project and the decision was made at the group level that this is how we would do things.

A little off topic, but I like FreeBSD's pmake approach to include file dependencies (mkdep) where a ".depend" file is created and make knows to look for it.  I wish gnumake had an analog...

Anyway, looks like the answer to my question is "ain't gonna happen."

:(

Dennis

  • Senior Community Member
  • Posts: 3965
  • Hero Points: 517
Re: header file dependencies
« Reply #4 on: July 25, 2006, 07:08:33 PM »
Here is a workaround that has been used by several of our customers.  Near the top of the Makefile generated by SlickEdit, there is a clearly marked section where you can add your own stuff.  You could add "include depend.mak" to that section and use makedepend to dump your header file dependencies to depend.mak.  You could even add a built target to your project to re-run makedepend.

natros

  • Community Member
  • Posts: 59
  • Hero Points: 1
Re: header file dependencies
« Reply #5 on: July 27, 2006, 11:32:42 AM »
A little off topic, but I like FreeBSD's pmake approach to include file dependencies (mkdep) where a ".depend" file is created and make knows to look for it.  I wish gnumake had an analog...

Anyway, looks like the answer to my question is "ain't gonna happen."

:(
I'm using cmake (www.cmake.org) with slickedit that handles dependencies.

aoehlke

  • Community Member
  • Posts: 48
  • Hero Points: 1
Re: header file dependencies
« Reply #6 on: January 31, 2007, 05:54:14 PM »
Dennis, could you give a specific example of the input to makedepend as well as the additional rule to add to the slick makefile, so that makedepend gets regenned?

Dennis

  • Senior Community Member
  • Posts: 3965
  • Hero Points: 517
Re: header file dependencies
« Reply #7 on: January 31, 2007, 07:05:46 PM »
Umm, wow, I haven't personally used makedepend for over a decade, so I'll have to respectfully refer you to the man page.  From what I remember, it's as simple as giving it a list of header files to parse though, and optionally your include path.

You could add makedepend as a prebuild command (Project > Project Properties, Build tab), that would make it pretty transparent, but kind of expensive.  Otherwise, I would just go to Project > Project Properties, Tools tab, and add makedepend as a new project tool.  Some people like to add a "depend" target to their makefile so that they can just run "make depend" from the command line.

Hope this helps.  Note that we have added a feature request to our tracking system to add header file dependency tracking to our generated makefiles, but it is not trivial, and not yet scheduled for a release.  We do recognize that there is a fair amount of demand for it however.

Note that if you change your Build options to "Build without a makefile", using our build system (vsbuild), it will take care of header file dependencies for you transparently.  Most people using makefiles prefer them because they know they can build with the makefile outside of SlickEdit or that you know that everyone has make, so it's easier to distribute to different team members (if there are some members of the team using another editor).  What most people don't realize is that vsbuild can be invoked outside of SlickEdit, and that the vsbuild executable does not require a license, so you could make it available to other team members and use vsbuild (which handles dependencies very well) instead of a makefile.

aoehlke

  • Community Member
  • Posts: 48
  • Hero Points: 1
Re: header file dependencies
« Reply #8 on: January 31, 2007, 07:23:43 PM »
thanks, and understood about vsbuild... we had been using it for almost 12 months doing auto dependency checking until forced to go with clearmake... and now we need a makefile.

I agree, for you folks to do dependency checking, it is very difficult... I am optimistic I can make it work with the depend.
thanks for the info...

cheers

hs2

  • Senior Community Member
  • Posts: 2761
  • Hero Points: 292
Re: header file dependencies
« Reply #9 on: January 31, 2007, 07:50:17 PM »
@aoehlke: If you're using dynamic views it really makes sense to use clearmake which also does version dependency checking.

HS2

aoehlke

  • Community Member
  • Posts: 48
  • Hero Points: 1
Re: header file dependencies
« Reply #10 on: February 06, 2007, 05:16:17 PM »
we do use dynamic views, and we do use clearmake... what I am saying is, the makefile knows nothing about header file dependencies.

I am not sure I understand your comment

hs2

  • Senior Community Member
  • Posts: 2761
  • Hero Points: 292
Re: header file dependencies
« Reply #11 on: February 06, 2007, 07:45:19 PM »
I mean that file dates maybe not reliable in dyn. views e.g. when switching to another branch by applying another config spec.
IIRC clearmake takes care about 'changed' version of a files too, which can't be covered by 'normal' dependencies.

However, this is going OT...

HS2