I think what's going on is that the ".ifref" is only being considered by the assembler, not the linker, and ".global" doesn't count as a reference. So when you call ca65 with vera.asm, it sees the ".ifref", observes that vera.asm hasn't actually used that procedure anywhere by that point in the file, and then discards it because of your ".ifref". The fix, then, is to remove the ".ifref" and just understand that your clearScreen function will always be included in your lib.
Or, if you wanted to control whether clearScreen is included in a build, you can't do it automatically, you'd have to define and then use .ifdef or plain .if comparisons:
vera.inc:
.define INCLUDE_CLEARSCREEN 1
...
.if INCLUDE_CLEARSCREEN = 1
.global clearScreen
.endif
vera.asm
.include "vera.inc"
.if INCLUDE_CLEARSCREEN = 1
.proc clearScreen
...
.endproc
.endif
main.asm
.include "vera.inc"
...
jsr clearScreen
Unfortunately, from a quick look it does not appear that cl65 supports any link-time optimization, such as discarding unused segments of code.