> Without the '$\\' syntax, I get everything on one line I didn't understand that until I'd tried it. With just \ as line ending, the G_TRACE macro definition ends up on one line. With \\ as line ending, it ends up with \\ as line ending. With $\\ as line ending, it ends up with \, line you'd want.
> How can I avoid that? This seems to work: martind@sirius:~/tmp/vanem-2023-04-14$ cat Makefile g_trace.h: Makefile; $(file > $@,$(trace_h)) \ = \ define trace_h #define G_TRACE(level, fmt, ...) $\\ do { $\\ if (_g_trace_level() >= level) { $\\ _g_trace_color (TRACE_COLOUR_START); $\\ # .... endef martind@sirius:~/tmp/vanem-2023-04-14$ make --warn-undefined-variables; cat g_trace.h; rm g_trace.h make: 'g_trace.h' is up to date. #define G_TRACE(level, fmt, ...) \ do { \ if (_g_trace_level() >= level) { \ _g_trace_color (TRACE_COLOUR_START); \ # .... martind@sirius:~/tmp/vanem-2023-04-14$ It works with: \ = ... too but not with: \ = \\ ... nor with: A = \ ... nor with A set to nothing or A or whatever. That's with: martind@sirius:~/tmp/vanem-2023-04-14$ make --version GNU Make 4.4.0.91 ________________________________ From: bug-make-bounces+martin.dorey=hds....@gnu.org <bug-make-bounces+martin.dorey=hds....@gnu.org> on behalf of Gisle Vanem <gva...@yahoo.no> Sent: Friday, April 14, 2023 02:38 To: bug-make <bug-make@gnu.org> Subject: Warnings on '$\\' ***** EXTERNAL EMAIL ***** In a makefile I have the need to generate a multi-line C-macro (for use in Glib): g_trace.h: Makefile $(file > $@,$(trace_h)) define trace_h #define G_TRACE(level, fmt, ...) $\\ do { $\\ if (_g_trace_level() >= level) { $\\ _g_trace_color (TRACE_COLOUR_START); $\\ # .... endef Without the '$\\' syntax, I get everything on one line which I'd rather not want. With the '$\\' endings, g_trace.h is perfect. But with 'MAKEFLAGS += --warn-undefined-variables', I get a bunch of warnings: 'reference to undefined variable '\'' How can I avoid that? I read upon '.WARNINGS', but fail to see how to use that in this case. -- --gv