Author Topic: header file dependencies  (Read 8143 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: 80
  • 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: 3844
  • Hero Points: 252
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

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2152
  • Hero Points: 273
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

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2152
  • Hero Points: 273
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: 2727
  • Hero Points: 281
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: 2727
  • Hero Points: 281
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