ismcommonrules
5.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
#
# Commonrules to build idb's and images for an ism
#
#
# For an ism that doesn't have a rawidb idb
# set LIDBJOINFLAGS to -m
# In this case a zero length RAWIDB is required
#
#
# Targets:
# buildimages - make real images (an individual image an also be made)
# buildism - makes finalidb
# version - create a version file
# startversion - create a version number in $(WORKAREA)/.version_number
# (and alpha number in $(WORKAREA)/.alpha_number
#
# Before including this file the following should be set:
# ALLIMAGES - names of images to be made - must correspond to
# product name(s) in spec file
# SPEC - spec file name
# RAWIDB - rawidb file name
# SRCIDB - src/checked in idb file name
#
# Macros you may wish to set
# BUILDER - (to 1 if project build, to 2 if build group build)
# TREE_ID - to an integer 1-9 to distinguish parallel OS efforts
# targeted to new hardware.
# It will default to the value of TREE_ID found in
# $(ROOT)/usr/include/make/releasedefs.
# PATCH_RELEASE - if creating a patch release (will default to first eight
# digits of $(WORKAREA)/.version_number)
# PATCH_NUM - patch number (sequences patch releases)
#
# Note that macros ALLIMAGES, SPEC, RAWIDB, and SRCIDB need only be set
# in the build/Makefile. Typically, one just uses the settings as
# provided via the ism template for the build/Makefile.
#
#
#ident "$Revision: 1.1 $"
.NOTPARALLEL:
include $(RELEASEDEFS)
include $(COMMONRULES)
ISMAREA=../idbs
IMAGESAREA=../images
SPECDFLT=$(TOOLROOT)/usr/sbin/specdflt
SPECPRODS=$(TOOLROOT)/usr/sbin/specprods
SPECEXTERN=awk -f $(TOOLROOT)/usr/lib/specextern.awk
# get the definition of the startversion target
include $(ROOT)/usr/include/make/startversion
$(BUILDIMGPREF)buildimages: checkversion finalidb $(SPEC)
@if [ ! -d $(IMAGESAREA) ]; then mkdir $(IMAGESAREA); fi; \
(cd $(IMAGESAREA); for i in $(ALLIMAGES); do \
rm -f $${i}.* $${i}; done)
# next 14 lines replicated below
@if [ -r $(SPEC) ]; then \
USESPEC=$(SPEC); \
if [ "$(ALLIMAGES)" = "no_images_supplied" ]; then \
echo "\nderiving names of products to generate from file $(SPEC)\n"; \
USEALLIMAGES=`$(SPECPRODS) $$USESPEC`; \
else \
USEALLIMAGES='$(ALLIMAGES)'; \
fi; \
else \
echo "\nderiving file $(SPEC).dflt from file finalidb\n"; \
$(SPECDFLT) > $(SPEC).dflt;\
USESPEC=$(SPEC).dflt; \
USEALLIMAGES=`$(SPECPRODS) $$USESPEC`; \
fi; \
echo "$(GENDIST) $(GENDISTFLAGS) -all -root /"; \
echo "\t-source $(SRC) -idb finalidb"; \
echo "\t-spec $$USESPEC -dist $(IMAGESAREA) $$USEALLIMAGES"; \
VERSION=`cat $(VNUM)` \
$(GENDIST) $(GENDISTFLAGS) -all -root / -source $(SRC) -idb finalidb \
-spec $$USESPEC -dist $(IMAGESAREA) $$USEALLIMAGES
#
# Perform a dryrun using gendist to help uncover errors
# Don't turn on -verbose (-> ignore GGENDISTFLAGS)
# XXX for now ignore error return
#
$(BUILDISMPREF)buildism:finalidb $(SPEC)
@if [ ! -d $(ISMAREA) ]; then mkdir $(ISMAREA); fi; \
(cd $(ISMAREA); for i in $(ALLIMAGES); do \
rm -f $${i}.* $${i}; done)
# next 14 lines replicated above
@if [ -r $(SPEC) ]; then \
USESPEC=$(SPEC); \
if [ "$(ALLIMAGES)" = "no_images_supplied" ]; then \
echo "\nderiving names of products to generate from file $(SPEC)\n"; \
USEALLIMAGES=`$(SPECPRODS) $$USESPEC`; \
else \
USEALLIMAGES='$(ALLIMAGES)'; \
fi; \
else \
echo "\nderiving file $(SPEC).dflt from file $(RAWIDB)\n"; \
$(SPECDFLT) > $(SPEC).dflt;\
USESPEC=$(SPEC).dflt; \
USEALLIMAGES=`$(SPECPRODS) $$USESPEC`; \
fi;\
$(GENDIST) $(GENDISTFLAGS) -externidb -root / -source $(SRC) \
-idb finalidb -spec $$USESPEC -dist $(ISMAREA) $$USEALLIMAGES \
>dryrun 2>&1;\
ISMROOT=`pwd`;\
ISMROOT=`echo "$$ISMROOT/.." | sed -e 's/\/[^/]*\/\.\.//'`; \
$(SPECEXTERN) < $$USESPEC > $(ISMAREA)/spec;\
cd $(ISMAREA); for i in $$USEALLIMAGES; do \
[ ! -r $$i.idb ] && continue; \
nawk '{$$6=head"/"$$6;print}' head=$$ISMROOT < $$i.idb > $$i.$$$$;\
mv $$i.$$$$ $$i.idb; done
# -$(GENDIST) $(VGENDISTFLAGS) $(LGENDISTFLAGS) -dryrun -all -root / \
# -source $(SRC) \
# -idb finalidb -spec $$USESPEC -dist $(ISMAREA) $$USEALLIMAGES >dryrun 2>&1
$(ALLIMAGES):
$(MAKE) ALLIMAGES=$@ buildimages
$(FINALPREF)finalidb: $(SRCIDB)
-rm -f joinedidb extra missing
@#gendist still likes things sorted on dstpath
@# use -o so makefile is restartable
@if [ -r $(SRCIDB) ]; then \
SIDBS=`echo $(SRCIDB) | tr ' ' ' ' | tr -s '' ' ' | \
sed -e 's/^/-s/' -e 's/ / -s/g'` ;\
$(IDBJOIN) $(IDBJOINFLAGS) $$SIDBS $(RAWIDB) joinedidb extra missing; \
sort +4 -5 joinedidb -o finalidb; \
else \
echo "\nderiving file finalidb from file $(RAWIDB)\n"; \
sort +4 -5 $(RAWIDB) -o finalidb; \
fi
checkversion:$(_FORCE)
@if [ ! -r $(VNUM) ]; then \
echo "Use the startversion target to set your version number.";\
exit 1 ;\
else \
VERSION=`cat $(VNUM)` ;\
fi
mkISMcensus :
@if [ ! -d build ]; then \
echo "Must be invoked from the top of the ISM"; \
exit 1; \
fi; \
p_test -C ISMcensus; \
echo 'g/ISMcensus%/d\nwq' | ex ISMcensus > /dev/null; \
echo "<<ISMcensus divider>>" >> ISMcensus; \
versions -r $(ROOT) -Id >> ISMcensus; \
ls ;\
if [ "`p_list -im | grep -v ISMcensus | wc -l`" != " 2" ];then \
rm ISMcensus; \
echo "\nMust p_finalize all changes"; \
p_list -im; \
exit 1; \
elif [ "$(MKISMCENSUSFLAGS)" != "" ]; then \
$(MAKE) clobber; \
if [ "`p_check -w | wc -l`" != " 0" ]; then \
rm ISMcensus; \
echo "\n p_finalize or add these files to LDIRT"; \
p_check -w; \
exit 1; \
fi; \
fi
useISMcensus :
@p_tupdate $(USEISMCENSUSFLAGS) ISMcensus; \
echo '/^<<ISMcensus divider>>/,$$d\nw .ISMcensus\nq' | ex ISMcensus > /dev/null; \
p_tupdate -g .ISMcensus; \
rm .ISMcensus
# old target provided so that build doesn't break
checkalpha:$(_FORCE)
@echo "This target is no longer used."
@echo "Please modify your Makefile to remove it."
version:checkversion $(_FORCE)
@VERSION=`cat $(VNUM)` \
$(TOOLROOT)/usr/sbin/makeversion $(ISM_NAME).version
# ok if these not present, but do need their modification dates if they are
fake_target_so_not_empty $(SRCIDB) $(SPEC):
: