If y'all are into home brews you can make a fair WD-40 substitute by combining a gallon of odorless kerosene and a pound of white lithium grease. Mix it up in a five gallon bucket, I mix it with a drill, and you can pour it back into the relabeled kerosene can and you have enough left over to half fill a quart spray bottle.

The result works about as well as WD-40. WD-40 is like a SAK, good for a lot of things but it isn't really excellent in any particular roll. It is a light lubricant, a decent penetrant, and a mild preservative. Made by the gallon it is cheap. Cheap enough to use frequently and liberally. Cheap enough to fill up many spray bottles so you always have it handy.

Then again WD-40 can be bought by the gallon for about $17 so it comes down to how much you value your time.

WD-40, or the equivalent home brew, will work for door latches and hinges. You may have to reapply in a few years but it isn't a big thing. On locks you should use graphite and I usually do but more than once I have used WD-40 because it was handy. And, so far, the locks haven't gummed up or stopped working.

If you want a really good penetrating oil use Kroil. For a preservative oil use Ballistol. Locks, graphite.