make-rules/prep.mk
author Norm Jacobs <Norm.Jacobs@Oracle.COM>
Wed, 13 Apr 2011 09:58:06 -0700
changeset 181 87e11e685b1f
parent 142 6f1cb90a0ef3
child 198 172fc01ce997
permissions -rw-r--r--
7003927 userland should postprocess packaged files 7034188 userland should have common lint library rules 7034992 userland packages should include opensolaris.arc_url data 7019309 move ghostscript to userland (fix build)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
     1
#
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
     2
# CDDL HEADER START
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
     3
#
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
     4
# The contents of this file are subject to the terms of the
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
     5
# Common Development and Distribution License (the "License").
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
     6
# You may not use this file except in compliance with the License.
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
     7
#
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
     8
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
     9
# or http://www.opensolaris.org/os/licensing.
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    10
# See the License for the specific language governing permissions
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    11
# and limitations under the License.
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    12
#
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    13
# When distributing Covered Code, include this CDDL HEADER in each
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    14
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    15
# If applicable, add the following below this CDDL HEADER, with the
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    16
# fields enclosed by brackets "[]" replaced with your own identifying
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    17
# information: Portions Copyright [yyyy] [name of copyright owner]
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    18
#
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    19
# CDDL HEADER END
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    20
#
59
7500d63edb42 7012375 userland build and proto areas should be outside of unpacked source dirs
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 42
diff changeset
    21
# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
2
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    22
#
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    23
34
d20b10eba317 prepare for zone based component builds
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 18
diff changeset
    24
UNPACK =	$(WS_TOOLS)/userland-unpack
d20b10eba317 prepare for zone based component builds
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 18
diff changeset
    25
FETCH =		$(WS_TOOLS)/userland-fetch
2
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    26
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    27
ARCHIVES += $(COMPONENT_ARCHIVE)
59
7500d63edb42 7012375 userland build and proto areas should be outside of unpacked source dirs
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 42
diff changeset
    28
CLEAN_PATHS += $(SOURCE_DIR)
2
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    29
115
c360825c3a3f 7022166 userland patches should move to subdirs
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents: 59
diff changeset
    30
PATCH_DIR =	patches
c360825c3a3f 7022166 userland patches should move to subdirs
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents: 59
diff changeset
    31
PATCH_PATTERN =	*.patch
c360825c3a3f 7022166 userland patches should move to subdirs
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents: 59
diff changeset
    32
PATCHES =	$(shell find $(PATCH_DIR) -type f -name '$(PATCH_PATTERN)' \
c360825c3a3f 7022166 userland patches should move to subdirs
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents: 59
diff changeset
    33
				2>/dev/null | sort)
c360825c3a3f 7022166 userland patches should move to subdirs
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents: 59
diff changeset
    34
STAMPS =	$(PATCHES:$(PATCH_DIR)/%=$(SOURCE_DIR)/.%ed)
2
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    35
115
c360825c3a3f 7022166 userland patches should move to subdirs
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents: 59
diff changeset
    36
$(SOURCE_DIR)/.%ed:	$(PATCH_DIR)/%
2
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    37
	$(GPATCH) -d $(@D) $(GPATCH_FLAGS) < $<
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    38
	$(TOUCH) [email protected]
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    39
142
6f1cb90a0ef3 7026996 move tomcat to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents: 115
diff changeset
    40
# template for download rules. add new rules with $(call download-rule, suffix)
6f1cb90a0ef3 7026996 move tomcat to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents: 115
diff changeset
    41
define download-rule
6f1cb90a0ef3 7026996 move tomcat to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents: 115
diff changeset
    42
ARCHIVES += $$(COMPONENT_ARCHIVE$(1))
6f1cb90a0ef3 7026996 move tomcat to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents: 115
diff changeset
    43
CLOBBER_PATHS += $$(COMPONENT_ARCHIVE$(1))
6f1cb90a0ef3 7026996 move tomcat to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents: 115
diff changeset
    44
$$(USERLAND_ARCHIVES)$$(COMPONENT_ARCHIVE$(1)):	Makefile
6f1cb90a0ef3 7026996 move tomcat to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents: 115
diff changeset
    45
	$$(FETCH) --file [email protected] \
6f1cb90a0ef3 7026996 move tomcat to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents: 115
diff changeset
    46
		$$(COMPONENT_ARCHIVE_URL$(1):%=--url %) \
6f1cb90a0ef3 7026996 move tomcat to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents: 115
diff changeset
    47
		$$(COMPONENT_ARCHIVE_HASH$(1):%=--hash %)
6f1cb90a0ef3 7026996 move tomcat to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents: 115
diff changeset
    48
	$$(TOUCH) [email protected]
6f1cb90a0ef3 7026996 move tomcat to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents: 115
diff changeset
    49
endef
2
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    50
142
6f1cb90a0ef3 7026996 move tomcat to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents: 115
diff changeset
    51
# Generate the download rules from the above template
6f1cb90a0ef3 7026996 move tomcat to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents: 115
diff changeset
    52
NUM_ARCHIVES =	1 2 3 4 5 6 7
6f1cb90a0ef3 7026996 move tomcat to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents: 115
diff changeset
    53
$(eval $(call download-rule,))
6f1cb90a0ef3 7026996 move tomcat to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents: 115
diff changeset
    54
$(foreach suffix,$(NUM_ARCHIVES),$(eval $(call download-rule,_$(suffix))))
6f1cb90a0ef3 7026996 move tomcat to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents: 115
diff changeset
    55
6f1cb90a0ef3 7026996 move tomcat to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents: 115
diff changeset
    56
$(SOURCE_DIR)/.unpacked:	download Makefile $(PATCHES)
59
7500d63edb42 7012375 userland build and proto areas should be outside of unpacked source dirs
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 42
diff changeset
    57
	$(RM) -r $(SOURCE_DIR)
42
566ce4d2ff99 fix using/downloading shared archives
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 38
diff changeset
    58
	$(UNPACK) $(UNPACK_ARGS) $(USERLAND_ARCHIVES)$(COMPONENT_ARCHIVE)
2
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    59
	$(TOUCH) [email protected]
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    60
59
7500d63edb42 7012375 userland build and proto areas should be outside of unpacked source dirs
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 42
diff changeset
    61
$(SOURCE_DIR)/.patched:	$(SOURCE_DIR)/.unpacked $(STAMPS)
2
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    62
	$(TOUCH) [email protected]
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    63
59
7500d63edb42 7012375 userland build and proto areas should be outside of unpacked source dirs
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 42
diff changeset
    64
$(SOURCE_DIR)/.prep:	$(SOURCE_DIR)/.patched
2
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    65
	$(COMPONENT_PREP_ACTION)
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    66
	$(TOUCH) [email protected]
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    67
59
7500d63edb42 7012375 userland build and proto areas should be outside of unpacked source dirs
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 42
diff changeset
    68
prep::	$(SOURCE_DIR)/.prep
2
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    69
142
6f1cb90a0ef3 7026996 move tomcat to userland
Petr Sumbera <petr.sumbera@oracle.com>
parents: 115
diff changeset
    70
download::	$(ARCHIVES:%=$(USERLAND_ARCHIVES)%)
9
97fb557d9979 lcms download link has changed
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 2
diff changeset
    71
2
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    72
clean::
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    73
	$(RM) -r $(CLEAN_PATHS)
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    74
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    75
clobber::	clean
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    76
	$(RM) -r $(CLOBBER_PATHS)