I have taken this answer from other post. Following prints file name with extension. This works only for cpp files, not for the header files when retrieved this pre processor value FILE_NAME
inside C code.
-D FILE_NAME=\"$(<F)\"
How to get only source file name without extension?
The predefined function basename
removes the suffix (extension) from a filename, so if $(<F)
is the filename you are interested in then $(basename $(<F))
is the name without the extension:
-D FILE_NAME=\"$(basename $(<F))\"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With