"M.Liang Liu" wrote:
Quote:
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?
<OT>
Don't do that. That's called "micromanaging", and is just as
idiotic when done by make as when done to you by your boss.
Instead, if you have 37 "programs" in 5 "projects" in 1 "workspace",
write 43 makefiles, one for each node in your tree, and one at top
level. The top-level makefile calls the "project" level makefiles,
and they in-turn call the "program" level makefiles.
Advantages:
1. Each makefile is very small and simple and easy to write and
maintain.
2. Changes made at any one node necessitate updating (at most)
the 1 makefile for that node.
This is true regardless of programming language. For more help,
ask about this in "comp.programming", "comp.unix.programmer",
and "gnu.utils.help".
Save the "comp.lang.*" groups for questions about their particular
LANGUAGES. (That's what the "lang" in "comp.lang.*" stands for.)
</OT>
--
Cheers,
Robbie Hatley
lonewolf aatt well dott com
www dott well dott com slant user slant lonewolf slant