Preparation of pyrazolo[3,4-d]pyrimidines and pyrrolo[2,3-d]pyrimidines for treatment of bone related diseases and tumors.