[Top][All Lists]

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

About source code repository hierachy and the makefile

From: Peng Yu
Subject: About source code repository hierachy and the makefile
Date: Mon, 30 Jan 2006 22:34:51 -0600


I have the following question on using make to organize codes in a
good way. Would you please give me some advices and examples.

I want to organize the source code (c++ .cc files) of all the modules
in a directory say "src" and its sub directories. The modules
logically doing the same job should have a set of test cases of their
own. The test cases could be put in two places:
  1. test cases are put in "test_case" directory, with a similar
directory structure in "src"
  2. test cases are put in "src" directory along with modules they are testing
I'm not sure which is better. Considering the fact that the modules
should not depend on test_cases, the 1st choice is prefered. But
considering the fact that I want to maintain the same directory
structure of the modules and the test cases (is it really necessary
from the source code readability point of view?), the 2nd choice is

The makefile should be able to compile all the test cases, if I run
"make" from the root dir. Also I should be able to run all the test
cases just by one single command like "make run" from the run
directory. I should also be able to compile the test cases for the
modules logically doing one single job. It is better that the
executables be in the same directory of the modules, or at least
symbolic links to the executables should be in the same directory of
the modules.

Some testcases are actually the final programs I want to run. I want
be able to put them in a dir say "bin" automatically, which is in my

The source code structure is very likely to undergo some change. I
want the changes could take least amount of work in terms of
maintaining the coherent of the source code and test cases directories
structures and fixing or deleting the links. The makefile is
preferable not to be changed. Adding the file names in to the
makefiles every time some source files are added is definitely not


reply via email to

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