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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:54:12+00:00 2026-05-30T21:54:12+00:00

In GNU Make, currently I am lowering the case of a drive letter using

  • 0

In GNU Make, currently I am lowering the case of a drive letter using the following substitution.

$(eval _ABS_PATH=$(subst C:,c:,$(abspath $(DIRECTORY))))

How can I modify this such that I can have A-Z substitution to a-z for the drive letter?

Thanks!

  • 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-30T21:54:13+00:00Added an answer on May 30, 2026 at 9:54 pm

    I’m not sure why you’re using eval here; why not just:

    _ABS_PATH = $(subst C:,c:,$(abspath $(DIRECTORY)))
    

    But, anyway, anytime you need to do something massively clever with string translations, etc. in GNU make there’s a good bet that John Graham-Cumming has already done it for you. Check out his most excellent toolkit GMSL (GNU Make Standard Library) for many common functions. Included there is a variation of lc (lowercase). Rather than reproduce it here (along with the copyright notice as it’s under a BSD license) you can go get a copy.

    Once you have it you can do something like this if you want the entire path lowercased:

    include gmsl
    _ABS_PATH = $(call lc,$(abspath $(DIRECTORY)))
    

    If you just want the drive letter to be lowercased but not the rest it’s more complex, something like this should work:

    include gmsl
    _DRIVE = $(word 1,$(subst :, ,$(abspath $(DIRECTORY))))
    _ABS_PATH = $(call lc,$(_DRIVE)):$(patsubst $(_DRIVE):%,%,$(abspath $(DIRECTORY)))
    

    There may be simpler ways. Also if you’re sure the value of DIRECTORY is already set you should consider using “:=” here instead of “=” as it will make things MUCH more efficient (especially if $(_ABS_PATH) is used a lot).

    • 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 in my project. I'm currently putting one makefile per directory
I'm using GNU Make 3.81, and I have the following rule in my Makefile:
Using GNU's make, I'd like to extract the first character of a variable. Currently
I have a C++ small project using GNU Make. I'd like to be able
Follow up to this question about GNU make : I've got a directory, flac
I am currently using GNU Emacs 23.0.93.1 in Windows Vista SP1. In my .emacs
Using GNU Make I want to remove values from a variable: VAR := x.c
I'm trying to set up an ETL system using GNU Make 3.81. The idea
I installed the latest GNU make to my windows machine. The installer decided to
I've been trying to make GNU gdb 6.5-14 to use the source code embedded

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.