Fix checks for RELEASEDIR (and xxxxIMGBASE) variables to perform it only on live_image or install_image targets. PR toolchain/45864diff -r1.1 -r1.2 src/distrib/common/bootimage/Makefile.bootimage
(tsutsui)
--- src/distrib/common/bootimage/Makefile.bootimage 2012/01/22 03:53:30 1.1
+++ src/distrib/common/bootimage/Makefile.bootimage 2012/01/22 16:50:00 1.2
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | # $NetBSD: Makefile.bootimage,v 1.1 2012/01/22 03:53:30 tsutsui Exp $ | 1 | # $NetBSD: Makefile.bootimage,v 1.2 2012/01/22 16:50:00 tsutsui Exp $ | |
2 | # | 2 | # | |
3 | # Copyright (c) 2009, 2010, 2011 Izumi Tsutsui. All rights reserved. | 3 | # Copyright (c) 2009, 2010, 2011 Izumi Tsutsui. All rights reserved. | |
4 | # | 4 | # | |
5 | # Redistribution and use in source and binary forms, with or without | 5 | # Redistribution and use in source and binary forms, with or without | |
6 | # modification, are permitted provided that the following conditions | 6 | # modification, are permitted provided that the following conditions | |
7 | # are met: | 7 | # are met: | |
8 | # 1. Redistributions of source code must retain the above copyright | 8 | # 1. Redistributions of source code must retain the above copyright | |
9 | # notice, this list of conditions and the following disclaimer. | 9 | # notice, this list of conditions and the following disclaimer. | |
10 | # 2. Redistributions in binary form must reproduce the above copyright | 10 | # 2. Redistributions in binary form must reproduce the above copyright | |
11 | # notice, this list of conditions and the following disclaimer in the | 11 | # notice, this list of conditions and the following disclaimer in the | |
12 | # documentation and/or other materials provided with the distribution. | 12 | # documentation and/or other materials provided with the distribution. | |
13 | # | 13 | # | |
14 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | 14 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
@@ -113,31 +113,26 @@ | @@ -113,31 +113,26 @@ | |||
113 | # | 113 | # | |
114 | 114 | |||
115 | .include <bsd.sys.mk> # for HOST_SH | 115 | .include <bsd.sys.mk> # for HOST_SH | |
116 | .include <bsd.own.mk> # | 116 | .include <bsd.own.mk> # | |
117 | .include <bsd.endian.mk> # for TARGET_ENDIANNESS | 117 | .include <bsd.endian.mk> # for TARGET_ENDIANNESS | |
118 | 118 | |||
119 | .include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib" | 119 | .include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib" | |
120 | 120 | |||
121 | .if empty(IMGBASE) | 121 | .if empty(IMGBASE) | |
122 | .BEGIN: | 122 | .BEGIN: | |
123 | @echo "Error: IMGBASE is not set" | 123 | @echo "Error: IMGBASE is not set" | |
124 | @false | 124 | @false | |
125 | .endif | 125 | .endif | |
126 | .if empty(RELEASEDIR) | |||
127 | .BEGIN: | |||
128 | @echo "Error: RELEASEDIR is not set" | |||
129 | @false | |||
130 | .endif | |||
131 | 126 | |||
132 | # should be defined elsewhere? | 127 | # should be defined elsewhere? | |
133 | CAT?= cat | 128 | CAT?= cat | |
134 | CHMOD?= chmod | 129 | CHMOD?= chmod | |
135 | CP?= cp | 130 | CP?= cp | |
136 | DD?= dd | 131 | DD?= dd | |
137 | MKDIR?= mkdir -p | 132 | MKDIR?= mkdir -p | |
138 | RM?= rm | 133 | RM?= rm | |
139 | 134 | |||
140 | # | 135 | # | |
141 | # common definitions for image | 136 | # common definitions for image | |
142 | # | 137 | # | |
143 | BOOTDISK?= sd0 | 138 | BOOTDISK?= sd0 |
--- src/distrib/common/bootimage/Makefile.installimage 2012/01/22 03:53:30 1.1
+++ src/distrib/common/bootimage/Makefile.installimage 2012/01/22 16:50:00 1.2
@@ -1,35 +1,34 @@ | @@ -1,35 +1,34 @@ | |||
1 | # $NetBSD: Makefile.installimage,v 1.1 2012/01/22 03:53:30 tsutsui Exp $ | 1 | # $NetBSD: Makefile.installimage,v 1.2 2012/01/22 16:50:00 tsutsui Exp $ | |
2 | # | 2 | # | |
3 | # Common Makefile to create a bootable installation image for USB flash etc. | 3 | # Common Makefile to create a bootable installation image for USB flash etc. | |
4 | # | 4 | # | |
5 | 5 | |||
6 | # | 6 | # | |
7 | # Required variables: | 7 | # Required variables: | |
8 | # INSTIMGBASE | 8 | # INSTIMGBASE | |
9 | # Basename of the liveimage | 9 | # Basename of the liveimage | |
10 | # | 10 | # | |
11 | # See Makefile.bootimage for other variables. | 11 | # See Makefile.bootimage for other variables. | |
12 | # | 12 | # | |
13 | 13 | |||
14 | .if empty(INSTIMGBASE) | 14 | .if !target(check_INSTIMGBASE) | |
15 | .BEGIN: | 15 | check_INSTIMGBASE: .PHONY .NOTMAIN | |
16 | .if !defined(INSTIMGBASE) | |||
16 | @echo "Error: INSTIMGBASE is not set" | 17 | @echo "Error: INSTIMGBASE is not set" | |
17 | @false | 18 | @false | |
19 | .else | |||
20 | @true | |||
18 | .endif | 21 | .endif | |
19 | .if empty(RELEASEDIR) | |||
20 | .BEGIN: | |||
21 | @echo "Error: RELEASEDIR is not set" | |||
22 | @false | |||
23 | .endif | 22 | .endif | |
24 | 23 | |||
25 | SWAPMB= 0 # no swap | 24 | SWAPMB= 0 # no swap | |
26 | OMIT_SWAPIMG= yes # nothing to write | 25 | OMIT_SWAPIMG= yes # nothing to write | |
27 | 26 | |||
28 | KERN_SET?= kern-GENERIC | 27 | KERN_SET?= kern-GENERIC | |
29 | SETS?= modules base etc | 28 | SETS?= modules base etc | |
30 | 29 | |||
31 | FSTAB_IN?= ${NETBSDSRCDIR}/distrib/common/bootimage/fstab.install.in | 30 | FSTAB_IN?= ${NETBSDSRCDIR}/distrib/common/bootimage/fstab.install.in | |
32 | 31 | |||
33 | .if ${USE_MBR} != "no" | 32 | .if ${USE_MBR} != "no" | |
34 | DISKPROTO_IN?= ${NETBSDSRCDIR}/distrib/common/bootimage/diskproto.noswap.mbr.in | 33 | DISKPROTO_IN?= ${NETBSDSRCDIR}/distrib/common/bootimage/diskproto.noswap.mbr.in | |
35 | .else | 34 | .else | |
@@ -44,20 +43,20 @@ IMGDIR_EXCLUDE+= -s ',./installation/ins | @@ -44,20 +43,20 @@ IMGDIR_EXCLUDE+= -s ',./installation/ins | |||
44 | 43 | |||
45 | IMGBASE= ${INSTIMGBASE} | 44 | IMGBASE= ${INSTIMGBASE} | |
46 | 45 | |||
47 | .include "${NETBSDSRCDIR}/distrib/common/bootimage/Makefile.bootimage" | 46 | .include "${NETBSDSRCDIR}/distrib/common/bootimage/Makefile.bootimage" | |
48 | 47 | |||
49 | # INSTIMG_RELEASEDIR specifies where to install ${INSTIMGBASE}.img.gz. | 48 | # INSTIMG_RELEASEDIR specifies where to install ${INSTIMGBASE}.img.gz. | |
50 | # This should be passed from etc/Makefile or etc/etc.${MACHINE}/Makefile.inc | 49 | # This should be passed from etc/Makefile or etc/etc.${MACHINE}/Makefile.inc | |
51 | # but also set default here for manual builds. | 50 | # but also set default here for manual builds. | |
52 | INSTIMG_RELEASEDIR?= ${RELEASEMACHINEDIR}/installation/installimage | 51 | INSTIMG_RELEASEDIR?= ${RELEASEMACHINEDIR}/installation/installimage | |
53 | 52 | |||
54 | # should be defined elsewhere? | 53 | # should be defined elsewhere? | |
55 | MKDIR?= mkdir -p | 54 | MKDIR?= mkdir -p | |
56 | 55 | |||
57 | install_image: ${IMGBASE}.img.gz | 56 | install_image: check_INSTIMGBASE check_RELEASEDIR ${IMGBASE}.img.gz | |
58 | ${MKDIR} ${INSTIMG_RELEASEDIR} | 57 | ${MKDIR} ${INSTIMG_RELEASEDIR} | |
59 | ${RELEASE_INSTALL} ${IMGBASE}.img.gz ${INSTIMG_RELEASEDIR} | 58 | ${RELEASE_INSTALL} ${IMGBASE}.img.gz ${INSTIMG_RELEASEDIR} | |
60 | # note ${MAKESUM} will be calculated in src/etc/Makefile | 59 | # note ${MAKESUM} will be calculated in src/etc/Makefile | |
61 | 60 | |||
62 | release: | 61 | release: | |
63 | 62 |
--- src/distrib/common/bootimage/Makefile.liveimage 2012/01/22 03:53:30 1.1
+++ src/distrib/common/bootimage/Makefile.liveimage 2012/01/22 16:50:00 1.2
@@ -1,43 +1,42 @@ | @@ -1,43 +1,42 @@ | |||
1 | # $NetBSD: Makefile.liveimage,v 1.1 2012/01/22 03:53:30 tsutsui Exp $ | 1 | # $NetBSD: Makefile.liveimage,v 1.2 2012/01/22 16:50:00 tsutsui Exp $ | |
2 | # | 2 | # | |
3 | # Common Makefile to create a bootable FS image for USB flash or emulators | 3 | # Common Makefile to create a bootable FS image for USB flash or emulators | |
4 | # | 4 | # | |
5 | 5 | |||
6 | # | 6 | # | |
7 | # Required variables: | 7 | # Required variables: | |
8 | # LIVEIMGBASE | 8 | # LIVEIMGBASE | |
9 | # Basename of the liveimage | 9 | # Basename of the liveimage | |
10 | # | 10 | # | |
11 | # See Makefile.bootimage for other variables. | 11 | # See Makefile.bootimage for other variables. | |
12 | # | 12 | # | |
13 | 13 | |||
14 | .if empty(LIVEIMGBASE) | 14 | .if !target(check_LIVEIMGBASE) | |
15 | .BEGIN: | 15 | check_LIVEIMGBASE: .PHONY .NOTMAIN | |
16 | .if !defined(LIVEIMGBASE) | |||
16 | @echo "Error: LIVEIMGBASE is not set" | 17 | @echo "Error: LIVEIMGBASE is not set" | |
17 | @false | 18 | @false | |
19 | .else | |||
20 | @true | |||
18 | .endif | 21 | .endif | |
19 | .if empty(RELEASEDIR) | |||
20 | .BEGIN: | |||
21 | @echo "Error: RELEASEDIR is not set" | |||
22 | @false | |||
23 | .endif | 22 | .endif | |
24 | 23 | |||
25 | IMGBASE= ${LIVEIMGBASE} | 24 | IMGBASE= ${LIVEIMGBASE} | |
26 | 25 | |||
27 | .include "${NETBSDSRCDIR}/distrib/common/bootimage/Makefile.bootimage" | 26 | .include "${NETBSDSRCDIR}/distrib/common/bootimage/Makefile.bootimage" | |
28 | 27 | |||
29 | # LIVEIMG_RELEASEDIR specifies where to install ${LIVEIMGBASE}.img.gz. | 28 | # LIVEIMG_RELEASEDIR specifies where to install ${LIVEIMGBASE}.img.gz. | |
30 | # This should be passed from etc/Makefile or etc/etc.${MACHINE}/Makefile.inc | 29 | # This should be passed from etc/Makefile or etc/etc.${MACHINE}/Makefile.inc | |
31 | # but also set default here for manual builds. | 30 | # but also set default here for manual builds. | |
32 | LIVEIMG_RELEASEDIR?= ${RELEASEMACHINEDIR}/installation/liveimage | 31 | LIVEIMG_RELEASEDIR?= ${RELEASEMACHINEDIR}/installation/liveimage | |
33 | 32 | |||
34 | # should be defined elsewhere? | 33 | # should be defined elsewhere? | |
35 | MKDIR?= mkdir -p | 34 | MKDIR?= mkdir -p | |
36 | 35 | |||
37 | live_image: ${IMGBASE}.img.gz | 36 | live_image: check_LIVEIMGBASE check_RELEASEDIR ${IMGBASE}.img.gz | |
38 | ${MKDIR} ${LIVEIMG_RELEASEDIR} | 37 | ${MKDIR} ${LIVEIMG_RELEASEDIR} | |
39 | ${RELEASE_INSTALL} ${IMGBASE}.img.gz ${LIVEIMG_RELEASEDIR} | 38 | ${RELEASE_INSTALL} ${IMGBASE}.img.gz ${LIVEIMG_RELEASEDIR} | |
40 | # note ${MAKESUM} will be calculated in src/etc/Makefile | 39 | # note ${MAKESUM} will be calculated in src/etc/Makefile | |
41 | 40 | |||
42 | release: | 41 | release: | |
43 | 42 |