|
|
On Apr 1, 11:16 am, Antoninus Twink <nos...@xxxxxxxxxxxxxx> wrote:
> On 1 Apr 2008 at 8:05, M.Liang Liu wrote:
>
>
>
> > I have a project with the following dirs:
> > ---------------------------------------------------------------------------
> > ------------
> > +src
> > |-proj0
> > |-program1
> > |-program2
> > |-proj1
> > |-program1
> > |-program2
> > |-program3
> > |-program4
> > |-proj3
> > |-program1
> > |-program2
> > |-program3
> > ....
> > |-proj9
> > -Makefile
> > +include
> > -README
> > +lib
> > |-lib1
> > |-lib2
> > ---------------------------------------------------------------------------
> > ------------
> > There are 10 project-dirs here in src, named proj0-proj9. Each project
> > has several program_dirs which containing some .c files
> > All .h files are under include in the top dir, the same as src.
>
> > I would like to write a makefile, which can help me compile all the .c
> > files and generate an executable file for each *program*. Considering
> > there are several independent programs in each project, the work
> > should be done within a single makefile at the top dir.
>
> > How can I deal all the programs under each project in a single top-
> > level makefile?
>
> Which part of the section of your make program's documentation on
> recursive use of make didn't you understand?
I think this is OT. comp.unix.programmer might be a better place to
ask this question.
I believe recursive makefiles have serious flaws and should be
avoided.
In this case, if each project is standalone, each needs a Makefile and
then you might want a script to run all the makefiles in sequence.
If the project are interlinked, the one makefile would be enough, just
use relative paths in your dependencies.
Also, a better source code file structuring also helps: I would place
all source files together in the same directory. After all, if they
are interrelated, what would be the advantage in splitting them about?
But that's my opinion. Yours may differ.
|
|