The %ifxxx conditionals are used to begin a section of the spec file that is specific to a particular architecture or operating system. They are followed by one or more architecture or operating system specifiers, each separated by commas or whitespace.
Conditionals may be nested within other conditionals, provided that the inner conditional is completely enclosed by the outer conditional.
If the build system's architecture is specified, the part of the spec file following the %ifarch, but before a %else or %endif will be used during the build.
%ifarch i386 sparc
If the build system's architecture is specified, the part of the spec file following the %ifarch but before a %else or %endif will not be used during the build.
%ifnarch i386 sparc
If the build system is running one of the specified operating systems, the part of the spec file following the %ifos but before a %else or %endif will be used during the build.
%ifos linux
If the build system is running one of the specified operating systems, the part of the spec file following the %ifnos but before a %else or %endif will not be used during the build.
%ifnos linux
The %else conditional is placed between a %if conditional of some persuasion, and an %endif. It is used to create two blocks of spec file statements, only one of which will be used in any given case.
%ifarch alpha make RPM_OPT_FLAGS="$RPM_OPT_FLAGS -I ." %else make RPM_OPT_FLAGS="$RPM_OPT_FLAGS" %endif
An %endif is used to end a conditional block of spec file statements. The %endif is always needed after a conditional, otherwise, the build will fail.
%ifarch i386 make INTELFLAG=-DINTEL %endif