insert explicit for loop for compatibility

Some shell do not allow the curly braces syntax. This may not be easy to notice since make will not show the error. I added an explicit for loop to solve this.