Makefile.inc revision 1.49.2.1 1 # $NetBSD: Makefile.inc,v 1.49.2.1 2025/08/02 05:58:55 perseant Exp $
2 #
3 # Makefile for sysinst
4
5 .if exists(${.CURDIR}/../../../Makefile.inc)
6 .include "${.CURDIR}/../../../Makefile.inc"
7 .endif
8
9 PROG= sysinst
10 MAN= sysinst.8
11
12 WARNS= 4
13
14 SRCS+= menu_defs.c msg_defs.c main.c install.c upgrade.c \
15 txtwalk.c run.c factor.c net.c disks.c disks_lfs.c util.c geom.c \
16 label.c target.c md.c sizemultname.c configmenu.c checkrc.c \
17 disklabel.c partitions.c part_edit.c
18
19 SRCS+= ${MD_OPTIONS:MAOUT2ELF:S/AOUT2ELF/aout2elf.c/}
20 SRCS+= ${CPPFLAGS:M-DWSKBD:S/-DWSKBD/wskbd.c/}
21 SRCS+= ${NODISKLABEL:D:Ubsddisklabel.c}
22 SRCS+= ${NOPARTMAN:D:Upartman.c}
23
24 .PATH: ${.CURDIR}/../../../../sbin/fsck
25 SRCS+=partutil.c
26
27 DPSRCS+= defs.h
28
29 SYSINSTLANG?= en
30 LANGUAGES?= de en es fr pl
31
32 MENUS_MI= menus.mi
33 MENUS_MI+= ${NOPARTMAN:D:Umenus.pm}
34
35 .if ${NO_GPT:Uno} != "yes"
36 CPPFLAGS+= -DHAVE_GPT
37 GPT_DIR=${.CURDIR}/../../../../sbin/gpt
38 SRCS+= gpt.c gpt_uuid.c
39 CPPFLAGS.gpt_uuid.c+= -I${GPT_DIR}
40 CPPFLAGS.gpt.c+= -I${GPT_DIR}
41 .endif
42 .if ${NO_MBR:Uyes} != "yes"
43 CPPFLAGS+= -DHAVE_MBR
44 SRCS+= mbr.c
45 .endif
46 .if ${NO_CLONES:Uno} == "yes"
47 CPPFLAGS+= -DNO_CLONES
48 .endif
49
50 .if ${CHECK_ENTROPY:Uyes} != "no"
51 MENUS_MI+= menus.entropy
52 CPPFLAGS+= -DCHECK_ENTROPY=1
53 .endif
54
55 MSG_MD?= msg.md.${SYSINSTLANG}
56 MENUS_MD?= menus.md.${SYSINSTLANG}
57
58 .include <bsd.own.mk> # for mk.conf
59 #.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
60
61 DISTRIBVER!= ${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh
62 DISTRIBVERDEP= ${NETBSDSRCDIR}/sys/sys/param.h \
63 ${NETBSDSRCDIR}/sys/conf/osrelease.sh
64
65 _MKSHTARGET_CREATE?= ${_MKSHMSG_CREATE} ${.CURDIR:T}/${.TARGET}
66
67 DPADD= ${LIBCURSES} ${LIBTERMLIB} ${LIBPROP} ${LIBUTIL}
68 LDADD= -lcurses -ltermlib -lprop -lutil
69
70 UNIF_AWK= ${.CURDIR}/../../unif.awk
71 MSG_XLAT_SH= ${.CURDIR}/../../msg_xlat.sh
72 MSG_CMP_SH= ${.CURDIR}/../../msg_cmp.sh
73
74 SETS_TAR_SUFF=${"${USE_XZ_SETS:Uno}"!="no":?"tar.xz":"tgz"}
75
76 .if ${MKBSDTAR:Uno} == "no"
77 CPPFLAGS+= -DUSING_PAXASTAR
78 .endif
79
80 .if ${MKCOMPAT:Uno} != "no"
81 CPPFLAGS+= -DHAVE_BASE32
82 .endif
83
84 .if ${MKCOMPAT:Uno} != "no" && \
85 (${MACHINE_ARCH} == "mips64eb" || ${MACHINE_ARCH} == "mips64el")
86 CPPFLAGS+= -DHAVE_BASE64
87 .endif
88
89 .if ${MKCOMPAT:Uno} != "no" && ${MKDEBUG:Uno} != "no"
90 CPPFLAGS+= -DHAVE_DEBUG32
91 .endif
92
93 .if ${MKCOMPAT:Uno} != "no" && ${MKDEBUG:Uno} != "no" && \
94 (${MACHINE_ARCH} == "mips64eb" || ${MACHINE_ARCH} == "mips64el")
95 CPPFLAGS+= -DHAVE_DEBUG64
96 .endif
97
98 .if ${MKDTB:Uno} != "no"
99 CPPFLAGS+= -DHAVE_DTB
100 .endif
101
102 .if ${MKKMOD:Uno} != "no"
103 CPPFLAGS+= -DHAVE_MODULES
104 .endif
105
106 CATALOGDIR= /usr/share/sysinst/catalog
107 CPPFLAGS+= -I. -I${.CURDIR}/../.. -I${.CURDIR} \
108 -I${.CURDIR}/../../../../sbin/fsck \
109 -DSETS_TAR_SUFF=${SETS_TAR_SUFF:Q} \
110 -DREL=\"${DISTRIBVER}\" -DMACH=\"${MACHINE}\" \
111 -DMACH_${MACHINE} -DARCH_${MACHINE_ARCH} \
112 ${NODISKLABEL:D-DNO_DISKLABEL} \
113 ${NOPARTMAN:D-DNO_PARTMAN}
114
115 .if ${USE_XZ_SETS:Uno} != "no"
116 CPPFLAGS+= -DEXTRACT_NEEDS_BIG_RAM
117 .endif
118
119 .if ${RELEASEMACHINEDIR} != ${MACHINE}
120 CPPFLAGS+= -DARCH_SUBDIR="\"${RELEASEMACHINEDIR}\""
121 CPPFLAGS+= -DPKG_ARCH_SUBDIR="\"${MACHINE_ARCH}\""
122 .endif
123
124 .if defined(NETBSD_OFFICIAL_RELEASE) && ${NETBSD_OFFICIAL_RELEASE} == "yes"
125 CPPFLAGS+= -DSYSINST_FTP_HOST=\"ftp.NetBSD.org\" -DNETBSD_OFFICIAL_RELEASE
126 CPPFLAGS+= -DSYSINST_HTTP_HOST=\"cdn.NetBSD.org\" -DNETBSD_OFFICIAL_RELEASE
127 CPPFLAGS+= -DREL_PATH=\"netbsd-${DISTRIBVER:C/\.[0-9][_A-Z]*[0-9]*$//:S/./-/}\"
128 CPPFLAGS+= -DPKG_SUBDIR="\"${DISTRIBVER:C/_.*$//}\""
129 .else
130 CPPFLAGS+= -DSYSINST_FTP_HOST=\"nyftp.NetBSD.org\"
131 CPPFLAGS+= -DSYSINST_HTTP_HOST=\"nycdn.NetBSD.org\"
132 .if (${DISTRIBVER:M*.99.*})
133 CPPFLAGS+= -DREL_PATH=\"HEAD\"
134 CPPFLAGS+= -DPKG_SUBDIR="\"${DISTRIBVER:C/\.99\.[0-9]*[_A-Z]*$//}.0\""
135 .elif (${DISTRIBVER:M*.[0-9].[0-9]*})
136 CPPFLAGS+= -DREL_PATH=\"netbsd-${DISTRIBVER:C/\.[0-9][_A-Z]*[0-9]*$//:S/./-/}\"
137 CPPFLAGS+= -DPKG_SUBDIR="\"${DISTRIBVER:C/_.*$//}\""
138 .elif (${DISTRIBVER:M*.[0-9]*})
139 CPPFLAGS+= -DREL_PATH=\"netbsd-${DISTRIBVER:C/\.[0-9][_A-Z]*[0-9]*$//}\"
140 CPPFLAGS+= -DPKG_SUBDIR="\"${DISTRIBVER:C/_.*$//}\""
141 .endif
142 .endif
143 CPPFLAGS+= -DNETBSD_MAJOR='"${DISTRIBVER:C/\..*//}"'
144
145 .if !defined(DEBUG)
146 CPPFLAGS+= -DCATALOG_DIR=\"${CATALOGDIR}\"
147 .endif
148
149 .if (defined(DEBUG))
150 .if ${ACTIVE_CC} == "gcc"
151 # make gcc run additional passes for better debug info (only needed
152 # when compiling with -O0)
153 O0TRACKING= -fvar-tracking-assignments -fvar-tracking
154 .endif
155 CPPFLAGS+=-DDEBUG
156 DBG +=-g -O0 ${O0TRACKING}
157 COPTS.net.c += -Wno-error=maybe-uninitialized
158 .else
159 .if defined(SMALLPROG)
160 COPTS += -Os
161 .endif
162 .endif
163
164 .if (!defined(SMALLPROG) || defined(SMALLPROG_INET6)) && (${USE_INET6} != "no")
165 CPPFLAGS+=-DINET6
166 .endif
167
168 COPTS+= ${CC_WNO_FORMAT_TRUNCATION}
169 COPTS.disklabel.c+= ${CC_WNO_STRINGOP_TRUNCATION}
170
171 # Host to ftp from. Default:
172 # "ftp.NetBSD.org"
173 #
174 .if defined(SYSINST_FTP_HOST)
175 CPPFLAGS+= -DSYSINST_FTP_HOST=\"${SYSINST_FTP_HOST}\"
176 .endif
177
178 # Top-level ftp directory. Default:
179 # "pub/NetBSD/NetBSD-" + VER + "/" + MACH
180 #
181 .if defined(SYSINST_FTP_DIR)
182 CPPFLAGS+= -DSYSINST_FTP_DIR=\"${SYSINST_FTP_DIR}\"
183 .endif
184
185 # Top-level CDROM directory. Default:
186 # "/" + MACH
187 #
188 .if defined(SYSINST_CDROM_DIR)
189 CPPFLAGS+= -DSYSINST_CDROM_DIR=\"${SYSINST_CDROM_DIR}\"
190 .endif
191
192
193 DPSRCS+= msg_defs.h menu_defs.h
194
195 CLEANFILES= menu_defs.c menu_defs.h menus.def \
196 msg_defs.c msg_defs.h msg.def msgtouch \
197 sysinstmsgs.*
198
199 .PATH: ${.CURDIR}/../..
200
201 menu_defs.h: menu_defs.c
202 [ -f ${.TARGET} ] || { \
203 ${_MKSHTARGET_CREATE}; \
204 ${TOOL_MENUC} menus.def; \
205 }
206 menu_defs.c: menus.def
207 ${_MKTARGET_CREATE}
208 [ ! -f menu_defs.h ] || mv -f menu_defs.h menu_defs.oh
209 ${TOOL_MENUC} menus.def
210 ! cmp -s menu_defs.oh menu_defs.h || mv -f menu_defs.oh menu_defs.h
211 @rm -f menu_defs.oh
212
213 msg_defs.h: msg_defs.c
214 [ -f ${.TARGET} ] || { \
215 ${_MKSHTARGET_CREATE}; \
216 ${TOOL_MSGC} msg.def; \
217 }
218 msg_defs.c: msg.def
219 ${_MKTARGET_CREATE}
220 [ ! -f msg_defs.h ] || mv -f msg_defs.h msg_defs.oh
221 ${TOOL_MSGC} msg.def
222 ! cmp -s msg_defs.oh msg_defs.h || mv -f msg_defs.oh msg_defs.h
223 @rm -f msg_defs.oh
224
225 # Needed to get proper dependency checks on osrelease
226 msgtouch: ${DISTRIBVERDEP}
227 touch ${.TARGET}
228
229 .if !defined(NOPARTMAN)
230 MSG_MD+= msg.pm.${SYSINSTLANG}
231 .endif
232
233 .if ${CHECK_ENTROPY:Uyes} != "no"
234 MSG_MD+= msg.entropy.${SYSINSTLANG}
235 .endif
236
237 msg.def: msg.mi.${SYSINSTLANG} ${MSG_MD} msgtouch
238 ${_MKTARGET_CREATE}
239 ${TOOL_SED} "s/@@VERSION@@/${DISTRIBVER}/" ${.ALLSRC} | \
240 ${TOOL_SED} "s/@@MACHINE@@/${MACHINE}/" | \
241 ${TOOL_AWK} -f ${UNIF_AWK} -v defines="${MD_OPTIONS}" > ${.TARGET}
242
243 menus.def: ${MENUS_MI} ${MENUS_MD} msgtouch
244 ${_MKTARGET_CREATE}
245 ${TOOL_SED} "s/@@VERSION@@/${DISTRIBVER}/" ${.ALLSRC} | \
246 ${TOOL_SED} "s/@@MACHINE@@/${MACHINE}/" | \
247 ${TOOL_AWK} -f ${UNIF_AWK} -v defines="${MD_OPTIONS}" > ${.TARGET}
248
249 sysinstmsgs.fmtcnt: msg.mi.${SYSINSTLANG} ${MSG_MD} msgtouch msg_defs.h
250 ${_MKTARGET_CREATE}
251 ${TOOL_SED} "s/@@VERSION@@/${DISTRIBVER}/" \
252 ${.ALLSRC:M*.${SYSINSTLANG}} | \
253 ${TOOL_SED} "s/@@MACHINE@@/${MACHINE}/" | \
254 ${TOOL_AWK} -f ${UNIF_AWK} -v defines="${MD_OPTIONS}" | \
255 ${HOST_SH} ${MSG_XLAT_SH} -c > ${.TARGET}
256
257 .for LANG in ${LANGUAGES:N${SYSINSTLANG}}
258 sysinstmsgs.${LANG}: msg.mi.${LANG} ${MSG_MD:S/.${SYSINSTLANG}$/.${LANG}/} msgtouch msg_defs.h sysinstmsgs.fmtcnt
259 ${_MKTARGET_CREATE}
260 ${TOOL_SED} "s/@@VERSION@@/${DISTRIBVER}/" ${.ALLSRC:M*.${LANG}} | \
261 ${TOOL_SED} "s/@@MACHINE@@/${MACHINE}/" | \
262 ${TOOL_AWK} -f ${UNIF_AWK} -v defines="${MD_OPTIONS}" | \
263 ${HOST_SH} ${MSG_XLAT_SH} -f sysinstmsgs.fmtcnt > ${.TARGET}
264
265 DPSRCS+= sysinstmsgs.${LANG}
266 FILES+= sysinstmsgs.${LANG}
267 FILESDIR_sysinstmsgs.${LANG}= ${CATALOGDIR}
268 .endfor
269
270 .PHONY: check-lang
271 check-lang: msg.def msg_defs.h
272 ${_MKTARGET_CREATE}
273 ${TOOL_SED} "s/@@VERSION@@/${DISTRIBVER}/" msg.def | \
274 ${TOOL_SED} "s/@@MACHINE@@/${MACHINE}/" | \
275 ${TOOL_AWK} -f ${UNIF_AWK} -v defines="${MD_OPTIONS}" | \
276 ${HOST_SH} ${MSG_XLAT_SH} -i > /tmp/sysinst.en
277 ${HOST_SH} ${MSG_CMP_SH} msg_defs.h /tmp/sysinst.en sysinstmsgs.${LANG}
278 @rm /tmp/sysinst.en
279
280 COPTS.util.c+= ${CC_WNO_STRINGOP_TRUNCATION}
281 COPTS+= -fcommon
282
283 .include <bsd.prog.mk>
284