There are target-specific #defines built into mb-gcc and powerpc-eabi-gcc compilers. Following is an example piece of code to demonstrate usage for MicroBlaze and PowerPC, respectively:
#if defined(__PPC__)
if (hdr->ih_arch != IH_CPU_PPC)
#elif defined(__MICROBLAZE__)
if (hdr->ih_arch != IH_CPU_MICROBLAZE)
#else
# error Unknown CPU type
#endif