Hard to say if wars (fictive or real) ever had any rules. And if there were some rules, then there were also attempts to break them, or at least to avoid them to take any advantage. So, it may seem like nonsense to try to restrict wars by rules.
But what if someone (mostly probably a ruler or another very important person) would be willing to do it and have sufficient power to enforce it - even if s/he would be the first person who would suffer for those rules.
Ruler wants to keep her kingdom (and mostly its capital that is capable to keep all people for limited time) safe. The kingdom does not have its own army, but has a treaty with other two countries (and in that way the ruler may count as having three armies) for cases of defense. So, the ruler needs to force the enemy army to wait until defenders arrive.
Kingdom suffers from guerrilla attacks of self-proclaimed army called White hunters. Since the main targets of this self-proclaimed army are hospitals and unfortified settlements, the ruler had to declare martial law and open bounty on White hunters to cancel the surprise element.
Meanwhile the situation in the first case is very simple. The situation in the second case is very problematic because war crimes may happen on both sides.
What rules could we set to make wars fair (if it is ever possible) and free of war crimes? And who should monitor compliance (because each fighting side may see the same thing in a different way)?
Cases described above are only examples from my own fantasy world - that may (or not) fit to some cases in real world. But let's say that many things may be done a little more easily in fantastic worlds, instead of the real world.
Other case (and now from real world) is war in former Yugoslavia (the mentioned song is about it, even if it didn't mention anyone or anything concrete in its lyrics), where all sides did some war crimes.
Special case was ETA in Spain. I don't know if all, but at least some bomb attacks were announced to minimize casualties.
Probably the first war with exactly named (and defined for the first time) war crimes was WWII.