The condensation of 1-(3-pyridyl)ethanone (I) with dimethylformamide dimethylacetal (II) gives 3-(dimethylamino)-1-(3-pyridyl)-2-propen-1-one (III), which is cyclized with 1-(2-methyl-5-nitrophenyl)guanidine (IV) [obtained by reaction of 2-methyl-5-nitroaniline (V) with cyanamide (VI)] in refluxing isopropanol to yield the pyrimidine derivative (VII). Reduction of the nitro group of (VII) with H2 over Pd/C in THF affords the corresponding amino compound (VIII), which is finally condensed with 4-(4-methylpiperazin-1-ylmethyl)benzoyl chloride (IV) in pyridine.