I'm talking about the Hungarian border barrier that has recently been built on the Hungary-Serbian borders. What is the official reason announced by the Hungarian government? Is the goal of this barrier to stop the migrants? To control (reduce) the rate of inflow? Is the goal to deter them? Or why does the Hungarian government also force the migrants to choose different way?
The Hungarian government under Viktor Orbán has repeatedly stated that they are not very pleased with the current influx of refugees and would rather prefer if those people would not exist. Unfortunately they do and European law requires Hungary to accept refugees. So claiming that the border fence would not be partially intended as a deterrent would be naïve.
However, the official purpose of the fence is to not deter refugees but to force them to enter Hungary through the official checkpoints so they can be properly registered. Those checkpoints are overcrowded and the humanitarian situation is disastrous, which drives many refugee to move through Croatia instead.
I feel the space between your question and the currently accepted answer needs to be filled, better late than never. Also it's better to answer now as tempers have somewhat settled by now around this. I cite Hungarian documents, but translation services do a good job on these.
The goal of this barrier according to the latter document is to continue to develop the economy without the burden of the unbearable influx of illegal immigrants arriving in Hungary.
Not to reduce the inflow or deter them, but stopping it altogether. "On all other issues, it's only worth talking about after we've stopped the flood".
Hungary does not want to force the migrants to choose a different way, as the PM wrote "if we cannot defend our borders, Schengen could be in jeopardy". And this statement applies to all Schengen countries.
If the protection of Schengen was just a subordination to obsolete rules, and the EU was really open about its borders, then it would make sense if the rules around the borders were lifted. The official Hungarian views state that: "Immigration is also a lucrative business on which dangerous and unscrupulous criminal groups have settled."