redblobgames / helloworld-sdl2-opengl-emscripten

Basic program that uses SDL2+OpenGL, compiling both locally and via emscripten

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Emscripten build doesn't use dependency tracking

redblobgames opened this issue · comments

(Reported by @shillingsburg)

The makefile uses automatic dependency tracking for the native build, using the -MMD compile flag. This creates build/*.d files that list the header files needed for each source file.

The emscripten build doesn't use this flag, so it doesn't automatically rebuild when a header changes. To test:

make www
touch font.h
make www

Expected behavior: it should recompile main.cpp, font.cpp.

Actual behavior: it says no compilation needed.

Fix is simple: add -MMD for the emscripten build.