1 # $NetBSD: Makefile.inc,v 1.27 2019/10/13 07:28:21 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 NOMAN= # defined 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 47 MSG_MD?= msg.md.${SYSINSTLANG} 48 MENUS_MD?= menus.md.${SYSINSTLANG} 49 50 .include <bsd.own.mk> # for mk.conf 51 #.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib" 52 53 DISTRIBVER!= ${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh 54 DISTRIBVERDEP= ${NETBSDSRCDIR}/sys/sys/param.h \ 55 ${NETBSDSRCDIR}/sys/conf/osrelease.sh 56 57 _MKSHTARGET_CREATE?= ${_MKSHMSG_CREATE} ${.CURDIR:T}/${.TARGET} 58 59 DPADD= ${LIBCURSES} ${LIBTERMLIB} ${LIBPROP} ${LIBUTIL} 60 LDADD= -lcurses -ltermlib -lprop -lutil 61 62 UNIF_AWK= ${.CURDIR}/../../unif.awk 63 MSG_XLAT_SH= ${.CURDIR}/../../msg_xlat.sh 64 MSG_CMP_SH= ${.CURDIR}/../../msg_cmp.sh 65 66 SETS_TAR_SUFF=${"${USE_XZ_SETS:Uno}"!="no":?"tar.xz":"tgz"} 67 68 CATALOGDIR= /usr/share/sysinst/catalog 69 CPPFLAGS+= -I. -I${.CURDIR}/../.. -I${.CURDIR} \ 70 -I${.CURDIR}/../../../../sbin/fsck \ 71 -DSETS_TAR_SUFF=${SETS_TAR_SUFF:Q} \ 72 -DREL=\"${DISTRIBVER}\" -DMACH=\"${MACHINE}\" \ 73 -DMACH_${MACHINE} -DARCH_${MACHINE_ARCH} \ 74 ${NODISKLABEL:D-DNO_DISKLABEL} \ 75 ${NOPARTMAN:D-DNO_PARTMAN} 76 77 .if ${MACHINE} == "evbarm" \ 78 || ${MACHINE} == "evbmips" \ 79 || ${MACHINE} == "evbsh3" 80 CPPFLAGS+= -DARCH_SUBDIR="\"${MACHINE}-${MACHINE_ARCH}\"" 81 CPPFLAGS+= -DPKG_ARCH_SUBDIR="\"${MACHINE_ARCH}\"" 82 .endif 83 84 .if defined(NETBSD_OFFICIAL_RELEASE) && ${NETBSD_OFFICIAL_RELEASE} == "yes" 85 CPPFLAGS+= -DSYSINST_FTP_HOST=\"ftp.NetBSD.org\" -DNETBSD_OFFICIAL_RELEASE 86 CPPFLAGS+= -DSYSINST_HTTP_HOST=\"cdn.NetBSD.org\" -DNETBSD_OFFICIAL_RELEASE 87 .else 88 CPPFLAGS+= -DSYSINST_FTP_HOST=\"nyftp.NetBSD.org\" 89 CPPFLAGS+= -DSYSINST_HTTP_HOST=\"nycdn.NetBSD.org\" 90 .if (${DISTRIBVER:M*.99.*}) 91 CPPFLAGS+= -DREL_PATH=\"HEAD\" 92 CPPFLAGS+= -DPKG_SUBDIR="\"${DISTRIBVER:C/\.99\.[0-9]*[_A-Z]*$//}.0\"" 93 .elif (${DISTRIBVER:M*.[0-9].[0-9]*}) 94 CPPFLAGS+= -DREL_PATH=\"netbsd-${DISTRIBVER:C/\.[0-9][_A-Z]*$//:S/./-/}\" 95 CPPFLAGS+= -DPKG_SUBDIR="\"${DISTRIBVER:C/_.*$//}\"" 96 .elif (${DISTRIBVER:M*.[0-9]*}) 97 CPPFLAGS+= -DREL_PATH=\"netbsd-${DISTRIBVER:C/\.[0-9][_A-Z]*$//}\" 98 CPPFLAGS+= -DPKG_SUBDIR="\"${DISTRIBVER:C/_.*$//}\"" 99 .endif 100 .endif 101 CPPFLAGS+= -DNETBSD_MAJOR='"${DISTRIBVER:C/\..*//}"' 102 103 .if !defined(DEBUG) 104 CPPFLAGS+= -DCATALOG_DIR=\"${CATALOGDIR}\" 105 .endif 106 107 .if (defined(DEBUG)) 108 .if ${ACTIVE_CC} == "gcc" 109 # make gcc run additional passes for better debug info (only needed 110 # when compiling with -O0) 111 O0TRACKING= -fvar-tracking-assignments -fvar-tracking 112 .endif 113 CPPFLAGS+=-DDEBUG 114 DBG +=-g -O0 ${O0TRACKING} 115 .endif 116 117 .if empty(DBG:M-g) 118 COPTS += -Os 119 .endif 120 121 .if (!defined(SMALLPROG) || defined(SMALLPROG_INET6)) && (${USE_INET6} != "no") 122 CPPFLAGS+=-DINET6 123 .endif 124 125 COPTS+= ${GCC_NO_FORMAT_TRUNCATION} 126 127 # Host to ftp from. Default: 128 # "ftp.NetBSD.org" 129 # 130 .if defined(SYSINST_FTP_HOST) 131 CPPFLAGS+= -DSYSINST_FTP_HOST=\"${SYSINST_FTP_HOST}\" 132 .endif 133 134 # Top-level ftp directory. Default: 135 # "pub/NetBSD/NetBSD-" + VER + "/" + MACH 136 # 137 .if defined(SYSINST_FTP_DIR) 138 CPPFLAGS+= -DSYSINST_FTP_DIR=\"${SYSINST_FTP_DIR}\" 139 .endif 140 141 # Top-level CDROM directory. Default: 142 # "/" + MACH 143 # 144 .if defined(SYSINST_CDROM_DIR) 145 CPPFLAGS+= -DSYSINST_CDROM_DIR=\"${SYSINST_CDROM_DIR}\" 146 .endif 147 148 149 DPSRCS+= msg_defs.h menu_defs.h 150 151 CLEANFILES= menu_defs.c menu_defs.h menus.def \ 152 msg_defs.c msg_defs.h msg.def msgtouch \ 153 sysinstmsgs.* 154 155 .PATH: ${.CURDIR}/../.. 156 157 menu_defs.h: menu_defs.c 158 [ -f ${.TARGET} ] || { \ 159 ${_MKSHTARGET_CREATE}; \ 160 ${TOOL_MENUC} menus.def; \ 161 } 162 menu_defs.c: menus.def 163 ${_MKTARGET_CREATE} 164 [ ! -f menu_defs.h ] || mv -f menu_defs.h menu_defs.oh 165 ${TOOL_MENUC} menus.def 166 ! cmp -s menu_defs.oh menu_defs.h || mv -f menu_defs.oh menu_defs.h 167 @rm -f menu_defs.oh 168 169 msg_defs.h: msg_defs.c 170 [ -f ${.TARGET} ] || { \ 171 ${_MKSHTARGET_CREATE}; \ 172 ${TOOL_MSGC} msg.def; \ 173 } 174 msg_defs.c: msg.def 175 ${_MKTARGET_CREATE} 176 [ ! -f msg_defs.h ] || mv -f msg_defs.h msg_defs.oh 177 ${TOOL_MSGC} msg.def 178 ! cmp -s msg_defs.oh msg_defs.h || mv -f msg_defs.oh msg_defs.h 179 @rm -f msg_defs.oh 180 181 # Needed to get proper dependency checks on osrelease 182 msgtouch: ${DISTRIBVERDEP} 183 touch ${.TARGET} 184 185 .if !defined(NOPARTMAN) 186 MSG_MD+= msg.pm.${SYSINSTLANG} 187 .endif 188 189 msg.def: msg.mi.${SYSINSTLANG} ${MSG_MD} msgtouch 190 ${_MKTARGET_CREATE} 191 ${TOOL_SED} "s/@@VERSION@@/${DISTRIBVER}/" ${.ALLSRC} | \ 192 ${TOOL_SED} "s/@@MACHINE@@/${MACHINE}/" | \ 193 ${TOOL_AWK} -f ${UNIF_AWK} -v defines="${MD_OPTIONS}" > ${.TARGET} 194 195 menus.def: ${MENUS_MI} ${MENUS_MD} msgtouch 196 ${_MKTARGET_CREATE} 197 ${TOOL_SED} "s/@@VERSION@@/${DISTRIBVER}/" ${.ALLSRC} | \ 198 ${TOOL_SED} "s/@@MACHINE@@/${MACHINE}/" | \ 199 ${TOOL_AWK} -f ${UNIF_AWK} -v defines="${MD_OPTIONS}" > ${.TARGET} 200 201 sysinstmsgs.fmtcnt: msg.mi.${SYSINSTLANG} ${MSG_MD} msgtouch msg_defs.h 202 ${_MKTARGET_CREATE} 203 ${TOOL_SED} "s/@@VERSION@@/${DISTRIBVER}/" \ 204 ${.ALLSRC:M*.${SYSINSTLANG}} | \ 205 ${TOOL_SED} "s/@@MACHINE@@/${MACHINE}/" | \ 206 ${TOOL_AWK} -f ${UNIF_AWK} -v defines="${MD_OPTIONS}" | \ 207 ${HOST_SH} ${MSG_XLAT_SH} -c > ${.TARGET} 208 209 .for LANG in ${LANGUAGES:N${SYSINSTLANG}} 210 sysinstmsgs.${LANG}: msg.mi.${LANG} ${MSG_MD:S/.${SYSINSTLANG}$/.${LANG}/} msgtouch msg_defs.h sysinstmsgs.fmtcnt 211 ${_MKTARGET_CREATE} 212 ${TOOL_SED} "s/@@VERSION@@/${DISTRIBVER}/" ${.ALLSRC:M*.${LANG}} | \ 213 ${TOOL_SED} "s/@@MACHINE@@/${MACHINE}/" | \ 214 ${TOOL_AWK} -f ${UNIF_AWK} -v defines="${MD_OPTIONS}" | \ 215 ${HOST_SH} ${MSG_XLAT_SH} -f sysinstmsgs.fmtcnt > ${.TARGET} 216 217 DPSRCS+= sysinstmsgs.${LANG} 218 # FILES+= sysinstmsgs.${LANG} 219 # FILESDIR_sysinstmsgs.${LANG}= ${CATALOGDIR} 220 .endfor 221 222 .PHONY: check-lang 223 check-lang: msg.def msg_defs.h 224 ${_MKTARGET_CREATE} 225 ${TOOL_SED} "s/@@VERSION@@/${DISTRIBVER}/" msg.def | \ 226 ${TOOL_SED} "s/@@MACHINE@@/${MACHINE}/" | \ 227 ${TOOL_AWK} -f ${UNIF_AWK} -v defines="${MD_OPTIONS}" | \ 228 ${HOST_SH} ${MSG_XLAT_SH} -i > /tmp/sysinst.en 229 ${HOST_SH} ${MSG_CMP_SH} msg_defs.h /tmp/sysinst.en sysinstmsgs.${LANG} 230 @rm /tmp/sysinst.en 231 232 .include <bsd.prog.mk> 233