To get started, you'll need to get familiar with Repo and Version Control with Git.
To initialize the sources locally, use a command like this:
$ repo init -u https://github.com/AOSP-LEGACY/manifest -b ten
Then to sync up:
$ repo sync -c -f --force-sync --optimized-fetch --no-tags --no-clone-bundle --prune -j$(nproc --all)
$ source build/envsetup.sh
$ lunch aosp_<device>-userdebug
$ m -j$(nproc --all) otapackage