illumos-gcc: use values-Xc/values-Xa startfiles
[unleashed-userland.git] / make-rules / prep-patch.mk
blob2c079cb8f78cbf033a1978c0b74bbef88f945539
2 # CDDL HEADER START
4 # The contents of this file are subject to the terms of the
5 # Common Development and Distribution License (the "License").
6 # You may not use this file except in compliance with the License.
8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 # or http://www.opensolaris.org/os/licensing.
10 # See the License for the specific language governing permissions
11 # and limitations under the License.
13 # When distributing Covered Code, include this CDDL HEADER in each
14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 # If applicable, add the following below this CDDL HEADER, with the
16 # fields enclosed by brackets "[]" replaced with your own identifying
17 # information: Portions Copyright [yyyy] [name of copyright owner]
19 # CDDL HEADER END
21 # Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
24 GPATCH = /usr/gnu/bin/patch
25 PATCH_LEVEL ?= 1
26 GPATCH_BACKUP = --backup --version-control=numbered
27 GPATCH_FLAGS = --strip=$(PATCH_LEVEL) $(GPATCH_BACKUP)
30 # Rules for patching source that is downloaded and unpacked or pulled from
31 # a source repository.
33 # PATCH_DIR can be overridden to move patches to a different location
34 # PATCH_PATTERN can be overridden to adjust the patch naming scheme that the
35 # build recognizes.
36 # EXTRA_PATCHES{version} can be defined in the component Makefile to include
37 # additional patches.
40 PATCH_PATTERN ?= *.patch
42 PATCH_DIR ?= patches
43 # patches specific to parfait builds.
44 ifeq ($(strip $(PARFAIT_BUILD)),yes)
45 PARFAIT_PATCH_DIR = parfait
46 endif
48 PATCHES = $(shell find $(PATCH_DIR) $(PARFAIT_PATCH_DIR) -type f \
49 -name '$(PATCH_PATTERN)' 2>/dev/null | \
50 LC_COLLATE=C sort)
52 $(SOURCE_DIR)/.patched: unpack
53 @for p in $(PATCHES); do \
54 b=$$(basename $$p);\
55 if ! [ -f $@-$$b ]; then \
56 echo "$(GPATCH) -d $(@D) $(GPATCH_FLAGS) < $$p";\
57 $(GPATCH) -d $(@D) $(GPATCH_FLAGS) < $$p || exit 1;\
58 touch $@-$$b;\
59 fi;\
60 done; touch $@
62 patch:: $(SOURCE_DIR)/.patched
64 REQUIRED_PACKAGES += text/gnu-patch