author  Norm Jacobs <Norm.Jacobs@Oracle.COM> 
Wed, 16 Feb 2011 15:23:32 0800  
changeset 92  b4be50cb7106 
parent 83  9ab0deb97868 
child 99  c15c9099bb44 
permissions  rwrr 
2  1 
# 
2 
# CDDL HEADER START 

3 
# 

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. 

7 
# 

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. 

12 
# 

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] 

18 
# 

19 
# CDDL HEADER END 

20 
# 

58
d8024c042a00
7011369 gmake complains about fresh userland bits
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
53
diff
changeset

21 
# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. 
2  22 
# 
23 

24 
include ../makerules/sharedmacros.mk 

25 

23
e7ed56b7c498
autogenerate components to build
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
21
diff
changeset

26 
# for now, the assumption is we build any directory with a Makefile. This may 
e7ed56b7c498
autogenerate components to build
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
21
diff
changeset

27 
# not always be the case. If we build a new makelike tool to drive the upper 
e7ed56b7c498
autogenerate components to build
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
21
diff
changeset

28 
# level build, it may make different decisions and will need to include 
e7ed56b7c498
autogenerate components to build
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
21
diff
changeset

29 
# appropriate dependency information. 
e7ed56b7c498
autogenerate components to build
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
21
diff
changeset

30 

32
280a7444e782
automatically generate intercomponent dependencies for build ordering
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
23
diff
changeset

31 
# components.mk is autogenerated by the build tools. It populates the 
280a7444e782
automatically generate intercomponent dependencies for build ordering
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
23
diff
changeset

32 
# COMPONENT_DIRS macro with a list of all directories in the workspace that 
280a7444e782
automatically generate intercomponent dependencies for build ordering
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
23
diff
changeset

33 
# contain a component. 
34
d20b10eba317
prepare for zone based component builds
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
32
diff
changeset

34 
components.mk: # Makefile # $(WS_TOP)/components 
32
280a7444e782
automatically generate intercomponent dependencies for build ordering
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
23
diff
changeset

35 
@echo "Generating component list..." 
34
d20b10eba317
prepare for zone based component builds
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
32
diff
changeset

36 
@$(BASS_O_MATIC) workspace=$(WS_TOP) components=paths \ 
32
280a7444e782
automatically generate intercomponent dependencies for build ordering
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
23
diff
changeset

37 
 sed e 's;^$(shell pwd)/;COMPONENT_DIRS += ;g' >$@ 
280a7444e782
automatically generate intercomponent dependencies for build ordering
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
23
diff
changeset

38 

58
d8024c042a00
7011369 gmake complains about fresh userland bits
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
53
diff
changeset

39 
include components.mk 
32
280a7444e782
automatically generate intercomponent dependencies for build ordering
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
23
diff
changeset

40 

2  41 

38
cd00ea74156e
package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
34
diff
changeset

42 
download: TARGET = download 
cd00ea74156e
package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
34
diff
changeset

43 
prep: TARGET = prep 
cd00ea74156e
package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
34
diff
changeset

44 
build: TARGET = build 
cd00ea74156e
package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
34
diff
changeset

45 
install: TARGET = install 
cd00ea74156e
package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
34
diff
changeset

46 
publish: TARGET = publish 
cd00ea74156e
package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
34
diff
changeset

47 
installpackages: TARGET = installpackages 
cd00ea74156e
package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
34
diff
changeset

48 
validate: TARGET = validate 
cd00ea74156e
package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
34
diff
changeset

49 
clean: TARGET = clean 
cd00ea74156e
package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
34
diff
changeset

50 
clobber: TARGET = clobber 
83
9ab0deb97868
7017671 move patch to userland
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
70
diff
changeset

51 
test: TARGET = test 
9ab0deb97868
7017671 move patch to userland
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
70
diff
changeset

52 
prep build install publish test: TEMPLATE_ZONE=$(ZONE) 
9ab0deb97868
7017671 move patch to userland
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
70
diff
changeset

53 
prep build install publish test: LOG = >$(WS_LOGS)/$@.$(TARGET).log 2>&1 
2  54 

92
b4be50cb7106
7020081 userland parallel builds break in pkglint
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
83
diff
changeset

55 
# turn off pkglint for the individual component builds. 
b4be50cb7106
7020081 userland parallel builds break in pkglint
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
83
diff
changeset

