[geeks] UNIX development and makefile discussion

microcode at zoho.com microcode at zoho.com
Wed Aug 14 10:14:47 CDT 2013


On Wed, Aug 14, 2013 at 10:38:19AM -0400, Mouse wrote:
> > I'm writing some UNIX code that consists of a dozen or so source
> > files for the first time.  I am ok with setting up makefiles for
> > small projects of a few files in one directory but things are
> > starting to get out of hand.  [...subdirectories...common code...]
> 
> > How do you organize projects that consist of multiple main programs
> > and various functional pieces, some shared, some dedicated to a
> > specific main program?
> 
> Personally, there are two major tacks I might take for this.
> 
> One is to put everything in a single directory, with the Makefile set
> up to build different programs from their main files and their common
> bits.
> 
> The other is to build a library separately, then use it with the main
> programs.
> 
> Which I'd pick depends on things like how useful I expect the common
> pieces to be to other programs, how well I can decouple them from the
> non-common pieces, how likely it seems that changes to one will be
> accompanied by changes to the other....

Thanks Mouse, I was interested to see what you would have to say.

It would certainly be easy to do everything from one directory but it's a
big change for me, the whole thing is really. I'm glad somebody suggested it
so I won't feel too much like a garbage man if I decide to go that route.

You and Nick mentioned libraries. I'm not sure if I can do it in this case
but I like the idea and agree with the value of it. The common code is
designed to be generally useful and it would be nice if it could be packaged
some way. In this case, the libraries would be compiler-specific and so not
generally useful. I won't know if that's an issue until I decide what I'm
going to do with this if I ever finish it.


More information about the geeks mailing list