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

  • SEARCH
  • Home
  • 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 8254407
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T01:10:39+00:00 2026-06-08T01:10:39+00:00

If I run make clean twice the second invocation will build the dependency Makefiles

  • 0

If I run make clean twice the second invocation will build the dependency Makefiles that are scheduled for removal. How can I get Makefile to recognize the files scheduled for removal and skip the recursive call to make for that directory? In other words, only make clean in sub directory if the makefile already exists in each sub directory, on a per sub directory basis. I don’t know the GNU-Make syntax but I’m looking for something like:

Dependencies=[dependency1,dependency2,dependency3,dependency4]
DoNotMake=[bool1,bool2,bool3,bool4]
for all (i < 4): 
    if (! Dependencies(i)/Makefile):
        DoNotMake(i)=true

The current rules for make clean are as follows:

.PHONY: clean
clean:
    $(MAKE) MAKEDEPEND=off SUBDIR_ARGS=clean
    rm -f dependency1/Makefile
    rm -f dependency2/Makefile
    rm -f dependency3/Makefile
    rm -f dependency4/Makefile
    rm -f dependency4/src/config.h.in
  • 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-08T01:10:40+00:00Added an answer on June 8, 2026 at 1:10 am

    I can’t give you a definite answer since there’s still a lot of your makefile that you haven’t posted, but here are some things that we do to solve similar problems.

    The make variable MAKECMDGOALS contains the current make target. If you want to avoid doing something when you run make clean, you can do something like this:

    ifeq (,$(findstring $(MAKECMDGOALS),clean))
      # Whatever you place here won't be run when you run 'make clean'
    endif
    

    You can also add a bit of shell script to only invoke a sub-makefile when it exists:

    some_target:
        [ -f $(SUB_FOLDER)/Makefile ] && $(MAKE) -C $(SUB_FOLDER)
    

    If your makefiles are being created implicitly, then these may not work. You may be able to use the --assume-old= option to prevent make from re-building the makefiles (I’ve never tried to use that on a file that doesn’t exist, so YMMV).

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

Sidebar

Related Questions

Can I make it so that F5 doesn't run in VS any more? I'm
Can I make my own jabber server.So that if I run my website xyz
I am running Ubuntu 10.04. Whenever I run make clean , I get this:
When I run make (after running qmake) I get the following error: /usr/bin/ld: cannot
I have a simple Makefile: default: @make build @make run build: @javac Test.java >
When I run make all on the following Makefile I get this error: Makefile:5:
I just discovered that I was getting twice the number of tests run that
I cannot figure out why make is giving me this. I run make clean;
When I run make I get an error: root@vagrantup:~/npm-1285112852/scripts# ./install.sh % Total % Received
I am trying to run make on a PintOS makefile but I keep getting

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.