# Goals stdlib prelude. # Copyright (C) 2019 Richard W.M. Jones # Copyright (C) 2019 Red Hat Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # This file is included first and automatically in all Goalfiles # (unless you use --no-prelude). It contains standard goals and # tactics. # The only tactic that ‘make’ has. tactic *file (filename) = { # Rebuild if the target file doesn't exist at all. test -f %filename || exit 99 # Otherwise rebuild if it is older than any dependency. for f in %<; do test %filename -ot "$f" && exit 99 || exit 0 done } # This is a simpler tactic than the above since it will # rebuild if the file is missing, but not if it is older. tactic *exists (filename) = { test -f %filename || exit 99 }