SDCC Manual
next up previous contents index
 

2.4.8 VPATH feature

SDCC supports the VPATH feature provided by configure and make. It allows to separate the source and build trees. Here's an example:

cd ~                                    # cd $HOME

tar -xjf sdcc-src-yyyymmdd-rrrr.tar.bz2 # extract source to directory sdcc

mkdir sdcc.build                        # put output in sdcc.build

cd sdcc.build

../sdcc/configure                       # configure is doing all the magic!

make

That's it! configure will create the directory tree will all the necessary Makefiles in ~/sdcc.build. It automagically computes the variables srcdir, top_srcdir and top_buildir for each directory. After running make the generated files will be in ~/sdcc.build, while the source files stay in ~/sdcc.
This is not only usefull for building different binaries, e.g. when cross compiling. It also gives you a much better overview in the source tree when all the generated files are not scattered between the source files. And the best thing is: if you want to change a file you can leave the original file untouched in the source directory. Simply copy it to the build directory, edit it, enter `make clean', `rm Makefile.dep' and `make'. make will do the rest for you!


next up previous contents index
Next: 2.5 Building the Documentation Up: 2.4 Building SDCC Previous: 2.4.7 Windows Install Using   Contents   Index
2009-05-10