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

  • Home
  • SEARCH
  • 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 601041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:40:18+00:00 2026-05-13T16:40:18+00:00

I’m trying to use the linux utility make in order to Run a script

  • 0

I’m trying to use the linux utility make in order to

  1. Run a script to generate the data
  2. Take all of the output files (data1.txt to data79.txt) and run a script to plot them each
  3. Take all those images and make a movie from them

Yes, I realize that doing this in a shell/python script would be downright simple but I’m trying to learn how to use make in this context to do the work more intelligently.

My current make file looks something like this but is significantly flawed:

movie: data *.png 
    ffmpeg data_%d.png output.mp4

%.png: %.txt
    python plot.py $< $@

data:
    python make_data.py
  • 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-13T16:40:19+00:00Added an answer on May 13, 2026 at 4:40 pm

    You have several problems, so let’s take them in order. (Caveats: I use GNUMake, so I can’t promise my solution will work with other flavors, and I am not familiar with ffmpeg.)

    1. The data rule looks correct, but you might want to warn Make that this rule does not actually produce a file called “data”:
      .PHONY: data
      

      You can test this rule by itself: “make data”.

    2. The %.png rule looks correct. You can test it: “make data26.png” (after making sure that data26.txt exists).
    3. The movie rule. This is a problem, because you’re using “*.png” to indicate all png files, but at the time you run the rule there are no such files, so this evaluates to nothing. So we must look at all the data files that exist, and translate that list into a list of images to be made:
      dfiles = $(wildcard *.txt)
      images = $(dfiles:txt=png)
      

      This will work if the data files already exist (and you can test it after “make data”), but when we first run make, the data files don’t exist. There are several ways to address this; the simplest is to run Make a second time from within a rule, after the data files have been made:

          $(MAKE) output.mp4
      

    Putting it all together, we get something like this:

    .PHONY: movie
    movie: data
        @$(MAKE) -s output.mp4 # I added the "@" and "-s" to make it quieter.
    
    dfiles = $(wildcard *.txt)
    images = $(dfiles:txt=png)
    
    output.mp4: $(images)
        ffmpeg data_%d.png $@ 
    
    %.png: %.txt 
        python plot.py $&lt $@ 
    
    .PHONY: data
    data: 
        python make_data.py
    

    (Note that some people like to put all the PHONY declarations together: “.PHONY: movie data”. I prefer to do it as above.)

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

Sidebar

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.