I have a strange issue, when I run my build on my modules. GNU make keeps deleting the source *.c files from all of my modules. It says that they are intermediate files, and deletes them. I have the source files declared as such in the Makefile.
Can’t post the Makefile, it’s 3000+ lines spread across four files. Plus it’s a corporate Makefile, would be a pain to pseudo all of the info on it. :\
That’s the part, I have no clue what creates the deletion. I looked throughout my entire makefiles, and nowhere the source files are being deleted. Only when I turned on debug (-d) mode with my make execution, I noticed that it was stating “Removing intermediate files…” and then proceeds to delete the source files.
On 2010-08-14 02:06, missingunix wrote:
>
> Hello All,
>
> I have a strange issue, when I run my build on my modules. GNU make
> keeps deleting the source *.c files from all of my modules. It says
> that they are intermediate files, and deletes them. I have the source
> files declared as such in the Makefile.
>
> C_FILES = file.c
>
> Anyway I can prevent this deletion?
Your makefile has incorrect orders.
But you should ask this in the programming forum, not here. More programming chaps will be there.
You will need to post your makefile or upload to a pastebin so that they can see why.
–
Cheers / Saludos,
Carlos E. R.
(from 11.2 x86_64 “Emerald” GM (Elessar))
On 2010-08-14 03:36, missingunix wrote:
>
> That’s the part, I have no clue what creates the deletion. I looked
> throughout my entire makefiles, and nowhere the source files are being
> deleted. Only when I turned on debug (-d) mode with my make execution,
> I noticed that it was stating “Removing intermediate files…” and then
> proceeds to delete the source files.
Quite some years ago I was taking a pascal course, with a VAX machine. Suddenly, compilation of the
source would delete the source and create a binary. I needed the source to pass the exams. Rewriting
the code would take several sessions, and time at the terminals was very limited.
I had heard of viruses on PCs (the very first virus known on pcs), so I blamed a virus in the VAX.
The teacher laughed at me.
He took the time to recover a backup copy of my source (the vax kept three backups of each file you
edited, numbered). And tested the compilation. The source was deleted, again. He was baffled.
It turned out that when I declared the program name in the very first statement in the source, I
used name and extension. That was the error, because then the compiler failed when adding extensions
to the name during the compilation and linking, overwriting the .pas file with the binary or
something like that.
Silly error of mine, once you know.
So… review carefully your makefile. Somewhere you will have used the .c files that you should not
have.
–
Cheers / Saludos,
Carlos E. R.
(from 11.2 x86_64 “Emerald” GM (Elessar))
Also, to add. From a bit googling I came across the following:
“However, even if n.c does not exist and is not mentioned, make knows how to envision it as the missing link between n.o and n.y! In this case, n.c is called an intermediate file”
So basically make is treating my source files as if they do not exist?
When I trace my build, I see that it is properly being check-out from RCS tree; but then, for some reason it gets deleted. With make treating my source files as intermediate files.
Aha! You didn’t say RCS had its oar in the mix. Yes, I think that could be a “feature” of a Makefile with RCS smarts built in. What happens if, before calling make, you do
co file1.c file2.c ...
and check out all the .c files beforehand?
Also.look for ‘rcsclean’ in any of the Makefiles.
(Sorry this is late, I’ve been “downy ocean” for a couple of days.)
yes, Geo you are correct. GNU Make now has RCS smarts built into it.
But I found out what the issues are with my build:
in my makefile I have to specify my C files as .PRECIOUS, keep in mind that these makefile(s) were copied over from a Solaris server.
C_FILES = file.c
.PRECIOUS: $(C_FILES)
This will protect the source files from being deleted. But, it will not work accordingly with GNU Make 3.81 (the most recent version on opensuse 11.2). This is most likely a bug; but, I could not find it on GNU make page.
Therefore, I have to use GNU Make 3.80 (have not tried 3.82)