As for relative pronouns like "who,whom,that/which", I could unterstand a little bit.

1.This is the boy who came to my house last night.

2.These are the boys who made this picture.

3.This is the pen which/that I bought yesteday.

4.The boy whom you are calling John is my brother.

But I am not fimiliar with the usage of these words(whatever,whoever,whichever,whomever).

Would you please give a hand to understand these words?

These '-ever' words are inclusive, and begin nominal clauses stating, for instance, 'under all conditions':

Whoever came into my house last night left his footprints in the mousse. (subject -- 'who of any person')

This is the receipt for whatever you bought yesterday. (object of preposition -- 'all of the [unidentified] items')

I want whichever pen you're not using. (direct object -- 'any', 'which of all unused pens')

Give these roses to whomever you like best. (and don't you admire how I made 'whomever' the object of both 'to' and 'like', so that there will be no argument about 'who/whom'?)
but WHY are these -ever words relative pronouns? Do you have a definition for either "relative pronoun" or "relative clause" which applies to both the "core" or "definite" relative pronouns (who, whose etc) and these -ever words (whoever whatever etc)? How can you tell when an -ever word is being used as a relative pronoun and when it is being used as something else?