1 # $NetBSD: Makefile,v 1.48 2009/03/29 04:56:16 tsutsui Exp $
3 # Consult "*.conf" for the configuration variables; this Makefile is typically
4 # not edited for basic configuration changes.
5 ##############################################################################
17 @echo
"Please set RELEASE in the environment or in site.conf to the basename"
18 @echo
"of the release configuration file to use. For example:"
19 @echo
"> ${MAKE} RELEASE=foo"
20 @echo
"will use the configuration file foo.conf."
24 .if exists
(${RELEASE}.conf
)
25 .
include "${RELEASE}.conf"
28 @echo
"Error: File does not exist: ${RELEASE}.conf"
34 RELEASENAME?
= NetBSD-
${CD_RELEASE}
35 MKISOFS_ARGS
= -A
"NetBSD ${CD_RELEASE}" \
36 -hide-rr-moved
-m Split
-m cdrom
37 # -hide-list ${.CURDIR}/hide-iso.lst
40 .for image in
${CD_IMAGES}
42 ALL_PORTS
:= ${ALL_PORTS} ${BASE_PORTS.
${image}}
45 .if exists
(${RELEASENAME}.mk
)
46 .
include "${RELEASENAME}.mk"
48 .if
!empty
(CD_RELEASE
)
50 @echo
"Error: File does not exist: ${RELEASENAME}.mk"
51 @echo
"(specified by variable CD_RELEASE in ${RELEASE}.conf)"
55 @echo
"Error: CD_RELEASE not set in ${RELEASE}.conf"
62 .if
!empty
(ALL_PORTS
:Mmacppc
)
63 SUBDIR
+= macppc_installboot
67 .
include <bsd.subdir.mk
>
73 ##### Default paths for programs #####
75 MKISOFS?
= /usr
/local
/bin
/mkisofs
76 RSYNC?
= /usr
/pkg
/bin
/rsync
77 ALPHA_IBOOT?
= ${TOOL_INSTALLBOOT} -m alpha
-o sunsum
,append
78 PMAX_IBOOT?
= ${TOOL_INSTALLBOOT} -m pmax
-o sunsum
,append
79 VAX_IBOOT?
= ${TOOL_INSTALLBOOT} -m vax
-o sunsum
,append
80 .if
!empty
(ALL_PORTS
:Mmacppc
)
81 MACPPC_IBOOTDIR
!= cd
${.CURDIR
}/macppc_installboot
&& ${PRINTOBJDIR}
83 .if
!empty
(ALL_PORTS
:Msgimips
)
84 SGIMIPS_SGIVOL?
= ${TOOLDIR}/bin
/nbsgivol
88 .if
!exists
(${MKISOFS})
89 @echo
"Error: File does not exist: ${MKISOFS}"
90 @echo
"Please build and install mkisofs(8) utility and set MKISOFS in the environment"
91 @echo
"or in site.conf to create image."
97 @echo
"Error: File does not exist: ${RSYNC}"
98 @echo
"Please build and install rsync(1) utility and set RSYNC in the environment"
99 @echo
"or in site.conf to fetch release binaries."
103 ##### rsync settings #####
105 # rsync host; check mirrors on http://www.NetBSD.org/mirrors/#rsync
106 # (note not all rsync mirrors provide NetBSD-daily)
107 RSYNC_HOST?
= rsync.NetBSD.org
109 # extra path for rsync mirrors ("/pub", "/netbsd" etc.)
113 .if
${RELEASE} == "current"
114 # daily date dir name
116 #DAILY_DIR?= yyyymmddhhmmZ
117 RSYNC_PATH?
= ${RSYNC_PATH_PREFIX}/NetBSD-daily
/${BRANCH}/${DAILY_DIR}
119 # extra suffix on pre-release ("_BETA2", "_RC5" etc.)
121 RSYNC_PATH?
= ${RSYNC_PATH_PREFIX}/NetBSD
/${RELEASENAME}${RELEASE_SUFFIX}
123 # alternative for NetBSD-daily sets of stable branches
124 #DAILY_DIR?= yyyymmddhhmmZ
126 #RSYNC_PATH?= ${RSYNC_PATH_PREFIX}/NetBSD-daily/${BRANCH}/${DAILY_DIR}
130 RSYNC_SITE?
= rsync
://${RSYNC_HOST}${RSYNC_PATH}
131 RSYNC_ARGS?
= -va
--delete
132 RSYNC_EXCLUDE
+= --exclude
=/* --exclude
=Split
--exclude
=cdrom
134 DOWNLOADDIR?
= ${.OBJDIR
}/download
135 DISTRIBDIR?
= ${DOWNLOADDIR}
136 STAGEDIR?
= ${.OBJDIR
}/staging
137 IMAGEDIR?
= ${.OBJDIR
}
138 EXTFILEDIR?
= ${.OBJDIR
}/extfiles
139 EASTER_EGG?
= /dev
/null
141 ##### MACHINE_ARCH for possible shared sets for each (shared) port #####
143 MACHINE_ARCH.acorn26
= arm
144 MACHINE_ARCH.acorn32
= arm
145 MACHINE_ARCH.algor
= mipsel
146 MACHINE_ARCH.amiga
= m68k
147 MACHINE_ARCH.amigappc
= powerpc
148 MACHINE_ARCH.arc
= mipsel
149 MACHINE_ARCH.atari
= m68k
150 MACHINE_ARCH.bebox
= powerpc
151 MACHINE_ARCH.cats
= arm
152 MACHINE_ARCH.cesfic
= m68k
153 MACHINE_ARCH.cobalt
= mipsel
154 MACHINE_ARCH.dreamcast
= sh3el
155 MACHINE_ARCH.evbarm
= arm
156 MACHINE_ARCH.evbmips
= mipsel
157 MACHINE_ARCH.evbppc
= powerpc
158 MACHINE_ARCH.evbsh3
= sh3eb
159 MACHINE_ARCH.hp300
= m68k
160 MACHINE_ARCH.hpcarm
= arm
161 MACHINE_ARCH.hpcmips
= mipsel
162 MACHINE_ARCH.hpcsh
= sh3el
163 MACHINE_ARCH.iyonix
= arm
164 MACHINE_ARCH.luna68k
= m68k
165 MACHINE_ARCH.mac68k
= m68k
166 MACHINE_ARCH.macppc
= powerpc
167 MACHINE_ARCH.mipsco
= mipseb
168 MACHINE_ARCH.mmeye
= sh3eb
169 MACHINE_ARCH.mvme68k
= m68k
170 MACHINE_ARCH.netwinder
= arm
171 MACHINE_ARCH.news68k
= m68k
172 MACHINE_ARCH.newsmips
= mipseb
173 MACHINE_ARCH.next68k
= m68k
174 MACHINE_ARCH.ofppc
= powerpc
175 MACHINE_ARCH.pmax
= mipsel
176 MACHINE_ARCH.prep
= powerpc
177 MACHINE_ARCH.sandpoint
= powerpc
178 MACHINE_ARCH.sbmips
= mipseb
179 MACHINE_ARCH.sgimips
= mipseb
180 MACHINE_ARCH.shark
= arm
181 MACHINE_ARCH.sun3
= m68k
182 MACHINE_ARCH.x68k
= m68k
184 ##### Fetched directories from FTP server #####
186 .if defined
(ALL_PORTS
) && !empty
(ALL_PORTS
)
187 RSYNC_INCLUDE
+= --include "/shared"
188 RSYNC_EXCLUDE
+= --exclude
"/[a-z]*" \
189 --exclude
"/shared/[a-z]*"
193 .for port in
${ALL_PORTS
:O
:u
} # {
194 RSYNC_INCLUDE
+= --include "/${port}"
195 .if defined
(MACHINE_ARCH.
${port})
196 RSYNC_ARCHS
+= ${MACHINE_ARCH.
${port}}
199 .for arch in
${RSYNC_ARCHS
:O
:u
}
200 RSYNC_INCLUDE
+= --include "/shared/${arch}"
203 ##### Boot info and additional options for various platforms #####
205 .if defined
(PUBLISHER
)
206 MKISOFS_ARGS
+= -publisher
"${PUBLISHER}"
209 .if defined
(PREPARER
)
210 MKISOFS_ARGS
+= -p
"${PREPARER}"
214 ##### Per image settings #####
216 .for image in
${CD_IMAGES} # {
217 ports
:=${BASE_PORTS.
${image}}
219 .if
!defined
(VOLID.
${image}) && !target
(.BEGIN
)
221 @echo
"Error: VOLID.${image} not set in ${RELEASE}.conf"
225 MKISOFS_ARGS.
${image}= -V
"${VOLID.${image}}"
227 pathlist.
${image}:=${STAGEDIR}/${image}.pathlist
228 contents.
${image}:=${IMAGEDIR}/${image}.contents
230 MKISOFS_ARGS.
${image}+= -graft-points
-path-list
${pathlist.
${image}}
232 .if defined
(ABSTRACT.
${image})
233 MKISOFS_ARGS.
${image}+= -abstract
${ABSTRACT.
${image}}
236 # Options specified in release config file
243 bports
= # empty first
244 # For a source only cd just ignore the shared/ALL directory
245 .if
${ports} != "source" && exists
(${DISTRIBDIR}/shared
/ALL
)
248 .for port in
${ports} # {
249 EXTFILES
+= ${EXTFILES.
${port}}
250 INTFILES.
${image}+= ${INTFILES.
${port}}
251 INTDIRS.
${image}+= ${INTDIRS.
${port}}
252 ADDFILES.
${image}+= ${ADDFILES.
${port}}
253 MKISOFS_ARGS.
${image}+= ${MKISOFS_ARGS.
${port}}
254 # add shared/ALL and shared/${MACHINE_ARCH} to BASE_PORTS.${image}
256 .if defined
(MACHINE_ARCH.
${port}) && \
257 exists
(${DISTRIBDIR}/shared
/${MACHINE_ARCH.
${port}})
258 bports
+= shared
/${MACHINE_ARCH.
${port}}
261 BASE_PORTS.
${image}:= ${bports
:O
:u
}
266 .if
!empty
(ports
:Mi386
)
267 .if empty
(INTFILES.i386
:Mbootxx_cd9660
)
269 MKISOFS_ARGS.
${image}+= -b
${BOOTFILE.i386
} -c boot.catalog
-no-emul-boot
271 #2.88MB emulation boot
272 MKISOFS_ARGS.
${image}+= -b
${BOOTFILE.i386
} -c boot.catalog
278 .if
!empty
(ports
:Mamd64
)
279 .if empty
(INTFILES.amd64
:Mbootxx_cd9660
)
281 MKISOFS_ARGS.
${image}+= -b
${BOOTFILE.amd64
} -c boot.catalog
-no-emul-boot
283 #2.88MB emulation boot
284 MKISOFS_ARGS.
${image}+= -b
${BOOTFILE.amd64
} -c boot.catalog
288 # Mac (mac68k, macppc)
290 .if
!empty
(ports
:Mmacppc
)
292 MKISOFS_ARGS.
${image}+= -hfs
-part
-hide-hfs-list
${.CURDIR
}/hide-hfs.lst \
293 --macbin
-map
${.CURDIR
}/hfsmap.lst \
294 -boot-hfs-file
${.OBJDIR
}/${BOOTHFS}
295 UUDECODE_FILES
= ${BOOTHFS}
296 .
include <bsd.files.mk
>
297 .elif defined
(USE_APPLE_ISO
) ||
!empty
(ports
:Mmac68k
)
298 MKISOFS_ARGS.
${image}+= -apple
--macbin
-map
${.CURDIR
}/hfsmap.lst
301 # Sun (sparc, sparc64, sun3)
303 SUN_BOOT_ARGS.
${image}:=
304 .if
!empty
(ports
:Msparc
*) ||
!empty
(ports
:Msun3
*) # {
309 .if
!empty
(ports
:Msparc
)
310 SUN_BOOT
.123:= ${BOOTFILE.sparc
}
313 .if
!empty
(ports
:Msun3
) # {
314 .if
!defined
(BOOTFILE.sun3x
)
315 # NetBSD >= 1.4; sun3 and sun3x are the same
316 SUN_BOOT
.5:= ${BOOTFILE.sun3
}
318 SUN_BOOT
.4:= ${BOOTFILE.sun3
}
321 .if
!empty
(ports
:Msun3x
) && defined
(BOOTFILE.sun3x
)
322 # NetBSD < 1.4; sun3 and sun3x are separate
323 SUN_BOOT
.5:= ${BOOTFILE.sun3x
}
326 .if
!empty
(ports
:Msparc64
) # {
327 .if
(${SUN_BOOT
.5} != "-")
329 SUN_BOOT
.5:= ${SUN_BOOT
.5} ${BOOTFILE.sparc64
}
331 SUN_BOOT
.5:= ${BOOTFILE.sparc64
}
335 SUN_BOOT_ARGS.
${image}:= ${SUN_BOOT
.123} ${SUN_BOOT
.123} ${SUN_BOOT
.123} ${SUN_BOOT
.4} ${SUN_BOOT
.5}
337 .if empty
(SUN_BOOT_ARGS.
${image}:N
/dev
/null
)
338 SUN_BOOT_ARGS.
${image}:=
342 .endfor
# image in ${CD_IMAGES} # }
344 ##### Additional options for host OS's #####
346 # (USE_APPLE_ISO is tested above)
348 .if defined
(USE_ROCK_RIDGE
)
352 .if defined
(USE_LONG_NAMES
)
356 .if defined
(USE_TRANS_TBL
)
360 .if defined
(USE_JOLIET
)
361 MKISOFS_ARGS
+= -J
-hide-joliet-list
${.CURDIR
}/hide-jol.lst
362 .if defined
(USE_TRANS_TBL
)
363 MKISOFS_ARGS
+= -hide-joliet-trans-tbl
367 ##### File extract rule #####
370 @if
[ ! -r
$@
]; then case
$> in \
372 echo
"cp ${>:S/,link$//} $@"; \
373 cp
${>:S
/,link
$//} $@
;; \
375 echo
"cp `pwd -P`/${>:S/,link$//} $@"; \
376 cp
`pwd -P`/${>:S
/,link
$//} $@
;; \
378 echo
"Extracting: $> --> $@..."; \
379 ${TOOL_PAX} -rnz
-f
${>:C
/,.
*$//} ${>:C
/^.
*,//} ; \
380 cp
${>:C
/^.
*,//} $@
; rm -rf
${>:C
/^.
*,//} ;; \
381 *.gz
) echo
"gunzip -c <$> >$@"; gunzip
-c
<$> >$@
;; \
382 *) echo
"Unknown archive method for $@"; false
;; \
385 ##### Makefile rules #####
387 .for image in
${CD_IMAGES} # {
388 cdimages
: ${IMAGEDIR}/${image}.iso
391 mkdir
-p
${STAGEDIR}/${image} ${EXTFILEDIR}
392 rm -f
${pathlist.
${image}} ${contents.
${image}}
393 .if defined
(BASE_PORTS.
${image}) && !empty
(BASE_PORTS.
${image})
394 .for
dir in
${INTDIRS.
${image}}
395 mkdir
-p
${STAGEDIR}/${image}/${dir}
397 .for arch in
${BASE_PORTS.
${image}}
398 @echo
"${arch}=${DISTRIBDIR}/${arch}" >> ${pathlist.
${image}}
399 @echo
"${arch}" >> ${contents.
${image}}
404 .for file in
${EXTFILES} # {
405 extfileprep
: ${EXTFILEDIR}/${file
:C
/:.
*$//}
406 ${EXTFILEDIR}/${file
:C
/:.
*$//}: ${DISTRIBDIR}/${file
:C
/^.
*://} USE-FILE
407 ${DISTRIBDIR}/${file
:C
/^.
*://}: .PHONY
411 .for file in
${INTFILES.
${image}} # {
412 fileprep-
${image}: ${STAGEDIR}/${image}/${file
:C
/:.
*$//}
413 ${STAGEDIR}/${image}/${file
:C
/:.
*$//}: ${DISTRIBDIR}/${file
:C
/^.
*://} USE-FILE
414 ${DISTRIBDIR}/${file
:C
/^.
*://}: .PHONY
416 .for file in
${ADDFILES.
${image}} # {
417 fileprep-
${image}: ${STAGEDIR}/${image}/${file
:C
/:.
*$//}
418 ${STAGEDIR}/${image}/${file
:C
/:.
*$//}: ${file
:C
/^.
*://} USE-FILE
419 ${file
:C
/^.
*://}: .PHONY
422 .if
!empty
(BASE_PORTS.
${image}:Mmacppc
)
423 fileprep-
${image}: ${BOOTHFS}
426 # Size the CD image. This is done via the following formula:
427 # 1. Size the image produced by mkisofs.
428 # 2. Add images added by distrib/common/sunbootcd.sh by rounding to a 320k
429 # boundary and adding each Sun image rounded to a 320k boundary.
430 # 3. Add bootfile sizes rounded up to 512 bytes for pmax and vax.
431 # 4. Round up to a 32k boundary, then add another 32k for TAO padding.
435 size-
${image}: stage-
${image} extfileprep fileprep-
${image} check_mkisofs
436 @size
=$$((`cd ${STAGEDIR}/${image} && \
437 ${MKISOFS} ${MKISOFS_ARGS} ${MKISOFS_ARGS.${image}} \
440 | ${TOOL_SED} '/=/!d;s/^[^=]*=//'` * 2048)) && \
441 if
[ "${SUN_BOOT_ARGS.${image}}" != "" ]; then \
442 size
=$$(($$(($$size + 327679)) / 327680 * 327680)) && \
443 bootfiles
=`for f in ${SUN_BOOT_ARGS.${image}:N-:O}; do echo $$f; done | uniq` && \
444 for f in
$$bootfiles; do \
445 bfsize
=$$(${TOOL_STAT} -f
'%z' $$f) && \
446 size
=$$(($$size + $$(($$(($$bfsize + 327679)) / 327680 * 327680)))); \
449 if
[ "${BASE_PORTS.${image}:Mpmax}" != "" ]; then \
450 size
=$$(($$size + $$(($$(($$(${TOOL_STAT} -f
'%z' ${BOOTFILE.pmax
}) + 511)) / 512 * 512)))); \
452 if
[ "${BASE_PORTS.${image}:Mvax}" != "" ]; then \
453 size
=$$(($$size + $$(($$(($$(${TOOL_STAT} -f
'%z' ${BOOTFILE.vax
}) + 511)) / 512 * 512)))); \
455 if
[ "${BASE_PORTS.${image}:Msgimips}" != "" -a \
456 "${EXTFILES.sgimips}" != "" ]; then \
457 size
=$$(($$size + ${SGIVOLHDR.size
} * 512)); \
459 size
=$$(($$(($$size + 16383)) / 16384 * 16384 + 32768)) && \
460 sizek
=$$(($$size / 1024)) && \
461 echo
"Projected size of ${image}.iso: $$size bytes ($${sizek}K)." && \
462 if
[ $$sizek -gt
${CD_SIZE} ]; then echo
"Image too large for ${CD_SIZE} KB CD!"; false
; fi
464 # Actually build the image with all the bootstrap goo....
466 .if
!empty
(BASE_PORTS.
${image}:Mmacppc
)
467 ${IMAGEDIR}/${image}.iso
: all-macppc_installboot
470 ${IMAGEDIR}/${image}.iso
: size-
${image} check_mkisofs
471 @
sort -o
${contents.
${image}} ${contents.
${image}}
472 .if defined
(LOG_MKISOFS
)
473 cd
${STAGEDIR}/${image} && ${MKISOFS} -o
$@
${MKISOFS_ARGS} ${MKISOFS_ARGS.
${image}} -v
-v .
>${IMAGEDIR}/${image}.iso.log
2>&1
475 cd
${STAGEDIR}/${image} && ${MKISOFS} -o
$@
${MKISOFS_ARGS} ${MKISOFS_ARGS.
${image}} .
477 .if
!empty
(SUN_BOOT_ARGS.
${image})
478 SUNLABEL
=${TOOL_SUNLABEL
:Q
} \
479 ${HOST_SH} ${NETBSDSRCDIR}/distrib
/common
/sunbootcd.sh \
480 ${.TARGET
} ${SUN_BOOT_ARGS.
${image}}
482 .if
!empty
(BASE_PORTS.
${image}:Mmacppc
)
483 ${MACPPC_IBOOTDIR}/macppc_installboot \
484 $@
${EXTFILEDIR}/macppc.bootxx
/ofwboot
486 .if
!empty
(BASE_PORTS.
${image}:Mpmax
)
487 ${PMAX_IBOOT} $@
${BOOTFILE.pmax
}
489 .if
!empty
(BASE_PORTS.
${image}:Mvax
)
490 ${VAX_IBOOT} $@
${BOOTFILE.vax
}
492 .if
!empty
(BASE_PORTS.
${image}:Malpha
)
493 ${ALPHA_IBOOT} $@
${BOOTFILE.alpha
}
495 .if
!empty
(BASE_PORTS.
${image}:Msgimips
) && defined
(EXTFILES.sgimips
)
496 @echo
"Prepending SGI volume header"
498 dd if
=/dev
/zero of
=$@.tmp bs
=512 count
=${SGIVOLHDR.size
}
499 dd if
=$@.raw of
=$@.tmp bs
=512 seek
=${SGIVOLHDR.size
}
500 ${SGIMIPS_SGIVOL} -f
-i
-h
${SGIVOLHDR.size
} $@.tmp
501 ${SGIMIPS_SGIVOL} -f
-w aoutboot
${STAGEDIR}/${image}/aoutboot
$@.tmp
502 ${SGIMIPS_SGIVOL} -f
-w ip2xboot
${STAGEDIR}/${image}/ip2xboot
$@.tmp
503 ${SGIMIPS_SGIVOL} -f
-w ip3xboot
${STAGEDIR}/${image}/ip3xboot
$@.tmp
507 @echo Rounding up to
32k boundary and padding
32k....
508 @size
=$$(${TOOL_STAT} -f
'%z' $@
); \
509 pad
=$$(( 32768 - ( $$size & 32767 ) )); \
510 [ $$pad = 32768 ] || \
511 dd if
=/dev
/zero bs
=1 count
=$$pad >>$@
2>/dev
/null
513 .endfor
# image in ${CD_IMAGES} # }
516 @mkdir
-p
${DISTRIBDIR}
517 @echo Fetching distributions....
518 ${RSYNC} ${RSYNC_INCLUDE} ${RSYNC_ARGS} ${RSYNC_EXCLUDE} ${RSYNC_SITE}/ ${DISTRIBDIR}/
520 clean: cleanstagedir cleanimages
521 cleandir
distclean: cleandownloaddir
524 .for image in
${CD_IMAGES}
525 -rm -f
${IMAGEDIR}/${image}.iso
${IMAGEDIR}/${image}.iso.log \
530 -rm -rf
${STAGEDIR} ${EXTFILEDIR}
533 -rm -rf
${DOWNLOADDIR}