Home | History | Annotate | Line # | Download | only in sysinst
Makefile.inc revision 1.48
      1 #	$NetBSD: Makefile.inc,v 1.48 2024/04/09 15:17:24 nia 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 ${MKDTB:Uno} != "no"
     85 CPPFLAGS+=	-DHAVE_DTB
     86 .endif
     87 
     88 .if ${MKKMOD:Uno} != "no"
     89 CPPFLAGS+=	-DHAVE_MODULES
     90 .endif
     91 
     92 CATALOGDIR=	/usr/share/sysinst/catalog
     93 CPPFLAGS+=	-I. -I${.CURDIR}/../.. -I${.CURDIR} \
     94 		-I${.CURDIR}/../../../../sbin/fsck \
     95 		-DSETS_TAR_SUFF=${SETS_TAR_SUFF:Q} \
     96 		-DREL=\"${DISTRIBVER}\" -DMACH=\"${MACHINE}\" \
     97 		-DMACH_${MACHINE} -DARCH_${MACHINE_ARCH} \
     98 		${NODISKLABEL:D-DNO_DISKLABEL} \
     99 		${NOPARTMAN:D-DNO_PARTMAN}
    100 
    101 .if ${USE_XZ_SETS:Uno} != "no"
    102 CPPFLAGS+=	-DEXTRACT_NEEDS_BIG_RAM
    103 .endif
    104 
    105 .if ${RELEASEMACHINEDIR} != ${MACHINE}
    106 CPPFLAGS+=	-DARCH_SUBDIR="\"${RELEASEMACHINEDIR}\""
    107 CPPFLAGS+=	-DPKG_ARCH_SUBDIR="\"${MACHINE_ARCH}\""
    108 .endif
    109 
    110 .if defined(NETBSD_OFFICIAL_RELEASE) && ${NETBSD_OFFICIAL_RELEASE} == "yes"
    111 CPPFLAGS+= -DSYSINST_FTP_HOST=\"ftp.NetBSD.org\" -DNETBSD_OFFICIAL_RELEASE
    112 CPPFLAGS+= -DSYSINST_HTTP_HOST=\"cdn.NetBSD.org\" -DNETBSD_OFFICIAL_RELEASE
    113 CPPFLAGS+= -DREL_PATH=\"netbsd-${DISTRIBVER:C/\.[0-9][_A-Z]*[0-9]*$//:S/./-/}\"
    114 CPPFLAGS+= -DPKG_SUBDIR="\"${DISTRIBVER:C/_.*$//}\""
    115 .else
    116 CPPFLAGS+= -DSYSINST_FTP_HOST=\"nyftp.NetBSD.org\"
    117 CPPFLAGS+= -DSYSINST_HTTP_HOST=\"nycdn.NetBSD.org\"
    118 .if (${DISTRIBVER:M*.99.*})
    119 CPPFLAGS+= -DREL_PATH=\"HEAD\"
    120 CPPFLAGS+= -DPKG_SUBDIR="\"${DISTRIBVER:C/\.99\.[0-9]*[_A-Z]*$//}.0\""
    121 .elif (${DISTRIBVER:M*.[0-9].[0-9]*})
    122 CPPFLAGS+= -DREL_PATH=\"netbsd-${DISTRIBVER:C/\.[0-9][_A-Z]*[0-9]*$//:S/./-/}\"
    123 CPPFLAGS+= -DPKG_SUBDIR="\"${DISTRIBVER:C/_.*$//}\""
    124 .elif (${DISTRIBVER:M*.[0-9]*})
    125 CPPFLAGS+= -DREL_PATH=\"netbsd-${DISTRIBVER:C/\.[0-9][_A-Z]*[0-9]*$//}\"
    126 CPPFLAGS+= -DPKG_SUBDIR="\"${DISTRIBVER:C/_.*$//}\""
    127 .endif
    128 .endif
    129 CPPFLAGS+= -DNETBSD_MAJOR='"${DISTRIBVER:C/\..*//}"'
    130 
    131 .if !defined(DEBUG)
    132 CPPFLAGS+=	-DCATALOG_DIR=\"${CATALOGDIR}\"
    133 .endif
    134 
    135 .if (defined(DEBUG))
    136 .if ${ACTIVE_CC} == "gcc"
    137 # make gcc run additional passes for better debug info (only needed
    138 # when compiling with -O0)
    139 O0TRACKING=	-fvar-tracking-assignments -fvar-tracking
    140 .endif
    141 CPPFLAGS+=-DDEBUG
    142 DBG +=-g -O0 ${O0TRACKING}
    143 .else
    144 .if defined(SMALLPROG)
    145 COPTS += -Os
    146 .endif
    147 .endif
    148 
    149 .if (!defined(SMALLPROG) || defined(SMALLPROG_INET6)) && (${USE_INET6} != "no")
    150 CPPFLAGS+=-DINET6
    151 .endif
    152 
    153 COPTS+=	${CC_WNO_FORMAT_TRUNCATION}
    154 COPTS.disklabel.c+= ${CC_WNO_STRINGOP_TRUNCATION}
    155 
    156 # Host to ftp from.  Default:
    157 #	"ftp.NetBSD.org"
    158 #
    159 .if defined(SYSINST_FTP_HOST)
    160 CPPFLAGS+=	-DSYSINST_FTP_HOST=\"${SYSINST_FTP_HOST}\"
    161 .endif
    162 
    163 # Top-level ftp directory.  Default:
    164 #	"pub/NetBSD/NetBSD-" + VER + "/" + MACH
    165 #
    166 .if defined(SYSINST_FTP_DIR)
    167 CPPFLAGS+=	-DSYSINST_FTP_DIR=\"${SYSINST_FTP_DIR}\"
    168 .endif
    169 
    170 # Top-level CDROM directory.  Default:
    171 #	"/" + MACH
    172 #
    173 .if defined(SYSINST_CDROM_DIR)
    174 CPPFLAGS+=	-DSYSINST_CDROM_DIR=\"${SYSINST_CDROM_DIR}\"
    175 .endif
    176 
    177 
    178 DPSRCS+=	msg_defs.h menu_defs.h
    179 
    180 CLEANFILES=	menu_defs.c menu_defs.h menus.def \
    181 		msg_defs.c msg_defs.h msg.def msgtouch \
    182 		sysinstmsgs.*
    183 
    184 .PATH: ${.CURDIR}/../..
    185 
    186 menu_defs.h: menu_defs.c
    187 	[ -f ${.TARGET} ] || { \
    188 		${_MKSHTARGET_CREATE}; \
    189 		${TOOL_MENUC} menus.def; \
    190 	}
    191 menu_defs.c: menus.def
    192 	${_MKTARGET_CREATE}
    193 	[ ! -f menu_defs.h ] || mv -f menu_defs.h menu_defs.oh
    194 	${TOOL_MENUC} menus.def
    195 	! cmp -s menu_defs.oh menu_defs.h || mv -f menu_defs.oh menu_defs.h
    196 	@rm -f menu_defs.oh
    197 
    198 msg_defs.h: msg_defs.c
    199 	[ -f ${.TARGET} ] || { \
    200 		${_MKSHTARGET_CREATE}; \
    201 		${TOOL_MSGC} msg.def; \
    202 	}
    203 msg_defs.c: msg.def
    204 	${_MKTARGET_CREATE}
    205 	[ ! -f msg_defs.h ] || mv -f msg_defs.h msg_defs.oh
    206 	${TOOL_MSGC} msg.def
    207 	! cmp -s msg_defs.oh msg_defs.h || mv -f msg_defs.oh msg_defs.h
    208 	@rm -f msg_defs.oh
    209 
    210 # Needed to get proper dependency checks on osrelease
    211 msgtouch: ${DISTRIBVERDEP}
    212 	touch ${.TARGET}
    213 
    214 .if !defined(NOPARTMAN)
    215 MSG_MD+=	msg.pm.${SYSINSTLANG}
    216 .endif
    217 
    218 .if ${CHECK_ENTROPY:Uyes} != "no"
    219 MSG_MD+=	msg.entropy.${SYSINSTLANG}
    220 .endif
    221 
    222 msg.def: msg.mi.${SYSINSTLANG} ${MSG_MD} msgtouch
    223 	${_MKTARGET_CREATE}
    224 	${TOOL_SED} "s/@@VERSION@@/${DISTRIBVER}/" ${.ALLSRC} | \
    225 	${TOOL_SED} "s/@@MACHINE@@/${MACHINE}/" | \
    226 	${TOOL_AWK} -f ${UNIF_AWK} -v defines="${MD_OPTIONS}" > ${.TARGET}
    227 
    228 menus.def: ${MENUS_MI} ${MENUS_MD} msgtouch
    229 	${_MKTARGET_CREATE}
    230 	${TOOL_SED} "s/@@VERSION@@/${DISTRIBVER}/" ${.ALLSRC} | \
    231 	${TOOL_SED} "s/@@MACHINE@@/${MACHINE}/" | \
    232 	${TOOL_AWK} -f ${UNIF_AWK} -v defines="${MD_OPTIONS}" > ${.TARGET}
    233 
    234 sysinstmsgs.fmtcnt: msg.mi.${SYSINSTLANG} ${MSG_MD} msgtouch msg_defs.h
    235 	${_MKTARGET_CREATE}
    236 	${TOOL_SED} "s/@@VERSION@@/${DISTRIBVER}/" \
    237 		${.ALLSRC:M*.${SYSINSTLANG}} | \
    238 	${TOOL_SED} "s/@@MACHINE@@/${MACHINE}/" | \
    239 	${TOOL_AWK} -f ${UNIF_AWK} -v defines="${MD_OPTIONS}" | \
    240 	${HOST_SH} ${MSG_XLAT_SH} -c > ${.TARGET}
    241 
    242 .for LANG in ${LANGUAGES:N${SYSINSTLANG}}
    243 sysinstmsgs.${LANG}: msg.mi.${LANG} ${MSG_MD:S/.${SYSINSTLANG}$/.${LANG}/} msgtouch msg_defs.h sysinstmsgs.fmtcnt
    244 	${_MKTARGET_CREATE}
    245 	${TOOL_SED} "s/@@VERSION@@/${DISTRIBVER}/" ${.ALLSRC:M*.${LANG}} | \
    246 	${TOOL_SED} "s/@@MACHINE@@/${MACHINE}/" | \
    247 	${TOOL_AWK} -f ${UNIF_AWK} -v defines="${MD_OPTIONS}" | \
    248 	${HOST_SH} ${MSG_XLAT_SH} -f sysinstmsgs.fmtcnt > ${.TARGET}
    249 
    250 DPSRCS+=	sysinstmsgs.${LANG}
    251 FILES+=		sysinstmsgs.${LANG}
    252 FILESDIR_sysinstmsgs.${LANG}=	${CATALOGDIR}
    253 .endfor
    254 
    255 .PHONY:	check-lang
    256 check-lang:	msg.def msg_defs.h
    257 	${_MKTARGET_CREATE}
    258 	${TOOL_SED} "s/@@VERSION@@/${DISTRIBVER}/" msg.def | \
    259 	${TOOL_SED} "s/@@MACHINE@@/${MACHINE}/" | \
    260 	${TOOL_AWK} -f ${UNIF_AWK} -v defines="${MD_OPTIONS}" | \
    261 	${HOST_SH} ${MSG_XLAT_SH} -i > /tmp/sysinst.en
    262 	${HOST_SH} ${MSG_CMP_SH} msg_defs.h /tmp/sysinst.en sysinstmsgs.${LANG}
    263 	@rm /tmp/sysinst.en
    264 
    265 COPTS.util.c+=	${CC_WNO_STRINGOP_TRUNCATION}
    266 COPTS+=		-fcommon
    267 
    268 .include <bsd.prog.mk>
    269