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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:56:06+00:00 2026-05-17T23:56:06+00:00

I am trying to figure out why I can’t specify a target as being

  • 0

I am trying to figure out why I can’t specify a target as being in different directory.

I am trying to generate some php classes from json files, but I’ve changed the line that actually generates the php to a dummy echo statement, so somebody else can just copy paste and test if they feel very generous.

There are two other things to add to the directory containing the makefile:

  • A dummy dependency file called PatientDbPath.json
  • A directory called out

If I have a makefile with the following:

.SUFFIXES: .php .json
.json.php:
    echo "HelloMe" > PatientDbPath.php

PatientDbPath.php: PatientDbPath.json

clean:
    $(RM) PatientDbPath.php

Then everything works when I run make; PatientDbPath.php is correctly created and the next time I run make, I get the message make: 'PatientDbPath.php' is up to date.

However, I want to generate the php file in a separate directory, so I updated my makefile to the following:

.SUFFIXES: .php .json
.json.php:
    echo "HelloMe" > out/PatientDbPath.php

out/PatientDbPath.php: PatientDbPath.json

clean:
    $(RM) out/PatientDbPath.php

As soon as I do that, Make tells me make: Nothing to be done for 'out/PatientDbPath.php' even though there is no file PatientDbPath.php in the out directory.

So I thought maybe it was something with the suffix rules and I created a third makefile.

out/PatientDbPath.php: PatientDbPath.json
    echo "Whatever" > out/PatientDbPath.php

clean:
    rm out/PatientDbPath.php

This one works well, like the first one. Can anybody see what I’m doing wrong in my 2nd makefile?

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-05-17T23:56:06+00:00Added an answer on May 17, 2026 at 11:56 pm

    There are two errors in your wildcard rule (.json -> .php), one conceptual and one practical.

    The conceptual error is that this is a rule how to convert arbitrary json files (say, foo.json) to arbitrary-but-same-named .php files (say, json.php). Yet, your rule is specific for gnerating PatientDbPth.php. A better rule would be

    .json.php:
        echo "HelloMe" > $@
    

    where $@ is a variable naming the output file.

    This also shows the practical problem: These rules are really restricted to same-named files. If you have a rule translating .json in .php, and you have foo.php, and you want bar.php, then the wildcard rule won’t match. Matching involves the entire file name, so the wildcard rule doesn’t match when you ask for out/PatientDbPath.php. This leaves you with the rule that has no action, hence make infers that nothing is to be done.

    If this is the only file you want to convert, it’s best to write it the way you did in the third file. If you have many json files, and you all want to convert them to out/*.php, and you are using GNU make, you can use GNU make’s generalized wildcard rules:

    out/%.php:    %.json
        action
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to figure out how I can pass data from page-list.php to page.php
I trying to figure out how I can delete from multiple tables in SQL
i'm trying to figure out how I can use Linq to filter out some
hello there :) Im trying to figure out how i can grab some content
I'm trying to figure out I how can do something like: console.log('<?php print_r($_SESSION); ?>');
I am trying to figure out how I can update my UI from an
I'm trying to figure out how I can adjust the css in my register.php
I'm trying to figure out how I can deny users from looking at a
So I'm trying to figure out how can I have 3 classes call one
I am trying to figure out how can I update the petevents table with

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.