Multiphase permanent-magnet synchronous machines (PMSMs) with nonsinusoidal back-electromotive force (back-EMF) offer high fault tolerance and torque density for electric vehicles. Most current-reference generation methods either minimize stator copper loss (SCL) or maximize achievable torque. Optimization of both goals is accomplished by full-torque-range minimum-loss (FRML) strategies, but so far just for sinusoidal back-EMF. Thus, FRML for nonsinusoidal back-EMF should be sought. Moreover, many methods are only suitable for healthy conditions or specific machines, harmonics, or open-phase-fault (OPF) scenarios. Additionally, the torque range may be extended by permitting torque ripple or (transiently) greater rms current, but this approach is not general nor FRML yet. This paper proposes online FRML current-reference generation for multiphase PMSMs with nonsinusoidal back-EMF: nonsinusoidal-back-EMF FRML (NSBE-FRML). When the torque reference is feasible, minimum SCL is attained while maximizing the achievable torque (i.e., FRML). For higher torque references, the instantaneous torque deviation is minimized, and the torque reference is saturated in consecutive samples limiting the torque ripple to a pre-specified threshold. Furthermore, the rms current is limited after transient overload by automatically decreasing the torque reference. The NSBE-FRML is suitable for any harmonics, healthy/OPF conditions, and multiphase PMSMs with negligible saliency ratio. Experiments are performed with a six-phase PMSM.