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