We construct rest-frame luminosity functions at 3.6 , 4.5 , 5.8 , 8 and 24 \mu m over the redshift range 0 < z < 2 for galaxies and 0 < z < 4 for optical QSOs , using optical and infrared data from the Spitzer Wide-area InfraRed Extragalactic survey . The 3.6 and 4.5 \mu m galaxy LFs show evidence for moderate positive luminosity evolution up to z \sim 1.5 , consistent with the passive ageing of evolved stellar populations . Their comoving luminosity density was found to evolve passively , gradually increasing out to z \sim 0.5–1 but flattening , or even declining , at higher redshift . Conversely , the 24 \mu m galaxy LF , which is more sensitive to obscured star formation and/or AGN activity , undergoes strong positive evolution , with the derived IR energy density and SFR density \propto ( 1+z ) ^ { \gamma } with \gamma =4.5 ^ { +0.7 } _ { -0.6 } and the majority of this evolution occurring since z \sim 1 . Optical QSOs , however , show positive luminosity evolution in all bands , out to the highest redshifts ( 3 < z < 4 ) . Modelling as L ^ { * } \propto ( 1+z ) ^ { \gamma } gave \gamma =1.3 ^ { +0.1 } _ { -0.1 } at 3.6 \mu m , \gamma =1.0 ^ { +0.1 } _ { -0.1 } at 4.5 \mu m and stronger evolution at the longer wavelengths ( 5.8 , 8 and 24 \mu m ) , of \gamma \sim 3 . Comparison of the galaxy LFs to predictions from a semi-analytic model based on CDM indicate that an IMF skewed towards higher mass star formation in bursts compared to locally is preferred . As a result the currently inferred massive star formation rates in distant sub-mm sources may require substantial downwards revision .