Home | History | Annotate | Line # | Download | only in sysinst
Makefile.inc revision 1.9.16.1
      1 #	$NetBSD: Makefile.inc,v 1.9.16.1 2019/06/10 22:10:37 christos 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 
     18 SRCS+=	${MD_OPTIONS:MAOUT2ELF:S/AOUT2ELF/aout2elf.c/}
     19 SRCS+=	${MENUS_MD:Mmenus.mbr:S/menus.mbr/mbr.c/}
     20 SRCS+=	${CPPFLAGS:M-DWSKBD:S/-DWSKBD/wskbd.c/}
     21 SRCS+=	${NODISKLABEL:D:Ubsddisklabel.c savenewlabel.c}
     22 SRCS+=	${NOPARTMAN:D:Upartman.c}
     23 
     24 DPSRCS+= defs.h
     25 
     26 SYSINSTLANG?=	en
     27 LANGUAGES?=	de en es fr pl
     28 
     29 MENUS_MI=	menus.mi
     30 MENUS_MI+=	${NOPARTMAN:D:Umenus.pm}
     31 
     32 MSG_MD?=	msg.md.${SYSINSTLANG}
     33 MENUS_MD?=	menus.md.${SYSINSTLANG}
     34 
     35 .include <bsd.own.mk>		# for mk.conf
     36 #.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
     37 
     38 DISTRIBVER!=	${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh
     39 DISTRIBVERDEP=	${NETBSDSRCDIR}/sys/sys/param.h \
     40 		${NETBSDSRCDIR}/sys/conf/osrelease.sh
     41 
     42 _MKSHTARGET_CREATE?=	${_MKSHMSG_CREATE} ${.CURDIR:T}/${.TARGET}
     43 
     44 DPADD=		${LIBCURSES} ${LIBTERMLIB} ${LIBUTIL}
     45 LDADD=		-lcurses -ltermlib -lutil
     46 
     47 UNIF_AWK=	${.CURDIR}/../../unif.awk
     48 MSG_XLAT_SH=	${.CURDIR}/../../msg_xlat.sh
     49 
     50 SETS_TAR_SUFF=${"${USE_XZ_SETS:Uno}"!="no":?"tar.xz":"tgz"}
     51 
     52 CATALOGDIR=	/usr/share/sysinst/catalog
     53 CPPFLAGS+=	-I. -I${.CURDIR}/../.. -I${.CURDIR} \
     54 		-DSETS_TAR_SUFF=${SETS_TAR_SUFF:Q} \
     55 		-DREL=\"${DISTRIBVER}\" -DMACH=\"${MACHINE}\" \
     56 		-DMACH_${MACHINE} -DARCH_${MACHINE_ARCH} \
     57 		${NODISKLABEL:D-DNO_DISKLABEL} \
     58 		${NOPARTMAN:D-DNO_PARTMAN}
     59 
     60 .if ${MACHINE} == "evbarm" \
     61     || ${MACHINE} == "evbmips" \
     62     || ${MACHINE} == "evbsh3"
     63 CPPFLAGS+=	-DARCH_SUBDIR="\"${MACHINE}-${MACHINE_ARCH}\""
     64 CPPFLAGS+=	-DPKG_ARCH_SUBDIR="\"${MACHINE_ARCH}\""
     65 .endif
     66 
     67 .if defined(NETBSD_OFFICIAL_RELEASE) && ${NETBSD_OFFICIAL_RELEASE} == "yes"
     68 CPPFLAGS+= -DSYSINST_FTP_HOST=\"ftp.NetBSD.org\" -DNETBSD_OFFICIAL_RELEASE
     69 CPPFLAGS+= -DSYSINST_HTTP_HOST=\"cdn.NetBSD.org\" -DNETBSD_OFFICIAL_RELEASE
     70 .else
     71 CPPFLAGS+= -DSYSINST_FTP_HOST=\"nyftp.NetBSD.org\"
     72 CPPFLAGS+= -DSYSINST_HTTP_HOST=\"nycdn.NetBSD.org\"
     73 .if (${DISTRIBVER:M*.99.*})
     74 CPPFLAGS+= -DREL_PATH=\"HEAD\"
     75 CPPFLAGS+= -DPKG_SUBDIR="\"${DISTRIBVER:C/\.99\.[0-9]*[_A-Z]*$//}.0\""
     76 .elif (${DISTRIBVER:M*.[0-9].[0-9]*})
     77 CPPFLAGS+= -DREL_PATH=\"netbsd-${DISTRIBVER:C/\.[0-9][_A-Z]*$//:S/./-/}\"
     78 CPPFLAGS+= -DPKG_SUBDIR="\"${DISTRIBVER:C/_.*$//}\""
     79 .elif (${DISTRIBVER:M*.[0-9]*})
     80 CPPFLAGS+= -DREL_PATH=\"netbsd-${DISTRIBVER:C/\.[0-9][_A-Z]*$//}\"
     81 CPPFLAGS+= -DPKG_SUBDIR="\"${DISTRIBVER:C/_.*$//}\""
     82 .endif
     83 .endif
     84 
     85 .if !defined(DEBUG)
     86 CPPFLAGS+=	-DCATALOG_DIR=\"${CATALOGDIR}\"
     87 .endif
     88 
     89 .if (defined(DEBUG))
     90 .if ${ACTIVE_CC} == "gcc"
     91 # make gcc run additional passes for better debug info (only needed
     92 # when compiling with -O0)
     93 O0TRACKING=	-fvar-tracking-assignments -fvar-tracking
     94 .endif
     95 CPPFLAGS+=-DDEBUG
     96 DBG +=-g -O0 ${O0TRACKING}
     97 .endif
     98 
     99 .if empty(DBG:M-g)
    100 COPTS += -Os
    101 .endif
    102 
    103 .if (!defined(SMALLPROG) || defined(SMALLPROG_INET6)) && (${USE_INET6} != "no")
    104 CPPFLAGS+=-DINET6
    105 .endif
    106 
    107 .if defined(HAVE_GCC) && ${HAVE_GCC} == 7 && ${ACTIVE_CC} == "gcc"
    108 COPTS+=-Wno-format-truncation	# most useless gcc warning ever
    109 .endif
    110 
    111 .if defined(HAVE_GCC) || defined(HAVE_PCC)
    112 COPTS.label.c+=	-Wno-pointer-sign
    113 .endif
    114 COPTS.main.c += -Wno-format-nonliteral
    115 COPTS.disks.c += -Wno-format-nonliteral
    116 COPTS.util.c += -Wno-format-nonliteral
    117 COPTS.label.c += -Wno-format-nonliteral
    118 COPTS.target.c += -Wno-format-nonliteral
    119 COPTS.mbr.c += -Wno-format-nonliteral
    120 COPTS.msg_defs.c += -Wno-format-nonliteral
    121 COPTS.bsddisklabel.c += -Wno-format-nonliteral
    122 COPTS.md.c += -Wno-format-nonliteral
    123 COPTS.partman.c += -Wno-format-nonliteral -Wno-stack-protector
    124 
    125 # Host to ftp from.  Default:
    126 #	"ftp.NetBSD.org"
    127 #
    128 .if defined(SYSINST_FTP_HOST)
    129 CPPFLAGS+=	-DSYSINST_FTP_HOST=\"${SYSINST_FTP_HOST}\"
    130 .endif
    131 
    132 # Top-level ftp directory.  Default:
    133 #	"pub/NetBSD/NetBSD-" + VER + "/" + MACH
    134 #
    135 .if defined(SYSINST_FTP_DIR)
    136 CPPFLAGS+=	-DSYSINST_FTP_DIR=\"${SYSINST_FTP_DIR}\"
    137 .endif
    138 
    139 # Top-level CDROM directory.  Default:
    140 #	"/" + MACH
    141 #
    142 .if defined(SYSINST_CDROM_DIR)
    143 CPPFLAGS+=	-DSYSINST_CDROM_DIR=\"${SYSINST_CDROM_DIR}\"
    144 .endif
    145 
    146 
    147 DPSRCS+=	msg_defs.h menu_defs.h
    148 
    149 CLEANFILES=	menu_defs.c menu_defs.h menus.def \
    150 		msg_defs.c msg_defs.h msg.def msgtouch \
    151 		sysinstmsgs.*
    152 
    153 .PATH: ${.CURDIR}/../..
    154 
    155 menu_defs.h: menu_defs.c
    156 	[ -f ${.TARGET} ] || { \
    157 		${_MKSHTARGET_CREATE}; \
    158 		${TOOL_MENUC} menus.def; \
    159 	}
    160 menu_defs.c: menus.def
    161 	${_MKTARGET_CREATE}
    162 	[ ! -f menu_defs.h ] || mv -f menu_defs.h menu_defs.oh
    163 	${TOOL_MENUC} menus.def
    164 	! cmp -s menu_defs.oh menu_defs.h || mv -f menu_defs.oh menu_defs.h
    165 	@rm -f menu_defs.oh
    166 
    167 msg_defs.h: msg_defs.c
    168 	[ -f ${.TARGET} ] || { \
    169 		${_MKSHTARGET_CREATE}; \
    170 		${TOOL_MSGC} msg.def; \
    171 	}
    172 msg_defs.c: msg.def
    173 	${_MKTARGET_CREATE}
    174 	[ ! -f msg_defs.h ] || mv -f msg_defs.h msg_defs.oh
    175 	${TOOL_MSGC} msg.def
    176 	! cmp -s msg_defs.oh msg_defs.h || mv -f msg_defs.oh msg_defs.h
    177 	@rm -f msg_defs.oh
    178 
    179 # Needed to get proper dependency checks on osrelease
    180 msgtouch: ${DISTRIBVERDEP}
    181 	touch ${.TARGET}
    182 
    183 msg.def: msg.mi.${SYSINSTLANG} ${MSG_MD} msgtouch
    184 	${_MKTARGET_CREATE}
    185 	${TOOL_SED} "s/@@VERSION@@/${DISTRIBVER}/" ${.ALLSRC} | \
    186 	${TOOL_SED} "s/@@MACHINE@@/${MACHINE}/" | \
    187 	${TOOL_AWK} -f ${UNIF_AWK} -v defines="${MD_OPTIONS}" > ${.TARGET}
    188 
    189 menus.def: ${MENUS_MI} ${MENUS_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 sysinstmsgs.fmtcnt: msg.mi.${SYSINSTLANG} ${MSG_MD} msgtouch msg_defs.h
    196 	${_MKTARGET_CREATE}
    197 	${TOOL_SED} "s/@@VERSION@@/${DISTRIBVER}/" \
    198 		${.ALLSRC:M*.${SYSINSTLANG}} | \
    199 	${TOOL_SED} "s/@@MACHINE@@/${MACHINE}/" | \
    200 	${TOOL_AWK} -f ${UNIF_AWK} -v defines="${MD_OPTIONS}" | \
    201 	${HOST_SH} ${MSG_XLAT_SH} -c > ${.TARGET}
    202 
    203 .for LANG in ${LANGUAGES:N${SYSINSTLANG}}
    204 sysinstmsgs.${LANG}: msg.mi.${LANG} ${MSG_MD:S/.${SYSINSTLANG}$/.${LANG}/} msgtouch msg_defs.h sysinstmsgs.fmtcnt
    205 	${_MKTARGET_CREATE}
    206 	${TOOL_SED} "s/@@VERSION@@/${DISTRIBVER}/" ${.ALLSRC:M*.${LANG}} | \
    207 	${TOOL_SED} "s/@@MACHINE@@/${MACHINE}/" | \
    208 	${TOOL_AWK} -f ${UNIF_AWK} -v defines="${MD_OPTIONS}" | \
    209 	${HOST_SH} ${MSG_XLAT_SH} -f sysinstmsgs.fmtcnt > ${.TARGET}
    210 
    211 DPSRCS+=	sysinstmsgs.${LANG}
    212 # FILES+=		sysinstmsgs.${LANG}
    213 # FILESDIR_sysinstmsgs.${LANG}=	${CATALOGDIR}
    214 .endfor
    215 
    216 .include <bsd.prog.mk>
    217