This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re : Re : make option to recompile only changed files





----- Message d'origine ----
De : Andre-Marcel Hellmund <mail@andihellmund.com>
À : charfi asma <charfiasma@yahoo.fr>
Cc : Thomas Martitz <thomas@v.h>; gcc-help@gcc.gnu.org
Envoyé le : Ven 22 octobre 2010, 14h 52min 52s
Objet : Re: Re : make option to recompile only changed files

Hey Asma,
> thank you for your help, but acctually, I do not change the uml1.c itself, I
> changed in a text file that contains a set of c instructions and I include 
this
> file in my uml1.c
>    
Why do you do that? Just from a style perspective, you shouldn't include C 
instructions that way into your language hooks. Obviously, that works, but you 
should better work with functions (in separate source files) and call these 
functions then from your language hooks.
> So, if I do not reconfigure and make, the compiler will not compile the uml1.c
> again, it will keep the same uml1.o (with old c instructions took from the old
> text file).
>    
Your makefile (make-lang.in) misses some dependencies. Your uml1.o rule should 
look like this:

uml1.o: uml1.c <GCC stuff> <your_text_file_containing_instructions>
...

Then uml1.o will be re-compiled once you modify your text file ...

> any idea ? I can not add to make coomand a list of files to recompile ? or can 
>I
> add the c instructions of text.txt to my uml1.c using another way ?
>    
Yes, by using functions and let the linker finally do the work for you. Just as 
an example: you would create a source file for your language hooks (my_hook.c) 
and a source file for your C instructions doing the GENERIC stuff 
(my_generic.c). You'll then compile them both separately and link them together 
into <your_compiler>, e.g. gcc my_hook.o my_generic.o <other_stuff> -o 
<your_compiler>

For a reference, please look at the sample front-ends you already used so far. 
The gcalc front-end uses the approach described above ...

Hope that helps,
Andi

Hello,
I am intersted in the method explained above by Andi : 

Yes, by using functions and let the linker finally do the work for you. Just as 
an example: you would create a source file for your language hooks (my_hook.c) 
and a source file for your C instructions doing the GENERIC stuff 
(my_generic.c). You'll then compile them both separately and link them together 
into <your_compiler>, e.g. gcc my_hook.o my_generic.o <other_stuff> -o 
<your_compiler>

where should I add this instruction: gcc my_hook.o my_generic.o <other_stuff> -o 
<your_compiler> ? in the make_lang file ?
I am a little bit confused so can so help me understand how to tell gcc that I 
want to compile my_generic.c and link it to my compiler 


thanks

Asma





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]