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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:16:40+00:00 2026-06-18T09:16:40+00:00

I have the following (very simplified) Makefile: # Makefile MAKESH=shell USER=$($MAKESH logname) which aims

  • 0

I have the following (very simplified) Makefile:

# Makefile

MAKESH=shell
USER=$($MAKESH logname)

which aims to store my login name in the USER variable as if the $(shell logname) command was invoked. However this doesn’t happen. I suspect that it’s due to the way make evaluates variables.

Does anyone have some more insight to this or a possible workaround i.e. explicitly tell make that $MAKESH is actually the shell command?

Thanks.

Edit

Consider the following example:

#parent.mk

...
include child.mk
...

-------------------
#child.mk

export $(shell logname)/path1
export $(shell logname)/path2

-------------------
#bash_script.sh

...
source child.mk
...

(in this example, sourcing child.mk fails)

Essentially, what I wanted to do is to create a file that exports pathnames depending on the current user. The syntax should be valid both for makefiles and bash scripts, since it can be included/sourced from both places.

I also wanted to do subtle changes to these files, since they are part of a larger project and the interconnections are a bit confusing.

I have finally decided to go with this:

#parent.mk

...
export logname=$(shell logname)
include child.mk
...

-------------------
#child.mk

export $(logname)/path1
export $(logname)/path2

-------------------
#bash_script.sh

...
source child.mk
...

which is quite hacky, a tiny bit dangerous, but works. If you know a more elegant way/aprroach, let me know.

Finally, thank you for your solutions (and your warnings), which are valid for the pre-editted question.

  • 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-18T09:16:41+00:00Added an answer on June 18, 2026 at 9:16 am
    MAKESH=shell
    $(eval USER=$$($(MAKESH) logname))
    $(info USER is $(USER))
    

    Avoid if possible.

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

Sidebar

Related Questions

In a very simplified case, I have the following setup in which, I simply
I have the following very simple code snippet which is loaded from a separate
I have the following SQL statement which has a very bad performance: SELECT frmInstLastModifiedDate
I have the following function which works very well within a $(document).ready(function(){ $('.threadWrapper >
I have the following code in specman: var x := some.very.long.path.to.a.variable.in.another.struct; while (x ==
I have the following tables defined declaratively (very simplified version): class Profile(Base): __tablename__ =
I have following XAML (simplified, no ending tags): <Window Name=myWindow DataContext={Binding ElementName=myWindow} > <DockPanel>
Let's say I have the following app.js (obviously very simplified): var express = require('express'),
I have got the following very simple code: function init() { var articleTabs =
I have the following line of code called very often: var configValue = System.Configuration.ConfigurationManager.AppSettings[ConfigValueKey];

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.