Skip to content
  • Thomas Miedema's avatar
    Declare some Makefile targets to be PHONY · a0ef626e
    Thomas Miedema authored
    Summary:
    Given:
      a Makefile with a non-PHONY target called `target`
    If:
      after running `make target`, a file exists with the same name as `target`
      (it was either already there, or it was created by running `make target`)
    And:
      `target` has no dependencies, such as `clean`, that modify or delete that
      file
    Then:
      subsequent invocations of `make target` will not have any effect.
    
    Solution: make `target` PHONY.
    
    BAD:
      ```
      foo:
              ...
              ./foo
      ```
    
    BETTER:
      ```
      foo:
              ...
              ./foo
      .PHONY: foo
      ```
    
    Reviewers: austin
    
    Reviewed By: austin
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D670
    a0ef626e