The IDF is targeting Hamas with the intent on hitting Hamas military targets.
Hamas is launching rockets, missiles and mortars at Israel with the intent of hitting civilians. Those engaging in such attacks receive no protection under the Geneva Conventions.
Hamas has also intentionally placed military stockpiles, personnel, and resources among non-military Gazan residents. Individuals harmed by secondary explosions as a result of ammo dumps in civilian areas receive no protection under the Geneva Conventions.
Residents of Gaza also volunteer to protect Hamas institutions, personnel, and resources. Willing human shields receive no protection under the Geneva Conventions.
Keep that in mind when you hear the words "indiscriminate" and "targeting" and "war crime" in the news.