Preparation of (hetero)aromatic (hetero)cyclic carboxamides for the treatment of Alzheimer's disease