help-gnu-utils
[Top][All Lists]
Advanced

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

Re: Preprocessing files with make


From: Colin S. Miller
Subject: Re: Preprocessing files with make
Date: Thu, 19 Aug 2004 11:11:56 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040413 Debian/1.6-5



Thanks for the reply but perhaps I was a little unclear. The problem I have is to make the rule to preprocess the files.
E.i what i want is this
source/dir1/source.c -> preprocessed/source.d

The easy party is to construct a variable wich contain the source files
and preprocessed files but i dont know how to use them.

I hope my intent is clear now. I think this is a trivial task for someone with a great knowledge of make then I have.

Thanks,
Erik

Make isn't concerned about what format
the source files are in, you
neeed to know how to make gcc (or compiler
of your choice) preprocess a C file,
but not compile it. For gcc it's the
'-E' option.

The following makefile should work ( '.i' is
gcc's prefered extension for preprocessed files,
not '.d' )

#Start example makefile

ALL: foo

foo.i: foo.c
    gcc -E -o foo.i foo.c

foo.o: foo.i
    gcc -c -o foo.o foo.i

foo: foo.o
    gcc -o foo foo.o

#end example makefile



HTH,
Colin S. Miller


reply via email to

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