[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting list of source files from directory hierarchy

From: Harvey Chapman
Subject: Re: Getting list of source files from directory hierarchy
Date: Tue, 29 Sep 2009 00:35:09 -0400

I have a simple generic Makefile that will use an explicit list of sources, if defined, but otherwise uses "find" to get a list of sources. This has two benefits: 1. I can do a quick compile of a directory of sources just by copying my makefile to the directory and typing "make". Later, I can revise the makefile to make it custom. In some ways, this use of my generic makefile is just a way of enhancing make's built-in rules. For instance, we can already "make program" without a makefile if program.c exists in our current directory. But, I can "make TARGET=program" with one or more sources in a directory with zero changes to my makefile. 2. I can give this makefile to my non-makefile-savvy co-workers saving me some time.

- If you're going to recurse directories for sources, it also helps to do the same for include directories. - Writing the automatic dependency rules is just marginally more difficult as you have to make sure that the dependency targets include the /path/to/objects.o.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]