2 # $Id: install-new.mk,v 1.3 2012/03/24 18:25:49 sjg Exp $
4 # @(#) Copyright (c) 2009, Simon J. Gerraty
6 # This file is provided in the hope that it will
7 # be of use. There is absolutely NO WARRANTY.
8 # Permission to copy, redistribute or otherwise
9 # use this file is hereby granted provided that
10 # the above copyright notice and this notice are
13 # Please send copies of changes and bug-fixes to:
17 .if !defined(InstallNew)
19 # copy if src and target are different making a backup if desired
21 src=$$1 target=$$2 _bak=$$3; \
22 if ! test -s $$target || ! cmp -s $$target $$src; then \
24 if test -s $$target; then \
25 if test "x$$_bak" != x; then \
26 rm -f $$target$$_bak; \
27 mv $$target $$target$$_bak; \
35 # If the .new file is different, we want it.
36 # Note: this function will work as is for *.new$RANDOM"
37 InstallNew= ${CmpCp}; InstallNew() { \
42 --bak) _bak=$$2; shift 2;; \
46 for new in "$$@"; do \
47 if test $$_t $$new; then \
48 target=`expr $$new : '\(.*\).new'`; \
49 CmpCp $$new $$target $$_bak; \