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 6790181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:41:41+00:00 2026-05-26T17:41:41+00:00

when using a makefile, I want the following to be possible: make clean make

  • 0

when using a makefile, I want the following to be possible:

make clean  
make Clean  
make CLean
make CLEan
make CLEAn
make ... 

and have all to do the same thing in my makefile.
(ie. I don’t want make goals to be case sensitive)

Sure, I could just write every possibly like this:

.PHONY clean Clean CLean CLEan CLEAn ... 
clean Clean CLean CLEan CLEAn ...:  
    $(DELETE_STUFF)

but I think you can see why this is not desired..
I know that ‘make’ has a built in macro called: MAKECMDGOALS which will be equal to whatever you type after typing make.

for example, running 'make clean all backup'   
$(MAKECMDGOALS) = "clean all backup"  

I tried to do this at the top of my makefile:

MAKECMDGOALS:= $(shell echo $(MAKECMDGOALS) | tr "[:upper:]" "[:lower:]")

it does change the variable to all lowercase, but will still only call the rule for the target goal typed.

I’ve even tried to override it like this:

override MAKECMDGOALS:= $(shell echo $(MAKECMDGOALS) | tr "[:upper:]" "[:lower:]")

in hopes that will be done sooner, yet no success.

I was going to make a target like this:

$(MAKECMDGOALS):
MAKECMDGOALS:= $(shell echo $(MAKECMDGOALS) | tr "[:upper:]" "[:lower:]")
#BUT I CAN'T CALL OTHER TARGETS FROM THE SHELL  

I know it’s a silly detail to fuss over, but surely there has got to be a way right?

  • 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-05-26T17:41:42+00:00Added an answer on May 26, 2026 at 5:41 pm

    Crude but effective:

    %:
            $(MAKE) $(shell echo $@ | tr "[:upper:]" "[:lower:]")
    
    clean:
            delete_stuff
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using GNU Make 3.81, and I have the following rule in my Makefile:
i have a small java project i want to build using a makefile, the
I'm using CMake and I want to try and make it so I have
I'm writing a custom makefile project using QtCreator and I want to delete a
I'm using a makefile to automate some document generation. I have several documents in
I'm using (GNU) Make in my project. I'm currently putting one makefile per directory
I have a makefile project that builds and links a DLL, using the command-line
I want to run my make with -j8 if I'm not using distcc, but
Here is more specific explanation of what I want to make clear: I have
In my Makefile I want to create an environment variable using the current date

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.