makefiles CFLAGS

CFLAGS is a variable that is most commonly used to add arguments to the compiler. In this case, it define macros.

So the -DPACKET_LINK is the equivalent of putting #define PACKET_LINK 1 at the top of all .c and .h files in your project. Most likely, you have code inside your project that looks if these macros are defined and does something depending on that:

#ifdef PACKET_LINK
// This code will be ignored if PACKET_LINK is not defined
do_packet_link_stuff();
#endif

#ifdef LOW_POWER
// This code will be ignored if LOW_POWER is not defined    
handle_powersaving_functions();
#endif

If you look further down in your makefile, you should see that $(CFLAGS) is probably used like:

$(CC) $(CFLAGS) ...some-more-arguments...

Leave a Comment