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