56 
publish: MAKEFLAGS += PKGLINT=/bin/true 
b4be50cb7106
7020081 userland parallel builds break in pkglint
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
83
diff
changeset

57 

2  58 
.DEFAULT: publish 
59 

83
9ab0deb97868
7017671 move patch to userland
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
70
diff
changeset

60 
download prep build install publish installpackages validate \ 
9ab0deb97868
7017671 move patch to userland
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
70
diff
changeset

61 
test: $(COMPONENT_DIRS) 
2  62 

34
d20b10eba317
prepare for zone based component builds
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
32
diff
changeset

63 
COMPONENT_DIRS.nosetup = $(COMPONENT_DIRS:%=%.nosetup) 
2  64 

34
d20b10eba317
prepare for zone based component builds
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
32
diff
changeset

65 
clean: $(COMPONENT_DIRS:%=%.nosetup) 
d20b10eba317
prepare for zone based component builds
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
32
diff
changeset

66 
$(RM) components.mk depends.mk .profile 
2  67 

34
d20b10eba317
prepare for zone based component builds
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
32
diff
changeset

68 
clobber: $(COMPONENT_DIRS:%=%.nosetup) clean 
53
e398cb2c4b45
7004049 SUNWa2ps should move to userland with a2ps
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
38
diff
changeset

69 
$(RM) r $(WS_REPO) $(WS_LOGS) $(WS_LINT_CACHE) 
34
d20b10eba317
prepare for zone based component builds
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
32
diff
changeset

70 

70
c610cf9d3d5d
7016863 userland build fails in parallel
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
58
diff
changeset

71 
setup: $(WS_LOGS) $(WS_REPO) tools $(WS_LINT_CACHE) 
2  72 

73 
$(WS_LOGS): 

74 
$(MKDIR) $@ 

75 

70
c610cf9d3d5d
7016863 userland build fails in parallel
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
58
diff
changeset

76 
$(WS_REPO): 
2  77 
$(PKGSEND) s $(PKG_REPO) createrepository \ 
78 
setproperty publisher.prefix=$(PUBLISHER) 

79 

70
c610cf9d3d5d
7016863 userland build fails in parallel
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
58
diff
changeset

80 
$(WS_LINT_CACHE): $(WS_LOGS) 
c610cf9d3d5d
7016863 userland build fails in parallel
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
58
diff
changeset

81 
ifdef CANONICAL_REPO 
c610cf9d3d5d
7016863 userland build fails in parallel
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
58
diff
changeset

82 
@echo "Generating pkglint(1) cache from $(CANONICAL_REPO)..." 
c610cf9d3d5d
7016863 userland build fails in parallel
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
58
diff
changeset

83 
@(echo "set name=fmri value=pkg:/dummy"  $(PKGLINT) \ 
c610cf9d3d5d
7016863 userland build fails in parallel
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
58
diff
changeset

84 
c $(WS_LINT_CACHE) r $(CANONICAL_REPO) /dev/fd/0 \ 
c610cf9d3d5d
7016863 userland build fails in parallel
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
58
diff
changeset

85 
>$(WS_LOGS)/naughtycanonicalrepoactions 2>&1 ; exit 0) 
c610cf9d3d5d
7016863 userland build fails in parallel
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
58
diff
changeset

86 
else 
c610cf9d3d5d
7016863 userland build fails in parallel
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
58
diff
changeset

87 
$(MKDIR) $(WS_LINT_CACHE) 
c610cf9d3d5d
7016863 userland build fails in parallel
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
58
diff
changeset

88 
endif 
c610cf9d3d5d
7016863 userland build fails in parallel
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
58
diff
changeset

89 

6
20f80c019d73
add compiler date/time chatter reduction tools
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
2
diff
changeset

90 
tools: 
20f80c019d73
add compiler date/time chatter reduction tools
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
2
diff
changeset

91 
@cd ../tools ; echo "building tools..." ; $(GMAKE) setup 
20f80c019d73
add compiler date/time chatter reduction tools
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
2
diff
changeset

92 

34
d20b10eba317
prepare for zone based component builds
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
32
diff
changeset

93 
# $(WS_COMPONENTS) is the home directory for the zone user, so create a profile 
d20b10eba317
prepare for zone based component builds
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
32
diff
changeset

94 
# to pass a few things on to zone based builds 
d20b10eba317
prepare for zone based component builds
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
32
diff
changeset

