[Android Q&A, Help & Troubleshooting] ImSoBored:
Hi, I am trying to build from source CM13. My plan is compiling the ROM for another very very similar device which had CM12 (ZTE Nubia Z9 mini) and was ported to my device (ZTE Axon Mini), but I can't even finish compiling for the Nubia. Once I finish compiling successfully for the Nubia, I will edit the necessary files to compile for the ZTE Axon Mini, just to make sure all building errors are due to modifying files.

1) The error encountered:

host C: libsepol <= external/selinux/libsepol/cil/src/cil_tree.c
host C: libsepol <= external/selinux/libsepol/cil/src/cil_verify.c
host C++: libsepol <= /home/user/android/system/out/host/linux-x86/obj/STATIC_LIBRARIES/libsepol_intermediates/cil/src/cil_lexer.cpp
host C: checkfc <= external/sepolicy/tools/checkfc.c
make: *** No rule to make target '/home/user/android/system/out/target/product/nx511j/obj/STATIC_LIBRARIES/libinit_msm_intermediates/export_includes', needed by '/home/user/android/system/out/target/product/nx511j/obj/EXECUTABLES/init_intermediates/import_includes'. Stop.
make: *** Waiting for unfinished jobs....
/home/user/android/system/out/host/linux-x86/obj/STATIC_LIBRARIES/libsepol_intermediates/cil/src/cil_lexer.cpp:1593:1: warning: function 'yy_fatal_error' could be declared with attribute 'noreturn' [-Wmissing-noreturn]
{
^
1 warning generated.

#### make failed to build some targets (41:59 (mm:ss)) ####

2) Your device name: ZTE Nubia Z9 Mini (NX511J)

3) Your device tree that you have used for compiling (github link): https://github.com/minimino?tab=repositories

4) Which ROM are you building: CyanogenMod 13

5) The guide which you are using to build: I'm using various guides, but mainly these ones:

Cyanogenmod.org: How To Port CyanogenMod Android To Your Own Device

XDA-University: "Getting Started: Building Android From Source"

I've searched on Google and people having similar issues solve it by adding device_qcom_common (cm-13.0 branch), but when doing so I get the same error, just much sooner:

Import includes file: /home/user/android/system/out/host/linux-x86/obj/EXECUTABLES/checkfc_intermediates/import_includes
Export includes file: external/sepolicy/tools/Android.mk -- /home/user/android/system/out/host/linux-x86/obj/EXECUTABLES/checkfc_intermediates/export_includes
echo '#endif' >> /home/user/android/system/out/host/linux-x86/obj/EXECUTABLES/checkpolicy_intermediates/policy_parse.h
Notice file: external/sepolicy/NOTICE -- /home/user/android/system/out/target/product/nx511j/obj/NOTICE_FILES/src//root/file_contexts.txt
make: *** No rule to make target '/home/user/android/system/out/target/product/nx511j/obj/STATIC_LIBRARIES/libinit_msm_intermediates/export_includes', needed by '/home/user/android/system/out/target/product/nx511j/obj/EXECUTABLES/init_intermediates/import_includes'. Stop.
make: *** Waiting for unfinished jobs....
Export includes file: system/core/init/Android.mk -- /home/user/android/system/out/target/product/nx511j/obj/STATIC_LIBRARIES/libinit_intermediates/export_includes

#### make failed to build some targets (02:32 (mm:ss)) ####

This error has been posted here before, and the above suggestion was made. I've entered make clean and synced repos, but still having the same error.

Any help would be appreciated. Thank you. :)