Usage errors often indicate you are not using the expected version of gcc. Have you manually installed a different version of gcc than the Fedora 40 gcc (GCC) 14.2.1 20240912 (Red Hat 14.2.1-3) package or set compiler options using environment variables? Have you successfully built akmods packages on Fedora 40 with earlier kernels?
What do you get for:
- dnf list --installed gcc
- gcc --version
- which gcc
- echo $CFLAGS