Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: GNU make keeps deleting source (intermediate) files

  1. #1
    Join Date
    May 2010
    Location
    East Bay, CA
    Posts
    32

    Default GNU make keeps deleting source (intermediate) files

    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?

  2. #2
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: GNU make keeps deleting source (intermediate) files

    Show us an example Makefile that does this.

  3. #3
    Join Date
    May 2010
    Location
    East Bay, CA
    Posts
    32

    Default Re: GNU make keeps deleting source (intermediate) files

    Hi Ken,

    Basically during my build, the following occurs.

    Removing intermediate files....
    rm src/file.c src/file2.c src/file3.c

  4. #4
    Join Date
    May 2010
    Location
    East Bay, CA
    Posts
    32

    Default Re: GNU make keeps deleting source (intermediate) files

    Also to add, I have another file in my source directory that starts with .cdd (special in-company file). Could this be throwing make off?

  5. #5
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: GNU make keeps deleting source (intermediate) files

    Post the entire source of your Makefile. Anecdotes don't help solve the problem.

  6. #6
    Join Date
    May 2010
    Location
    East Bay, CA
    Posts
    32

    Default Re: GNU make keeps deleting source (intermediate) files

    Hi Ken,

    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.

  7. #7
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: GNU make keeps deleting source (intermediate) files

    Create the smallest example that exhibits the symptom.

  8. #8
    Join Date
    May 2010
    Location
    East Bay, CA
    Posts
    32

    Default Re: GNU make keeps deleting source (intermediate) files

    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.

    Thanks!!!

  9. #9
    Carlos E. R. NNTP User

    Default Re: GNU make keeps deleting source (intermediate) 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))

  10. #10
    Carlos E. R. NNTP User

    Default Re: GNU make keeps deleting source (intermediate) files

    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))

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •