Are commands executed from GNU Makefiles recorded to the command history?
The command history from the interactive shell only preserves commands entered into the shell. A Makefile is basically a set of instruction run by an interpreter, not much different from a python program or similar. Commands executed from inside the Makefile are not passed to the interactive shell and thus are not preserved in the shells history.
Should I pass a file instead, or something else that I am missing?
Having the credentials in the same file (Makefile) or in an extra file does not actually help if both files reside together on the same system and are protected by the same access privileges and have the same lifetime. If you can reduce anything in this for the credentials file compared to the Makefile then a separate file can help.
In general how sensitive putting the credentials in a file is (no matter if Makefile or extra file), depends on how much the file might be potentially exposed to attackers. It also depends on how sensitive the credentials are and how long they can be used - so tuning here might be another way to limit the risks. Depending on the specifics or your setup there might be also ways to enter the necessary credentials automatically from a remote system and never keep them in plain on the router. Too much unknown about the setup to make specific recommendations here.
And as usually - security and usability are trade-offs. You've decided that you want to have more usability (automation) which results in additional risks (credentials exposed for some time). You need to decide which trade-offs are acceptable for you and which not.