make/CreateHgtipFiles.gmk
author erikj
Wed, 08 Jun 2016 15:13:19 +0200
changeset 39110 712f29ba8708
permissions -rw-r--r--
8136771: Implement the license-swap logic as a make target Reviewed-by: tbell
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
39110
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
     1
#
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
     2
# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
     4
#
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
     7
# published by the Free Software Foundation.  Oracle designates this
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
     8
# particular file as subject to the "Classpath" exception as provided
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
     9
# by Oracle in the LICENSE file that accompanied this code.
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
    10
#
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
    15
# accompanied this code).
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
    16
#
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
    20
#
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
    23
# questions.
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
    24
#
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
    25
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
    26
default: all
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
    27
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
    28
include $(SPEC)
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
    29
include MakeBase.gmk
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
    30
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
    31
define SetupCreateHgtip
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
    32
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
    33
  $$(strip $1)/$(HGTIP_FILENAME): FRC
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
    34
	$(HG) tip --repository $$(strip $1) --template '{node|short}\n' > $$@.tmp
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
    35
	if [ ! -f $$@ ] || [ "`$(CAT) $$@`" != "`$(CAT) $$@.tmp`" ]; then \
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
    36
	  $(MV) $$@.tmp $$@ ; \
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
    37
	else \
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
    38
	  $(RM) $$@.tmp ; \
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
    39
	fi
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
    40
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
    41
  TARGETS += $$(strip $1)/$(HGTIP_FILENAME)
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
    42
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
    43
endef
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
    44
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
    45
# Only try to create the tips if finding an actual hg repository. This will be
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
    46
# false if building from a source bundle.
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
    47
$(foreach r, $(call FindAllReposAbs), \
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
    48
  $(if $(wildcard $r/.hg), $(eval $(call SetupCreateHgtip, $r))) \
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
    49
)
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
    50
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
    51
all: $(TARGETS)
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
    52
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
    53
FRC:
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
    54
712f29ba8708 8136771: Implement the license-swap logic as a make target
erikj
parents:
diff changeset
    55
.PHONY: all