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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:28:22+00:00 2026-06-15T17:28:22+00:00

I am new to makefile. I have a makefile with following statement: …. all:

  • 0

I am new to makefile. I have a makefile with following statement:

....

all: prepare hreader $(DIRS)
    echo $(DIRS)

.PHONY: prepare hreader $(DIRS)

prepare:                              
    mkdir -p ./lib
    $(MAKE) -C game_proc prepare     #here, why 'prepare'?!

hreader:
    make -C extra/hreader

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

In my makefile directory, i have a ‘game_proc’ directory. And from GNU make tutorial, i know that below lines

prepare:                           
    mkdir -p ./lib
    $(MAKE) -C game_proc

will do a recursive make on ‘game_proc’.

But why ‘prepare’ also appear in the recipe? Now how do i interpret ‘$(MAKE) -C game_proc prepare’? It does a recursive make on ‘game_proc’, and what? also a recursive make on ‘prepare’?

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-06-15T17:28:23+00:00Added an answer on June 15, 2026 at 5:28 pm

    A phony target just tells make that the rule is not going to create an output file of that name.

    Update after comments

    Ok, it’s important to realize that there are two separate makefiles here at play:

    ./Makefile
    

    and

    game_proc/Makefile
    

    The confusion results from there being a prepare target in both Makefiles.

    I.e., there is in game_proc/Makefile a target prepare. Let’s for a moment rename that target to prepare2 so that the situation becomes clearer:

    ./Makefile:

        .PHONY: prepare hreader $(DIRS)
    
    prepare:                              
        mkdir -p ./lib
        $(MAKE) -C game_proc prepare2 # refers to game_proc/Makefile's prepare2 target
    

    game_proc/Makefile:

    prepare2:
        ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to the world of Makefile writing. I have a C project which
I have the following Makefile rules: DIR = src SOURCES = $(shell find $(DIR)
In a new project I am working on I have the following dir structure:
I am experimenting with makefile...mainly when sources are in many directories I have following
I have the following makefile which is a slight modification on others that I
I have the following code in a java Web Service: public boolean makeFile(String fileName,
I am new to makefile, I am trying to add a make debug mode.
I am new to NDK. I have a cpp file which has the following
To make it simple, say I have the following folders: ./src/ with many .c
I am new to Linux and makefiles. I have a makefile which generates .a

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.