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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T17:38:59+00:00 2026-05-20T17:38:59+00:00

So I have a makefile, and in that makefile is a rule that first

  • 0

So I have a makefile, and in that makefile is a rule that first performs a precompile transform and modifies the source file and then compiles it into the proper target. I would like to know if there is a way to trick/coerce make into thinking that the source was not actually modified, so that make will only recompile when a user modifies, not when the make rule modifies the source. I attempted to use the touch command to turn back the modification timestamp after the make modification, but without success. Does anyone have any ideas? 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-20T17:39:00+00:00Added an answer on May 20, 2026 at 5:39 pm

    One possible way to accomplish what you want is to create a secondary target — that is a zero length file which acts like a flag to say whether you’ve done what you want to do or not, and have the rule which does the precompile transform based on that file.

    I guess I have a question about what you are trying to do. Why do the transform in-place, rather than have the transform create an intermediate file which then gets compiled.

    In-place transformations can be problematic, especially if the transform process is not idempotent.

    Edit 1

    Based on your question, I would say you could do this:

    target.flag: target.original-file
        touch target.save -r target.original-file
        <do transformation>
        touch target.original-file -r target.save
        rm target.save
        touch target.flag
    

    Using touch with the “-r” option says to grab the access date from the specified file. So you would be saving the date of the original file on temporary file. Then do the transformation, then use touch to grab the date from the temporary file and put it back on the now transformed file.

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

Sidebar

Related Questions

I have a make file of, more or less, the following structure that compiles
Hopefully this is a very simple question. I have a makefile pattern rule that
I have a working makefile that builds with mingw32. Now i renamed that makefile
I have a section of makefile that has this sort of structure: bob: ifdef
I have a project that has a makefile with broken dependencies. Is there any
In a makefile, I have the following line: helper.cpp: dtds.h Which ensures that helper.cpp
I want to use some functions from a .cpp source file that has a
If I have a makefile that calls another makefile, how to I get the
I'm making a Makefile that moves an output file ( foo.o ) to a
If I have a rule in my makefile like this: subdir/object: cd subdir &&

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.