make-rules/prep.mk
changeset 774 d0cbca26a17c
parent 461 edabdd6aff23
child 789 5f074ca23733
--- a/make-rules/prep.mk	Tue Apr 17 10:38:01 2012 -0700
+++ b/make-rules/prep.mk	Tue Apr 17 10:40:54 2012 -0700
@@ -18,7 +18,7 @@
 #
 # CDDL HEADER END
 #
-# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
 #
 
 UNPACK =	$(WS_TOOLS)/userland-unpack
@@ -35,15 +35,29 @@
 # append filenames to PATCHES, you'll have to set $(EXTRA_PATCHES) prior to
 # inclusion.
 PATCH_DIR ?=	patches
+
+# we may need patches only for use with parfait
+ifeq   ($(strip $(PARFAIT_BUILD)),yes)
+PARFAIT_PATCH_DIR =	parfait
+endif
 PATCH_PATTERN ?=	*.patch
-PATCHES =	$(shell find $(PATCH_DIR) -type f -name '$(PATCH_PATTERN)' \
+PATCHES =	$(shell find $(PATCH_DIR) $(PARFAIT_PATCH_DIR) -type f -name '$(PATCH_PATTERN)' \
 				2>/dev/null | sort) $(EXTRA_PATCHES)
 STAMPS =	$(PATCHES:$(PATCH_DIR)/%=$(SOURCE_DIR)/.%ed)
+ifeq   ($(strip $(PARFAIT_BUILD)),yes)
+STAMPS +=	$(PATCHES:$(PARFAIT_PATCH_DIR)/%=$(SOURCE_DIR)/.%ed)
+endif
 
 $(SOURCE_DIR)/.%ed:	$(PATCH_DIR)/%
 	$(GPATCH) -d $(@D) $(GPATCH_FLAGS) < $<
 	$(TOUCH) $@
 
+ifeq   ($(strip $(PARFAIT_BUILD)),yes)
+$(SOURCE_DIR)/.%ed:	$(PARFAIT_PATCH_DIR)/%
+	$(GPATCH) -d $(@D) $(GPATCH_FLAGS) < $<
+	$(TOUCH) $@
+endif
+
 # template for download rules. add new rules with $(call download-rule, suffix)
 define download-rule
 ARCHIVES += $$(COMPONENT_ARCHIVE$(1))