bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GNU make for x86_64-pc-linux-gnu


From: Paul Smith
Subject: Re: GNU make for x86_64-pc-linux-gnu
Date: Wed, 09 Nov 2022 10:34:05 -0500
User-agent: Evolution 3.46.1 (by Flathub.org)

On Wed, 2022-11-09 at 14:58 +0000, Dadzio, Joerg wrote: 
> I want to inspect the preprocessor output of  ‘make’ for .c projects
> in order to make sure my set of ‘#define …’ instructions does work
> fine.

Note, there is no such thing as "preprocessor output of make". 
Makefiles are not C/C++ code, and the preprocessor runs on C/C++ code.

Make can invoke the preprocessor on your C/C++ code, if you write a
recipe that tells make how to do that.

> However, I can’t find the option to get it, and ‘-E’ did not work.
> Can you help me – or notify this note as a request, please?

When asking for help please include the EXACT command you typed (cut
and pasted from your terminal) and the EXACT output you got (again, cut
and pasted), plus information on what was wrong.

If you mean you invoked "make -E", then no, that will not work because
"-E" is an option to the C/C++ compiler, and make is not a C/C++
compiler: it can *RUN* a C/C++ compiler, but it is not itself a
compiler (see above).

If you mean you invoked some recipe in your makefile that ran the
compiler with the -E option, then please show what happened: "did not
work" is not a problem description we can help you with.


Just FWIW, here is a sample rule that could appear in your makefile to
invoke the preprocessor only (assuming your source files use ".c"
extensions):

    %.i : %.c
            $(CC) $(CPPFLAGS) -E -o $@ $<

Now if you run "make foo.i" then make will run the preprocessor on the
file "foo.c" and put the results in a file "foo.i".



reply via email to

[Prev in Thread] Current Thread [Next in Thread]