core: Fix crashing make on initial build

Fixes #841

(cherry picked from commit bb2f29f55c6209e5ec244014491d1d6e64ceae9e)