Pass C user defs (UDEFS) to simulator in common.mk

Hey all, loving the Playdate and developing for it.

I have a very minor issue with using the shipped Make utility common.mk . If I include a debugging guard like this:

#ifdef _DEBUG
    pd->system->drawFPS(0, 0);
#endif

And then specify the user define in my own Makefile like this:

UDEFS = -D_DEBUG -Wpedantic -Wall -Werror

# ...

include $(SDK)/C_API/buildsupport/common.mk

Then the UDEFS don't take effect in the simulator, only in the build running on the Playdate.

I've modified common.mk locally but of course this means my project is less portable and must include instructions for modifying common.mk if I collaborate with others.

I've modified this line in common.mk:109:

CLANGFLAGS += -g $(USIMDEFS)

which allows me to specify for example:

USIMDEFS = -D_DEBUG -D_INVINCIBLE

but alternatively CLANGFLAGS += $(UDEFS) would be fine to ensure both the simulator build and the playdate build are built with the same flags (though I like to be able to modify them independently).


Looking forward to more Playdating, and thanks for the awesome community :slight_smile:

2 Likes