This isn't a makefile question, it's a shell scripting question. You solve the problem by writing a shell command at your shell prompt, then you just put that same solution into your makefile.
The head
utility prints the first lines it reads from standard input or from a file. It doesn't run a command that you give it as an argument.
It's printing the first 10 lines of the contents of your program file, which is binary "gibberish" as you say.
This is what pipes are for:
./print-word-length.cc </dir/dictionary.txt | head -n10
This says: start print-word-length.cc
and set it up so whatever it prints to its output is sent to the head
command as its input.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…