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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:37:28+00:00 2026-05-25T14:37:28+00:00

Take a look at the following makefile (which isn’t working) … export CC =

  • 0

Take a look at the following makefile (which isn’t working) …

export CC      = gcc
export CFLAGS  = -W -Wall -fPIC -m32

USER = $(DB_USER)
export USER

PASS = $(DB_PASS)
export PASS

SUBDIRS = libs dbserver

.PHONY: subdirs $(SUBDIRS)

subdirs: $(SUBDIRS)

$(SUBDIRS):
    $(MAKE) -C $@

The variables DB_USER and DB_PASS are defined in a separate external file, conf.sh, like this:

export DB_USER=<username>
export DB_PASS=<password>

These are then required in makefiles inside SUBDIRS.

If I run . conf.sh on the command line, and then call make, then USER and PASS are assigned the correct values, and compilation is done all fine. But I wish to call conf.sh inside the makefile so that these variables can be set. How can I accomplish this?

  • 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-25T14:37:29+00:00Added an answer on May 25, 2026 at 2:37 pm

    You could use:

    $(SUBDIRS):
        . conf.sh; $(MAKE) -C $@ DB_USER="$${DB_USER}" DB_PASS="$${DB_PASS}"
    

    This will expose the password on the command line, but gets the job done. Note the double-dollars; that part is evaluated by the shell, not by make (so the curly brackets are also necessary). I’m not sure I recommend it, but it should work.

    Come to think of it, you could probably avoid passing the parameters explicitly since the conf.sh script exports them. The values for $DB_USER and $DB_PASS will be available to the subordinate make anyway:

    $(SUBDIRS):
        . conf.sh; $(MAKE) -C $@
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please help take a look at the following code, its working when calling function
Take a look that the following code snippet: A a = null try {
Please take a look at the following .htaccess ErrorDocument 404 /404/ RewriteEngine On RewriteRule
I need a language lawyer with authoritative sources. Take a look at the following
Please take a look at following code: #include <stdio.h> #include <iostream> using namespace std;
Take a look at the following progression of images: What's happening here is first
Take a look at the following. The question near the end of the code
take a look at the following code I attempted to write inside a constructor:
Take a look at the following classes (UNIdirectional @OneToMany) @Entity public class Team {
Take a look at the following code: Number.prototype.isIn = function () { for (var

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.