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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:57:44+00:00 2026-05-26T08:57:44+00:00

I have this makefile: SHELL=/bin/zsh COMPILER=g++ -g COMPILERSO=g++ -a +a1 -b LIBDIR=/Users/romeovs/Desktop/rootex CFLAGS=$(root-config –cflags)

  • 0

I have this makefile:

SHELL=/bin/zsh
COMPILER=g++ -g
COMPILERSO=g++ -a +a1 -b
LIBDIR=/Users/romeovs/Desktop/rootex
CFLAGS=$(root-config --cflags)
LIBS=$(root-config --libs) -lPhysics -lThread -lMinuit -lHtml -lVMC -lEG -lGeom
ROOT=/usr/local/bin/root -b -q

.SUFFIXES=.C .o

WriteTree : WriteTree.C Event.o Event_C.so Event.h
    ${COMPILER} WriteTree.C -o  $@ Event.o Event_C.so ${CFLAGS} ${LIBS}
Event_C.so : BuildLibDico.C
     ${ROOT} BuildLibDico.C
Event.o : Event.C Event.h
    ${COMPILER} -c ${CFLAGS} Event.C 

When I run in make Event.o int the command line, one would expect make would run:

${COMPILER} -c ${CFLAGS} -o Event.o Event.C

which should expand to

g++ -g -c $(root-config --cflags) -o Event.o Event.C

which in turn should have $(root-config --cflags) expanded.

Yet when I do this make hails:

g++     -c -o Event.o Event.C

(note the extra space between g++ and -c). This in turn causes compilation errors of course.

It seems as if the expansion doesn’t work properly. Running:

g++ -c $(root-config --cflags) -o Event.o Event.C 

does work though.

What can I do to fix this?


EDIT

One part of the problem is fixed by Gilles answer.

Another part of the problem was that make didn’t actually look food a makefile in the directory (it’s called WriteTree.make), and was running the basic g++ command.

This can be fixed by using make -f WriteTree.make Event.o, yet I don’t know if it’s good make behavior (I would really like it to look for itself for makefiles, not only makefile but every *.make).

  • 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-26T08:57:45+00:00Added an answer on May 26, 2026 at 8:57 am

    CFLAGS=$(root-config --cflags) sets CFLAGS to the value of the make variable with the bizarre name root-config --cflags. Since you have no such variable, the expansion is empty. Note that make accepts either ${variable_name} or $(variable_name), and if the character following the $ isn’t an opening parenthesis or brace then it’s used as a variable name (even e.g. $foo expands to the value of the variable named f followed by the two characters oo).

    You need to double the dollar sign: $$ expands to a single $, and then you’ll have a shell snippet.

    CFLAGS = $$(root-config --cflags)
    LIBS = $$(root-config --libs) -lPhysics -lThread -lMinuit -lHtml -lVMC -lEG -lGeom
    

    Another error is that .SUFFIXES = .C .o should have a colon instead of the equal sign: .SUFFIXES: .C .o. This doesn’t matter here since you have no implicit rule.

    Finally, make looks for Makefile (or makefile with some implementations; GNU make first tries GNUmakefile). Make only reads a single makefile in any case (not counting files reached through include directives). If you want to use a different makefile, you need to specify it explicitly on the command line, with the -f option. If you want to split your rules into several makesfiles, write a master makefile that includes them all; note that the makefiles will share a single namespace for targets and variables. In GNU make, you can include all files matched by a wildcard pattern:

    include $(wildcard *.make)
    

    Note that the file names are relative to the current directory that you invoked make from. If you want to look for files in the same directory as the makefile, you need to indicate it explicitly:

    include $(wildcard $(dirname $(lastword $(MAKEFILE_LIST)))/*.make)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this in my Makefile: BINS = $(shell echo *.bin) .PHONY: $(BINS) run:
At the beginning of a makefile I have this line : PATH := $(PATH):/other/dir
I have a Makefile that looks like this CXX = g++ -O2 -Wall all:
I have a section of makefile that has this sort of structure: bob: ifdef
I have the following Makefile rules: DIR = src SOURCES = $(shell find $(DIR)
I have this Makefile code: %.spf: @echo $@; runMe.sh $1 $2 $3 $4 $5;
Look at this makefile, it has some sort of primitive progress indication (could have
I have a Makefile with several rules of this form protolist.c: $(PROTOCOLS) Makefile src/genmodtable.sh
I have a makefile as follows: CC = gcc CFLAGS = -fmessage-length=0 -MMD -MP
I have this Makefile and each line run OK separately, but when I do

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.