[geeks] non-recursive make

Charles Shannon Hendrix shannon at widomaker.com
Wed Nov 9 20:14:19 CST 2005


Wed, 09 Nov 2005 @ 11:11 -0600, Jonathan C. Patschke said:

> Just have your Makefile reflect that structure:
> 
> O_FILES=util/blah.o net/net.o
> 
> bin/final_binary: ${O_FILES}
> 
> util/blah.o: util/blah.c
> 
> net/net.o: net/net.c

The above is what I have now and at times it is a problem, and it is
also inelegant and tedious, especially when first starting or converting
a recursive project.

I went fishing because I figured someone here might have thought the
same thing and found a better idea than I did.

Every once in awhile it helps to see what other people do.

I used to do it by listing the objects organized into variables, and
had rules to auto-generate the build rules.

I used VPATH to tell make where to find the sources, and had .c.o and
other rules to handle special cases.

It was never elegant or portable though, which might be my fault, I
don't know.

The problem was that this depended on things which are often
incompatible among make programs.

Anyway, any ideas appreciated. I might just script a solution, which is
what I used to do.  Just fishing for possible better ideas.



-- 
shannon "AT" widomaker.com -- ["We are all of us in the gutter, some of us
looking at the stars." -- Oscar Wilde]



More information about the geeks mailing list