Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8289915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T12:38:19+00:00 2026-06-08T12:38:19+00:00

My Makefile is not deleting intermediate files. I’ve set .INTERMEDIATE . Here is my

  • 0

My Makefile is not deleting intermediate files. I’ve set .INTERMEDIATE. Here is my Makefile:

OBJECTS=prefixer.o stack.o
CFLAGS=-Werror -Wmissing-prototypes -g
LIBS=-lm
CC=gcc

prefixer : $(OBJECTS)
    $(CC) -o prefixer $(OBJECTS) $(LIBS)

prefixer.o : stack.h
    $(CC) -c prefixer.c -o $@ $(CFLAGS)
stack.o : stack.c stack.h
    $(CC) -c stack.c -o $@ $(CFLAGS)

.INTERMEDIATE: %.o

.PHONY: clean
clean : 
    -rm prefixer *.o

What is wrong with .INTERMEDIATE?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T12:38:24+00:00Added an answer on June 8, 2026 at 12:38 pm

    See Gnu make special targets for role of .INTERMEDIATE

    You probably mean

     .SECONDARY:  $(OBJECTS)
    

    because I think that if you put .INTERMEDIATE then the objects will always be removed, and you probably don’t want that. I don’t think you can meaningfully put %.o as prerequisites of special targets.

    I would suggest to keep the object files so you don’t waste time recompiling them.

    Running once make -p will teach you a lot about the rules that make knows about.

    Using remake -x (i.e. remake) is very helpful, at least to debug complex Makefile-s. You could also use make -d but I find it too verbose.

    You may want to use better builders than make e.g. omake.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Not sure if this is possible in one Makefile alone, but I was hoping
I have checked in buid directory and have not found makefile there. How does
The following Makefile is not working and I am not sure what's going on.
Given a Makefile (command are not needed in this example): program: src0.o src1.o src0.o:
I have this makefile: SHELL=/bin/zsh COMPILER=g++ -g COMPILERSO=g++ -a +a1 -b LIBDIR=/Users/romeovs/Desktop/rootex CFLAGS=$(root-config --cflags)
Change the environment variable `PATH' in Makefile does NOT take effect with make in
How could I abort a make/makefile execution based on a makefile's variable not being
My makefile is below Also, I would appreciate it if you told me how
Is makefile an advanced problem or a general problem for a programmer? For a
I have a big makefile that I have configured with several phony targets. One

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.