Makefile: fixed error '/bin/sh: 1: Syntax error: "(" unexpected'

Removed bash array construct for counting and replaced with GNU make word counting.