check and replace predefined value twice to make sure even the placeholder used in 'defines' can be replaced