To build the RPM nightlies I do these (additionally I rename the package, but that's not that important ;))
./bootstrap
./configure --enable-contrib
make dist
mv codeblocks-trunk-r* `rpm --eval %{_sourcedir}`
rpmbuild -ba codeblocks.spec
On some distributions rpmbuild is in an extra package (rpm-build or smth like that)
Take a look at the wiki: Installing Code::Blocks from source on RPM based distributions (http://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_RPM_based_distributions)
On debian, I think sudo dpkg-buildpackage should do it (don't use debian anymore).