95 
.profile: 
d20b10eba317
prepare for zone based component builds
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
32
diff
changeset

96 
echo "PATH=$(PATH)" >>$@ 
d20b10eba317
prepare for zone based component builds
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
32
diff
changeset

97 
echo "WS_TOP=$(WS_TOP)" >>$@ 
d20b10eba317
prepare for zone based component builds
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
32
diff
changeset

98 
echo "export PATH WS_TOP" >>$@ 
d20b10eba317
prepare for zone based component builds
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
32
diff
changeset

99 

32
280a7444e782
automatically generate intercomponent dependencies for build ordering
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
23
diff
changeset

100 
$(COMPONENT_DIRS): setup FORCE 
38
cd00ea74156e
package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
34
diff
changeset

101 
@cd $@ && echo "$(TARGET) $@" && \ 
34
d20b10eba317
prepare for zone based component builds
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
32
diff
changeset

102 
$(BASS_O_MATIC) $(TEMPLATE_ZONE:%=templatezone %) \ 
38
cd00ea74156e
package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
34
diff
changeset

103 
$(@:%=component %) make $(TARGET) $(LOG) 
34
d20b10eba317
prepare for zone based component builds
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
32
diff
changeset

104 

92
b4be50cb7106
7020081 userland parallel builds break in pkglint
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
83
diff
changeset

105 
publish: 
b4be50cb7106
7020081 userland parallel builds break in pkglint
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
83
diff
changeset

106 
# pkglint all of the published manifests in one batch. 
b4be50cb7106
7020081 userland parallel builds break in pkglint
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
83
diff
changeset

107 
ifdef CANONICAL_REPO 
b4be50cb7106
7020081 userland parallel builds break in pkglint
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
83
diff
changeset

108 
@echo 'pkglinting all package manifests...' 
b4be50cb7106
7020081 userland parallel builds break in pkglint
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
83
diff
changeset

109 
@$(ENV) PYTHONPATH=$(WS_TOOLS)/python $(PKGLINT) \ 
b4be50cb7106
7020081 userland parallel builds break in pkglint
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
83
diff
changeset

110 
c $(WS_LINT_CACHE) f $(WS_TOOLS)/pkglintrc \ 
b4be50cb7106
7020081 userland parallel builds break in pkglint
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
83
diff
changeset

111 
$(shell find . name 'manifest*.published') 
b4be50cb7106
7020081 userland parallel builds break in pkglint
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
83
diff
changeset

112 
endif 
b4be50cb7106
7020081 userland parallel builds break in pkglint
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
83
diff
changeset

113 

34
d20b10eba317
prepare for zone based component builds
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
32
diff
changeset

114 
$(COMPONENT_DIRS.nosetup): FORCE 
38
cd00ea74156e
package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
34
diff
changeset

115 
@cd $(@:%.nosetup=%) && echo "$(TARGET) $(@:%.nosetup=%)" && \ 
34
d20b10eba317
prepare for zone based component builds
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
32
diff
changeset

116 
$(BASS_O_MATIC) $(TEMPLATE_ZONE:%=templatezone %) \ 
38
cd00ea74156e
package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
34
diff
changeset

117 
$(@:%.nosetup=component %) make $(TARGET) $(LOG) 
32
280a7444e782
automatically generate intercomponent dependencies for build ordering
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
23
diff
changeset

118 

280a7444e782
automatically generate intercomponent dependencies for build ordering
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
23
diff
changeset

119 
# depends.mk is autogenerated by the build tools, bassomatic.py in particular 
280a7444e782
automatically generate intercomponent dependencies for build ordering
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
23
diff
changeset

120 
depends.mk: components.mk 
280a7444e782
automatically generate intercomponent dependencies for build ordering
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
23
diff
changeset

121 
@echo "Generating component dependencies..." 
34
d20b10eba317
prepare for zone based component builds
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
32
diff
changeset

122 
@$(BASS_O_MATIC) workspace=$(WS_TOP) components=depend \ 
32
280a7444e782
automatically generate intercomponent dependencies for build ordering
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
23
diff
changeset

123 
 sed e 's;$(shell pwd)/;;g' >$@ 
280a7444e782
automatically generate intercomponent dependencies for build ordering
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
23
diff
changeset

124 

58
d8024c042a00
7011369 gmake complains about fresh userland bits
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
53
diff
changeset

125 
include depends.mk 
2  126 

127 
FORCE: 