I would buy some plain metamucil. Mix a teaspoon of the metamucil with the favorite food once a day.
There is also an over the counter product for hairballs called "laxatone." It does help prevent, and resolve, hairballs but it can also help with constipation. Try 1/2 inch to 1 inch strip once a day.
If your dog will eat it, you can also try canned plain pumpkin. It is high in fiber. Give a tablespoon of that once a day with food.
You can purchase a stool softener at the drug store called "docusate sodium." You can give 50 mg by mouth per day as needed.
I do not recommend trying to do an enema yourself at home. It can be dangerous for your dog.
If these remedies do not work, there is a veterinary prescription medication called "lactulose." This is a liquid that is given 2-3 times a day by mouth for constipation. It is quite effective.
There are also foods called "low residue." These are foods that are more digestible which means there is less stool to come out. "Iams low residue" is a popular one.
Try to encourage water intake as well. The more water he drinks, the less likely he will have hard stools. You can add water to his food or a little low sodium chicken broth. Canned food has a higher moisture content then dry food. If he is not used to canned food, change him over very gradually or he will get diarrhea.
I hope this helps.