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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T17:44:48+00:00 2026-05-28T17:44:48+00:00

Typping make (Gnu Make) with the following Makefile (assuming files foo.x and foo.y are

  • 0

Typping make (Gnu Make) with the following Makefile (assuming files foo.x and foo.y are missing)

all: foo.z

foo.z: foo.x foo.y
  cat foo.x foo.y > foo.z

produce the error message:

make: *** No rule to make target `foo.x', needed by `foo.z'.  Stop.

But this Makefile:

all: foo.z

%.z: %.x %.y
  cat %.x %.y > %.z

produce this error message:

make: *** No rule to make target `foo.z', needed by `all'.  Stop.

In the first case, the rule is applied, and a dependency if found to be missing.
In the second case, the rule is found to be not appropriate, and that is a rule that is missing.

I want to use the second Makefile (I have a lot a *.z object to be created), but with an error message like with the first Makefile. My make output is logged, and having the expanded name of the missing files will help debugging.

Is it possible? Maybe a way to force the rule to be used?

Of course I’m not catting file, this is just a example…

  • 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-28T17:44:49+00:00Added an answer on May 28, 2026 at 5:44 pm

    I just found:

    all: foo.z
    
    OBJ=foo.z
    
    $(OBJ): %.z: %.x %.y
       cat %.x %.y > %.z
    

    One need Static Pattern rule. Amazing make…

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

Sidebar

Related Questions

when using a makefile, I want the following to be possible: make clean make
Is it possible to make all function's vars global without typing all of them
I'm trying to make a loop to check if certain files exist, and if
I need to make UI like following: In response to a HTTPRequest, I am
Lets say I call: make -j 5 Is there a way, within my Makefile
Here is what I want to do: Typing make all will build my library
I need to make a batch file that can copy files from one path
I have a project that can be built via makefile, and I would like
In edittext, after typing 'Enter' key, system make a new line inside it. I'd
I'm trying to make a role-playing game, and I want the game to work

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.