Makefile.inc revision 1.17 1 # $NetBSD: Makefile.inc,v 1.17 2019/02/04 10:22:15 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
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) || defined(HAVE_PCC)
108 COPTS.label.c+= -Wno-pointer-sign
109 .endif
110 COPTS.main.c += -Wno-format-nonliteral
111 COPTS.disks.c += -Wno-format-nonliteral
112 COPTS.util.c += -Wno-format-nonliteral
113 COPTS.label.c += -Wno-format-nonliteral
114 COPTS.target.c += -Wno-format-nonliteral
115 COPTS.mbr.c += -Wno-format-nonliteral
116 COPTS.msg_defs.c += -Wno-format-nonliteral
117 COPTS.bsddisklabel.c += -Wno-format-nonliteral
118 COPTS.md.c += -Wno-format-nonliteral
119 COPTS.partman.c += -Wno-format-nonliteral -Wno-stack-protector
120
121 # Lots of warnings
122 .if defined(HAVE_GCC) && ${HAVE_GCC} == 7 && ${ACTIVE_CC} == "gcc"
123 COPTS.partman.c+= -Wno-error=format-truncation
124 .endif
125
126 # Host to ftp from. Default:
127 # "ftp.NetBSD.org"
128 #
129 .if defined(SYSINST_FTP_HOST)
130 CPPFLAGS+= -DSYSINST_FTP_HOST=\"${SYSINST_FTP_HOST}\"
131 .endif
132
133 # Top-level ftp directory. Default:
134 # "pub/NetBSD/NetBSD-" + VER + "/" + MACH
135 #
136 .if defined(SYSINST_FTP_DIR)
137 CPPFLAGS+= -DSYSINST_FTP_DIR=\"${SYSINST_FTP_DIR}\"
138 .endif
139
140 # Top-level CDROM directory. Default:
141 # "/" + MACH
142 #
143 .if defined(SYSINST_CDROM_DIR)
144 CPPFLAGS+= -DSYSINST_CDROM_DIR=\"${SYSINST_CDROM_DIR}\"
145 .endif
146
147
148 DPSRCS+= msg_defs.h menu_defs.h
149
150 CLEANFILES= menu_defs.c menu_defs.h menus.def \
151 msg_defs.c msg_defs.h msg.def msgtouch \
152 sysinstmsgs.*
153
154 .PATH: ${.CURDIR}/../..
155
156 menu_defs.h: menu_defs.c
157 [ -f ${.TARGET} ] || { \
158 ${_MKSHTARGET_CREATE}; \
159 ${TOOL_MENUC} menus.def; \
160 }
161 menu_defs.c: menus.def
162 ${_MKTARGET_CREATE}
163 [ ! -f menu_defs.h ] || mv -f menu_defs.h menu_defs.oh
164 ${TOOL_MENUC} menus.def
165 ! cmp -s menu_defs.oh menu_defs.h || mv -f menu_defs.oh menu_defs.h
166 @rm -f menu_defs.oh
167
168 msg_defs.h: msg_defs.c
169 [ -f ${.TARGET} ] || { \
170 ${_MKSHTARGET_CREATE}; \
171 ${TOOL_MSGC} msg.def; \
172 }
173 msg_defs.c: msg.def
174 ${_MKTARGET_CREATE}
175 [ ! -f msg_defs.h ] || mv -f msg_defs.h msg_defs.oh
176 ${TOOL_MSGC} msg.def
177 ! cmp -s msg_defs.oh msg_defs.h || mv -f msg_defs.oh msg_defs.h
178 @rm -f msg_defs.oh
179
180 # Needed to get proper dependency checks on osrelease
181 msgtouch: ${DISTRIBVERDEP}
182 touch ${.TARGET}
183
184 msg.def: msg.mi.${SYSINSTLANG} ${MSG_MD} msgtouch
185 ${_MKTARGET_CREATE}
186 ${TOOL_SED} "s/@@VERSION@@/${DISTRIBVER}/" ${.ALLSRC} | \
187 ${TOOL_SED} "s/@@MACHINE@@/${MACHINE}/" | \
188 ${TOOL_AWK} -f ${UNIF_AWK} -v defines="${MD_OPTIONS}" > ${.TARGET}
189
190 menus.def: ${MENUS_MI} ${MENUS_MD} msgtouch
191 ${_MKTARGET_CREATE}
192 ${TOOL_SED} "s/@@VERSION@@/${DISTRIBVER}/" ${.ALLSRC} | \
193 ${TOOL_SED} "s/@@MACHINE@@/${MACHINE}/" | \
194 ${TOOL_AWK} -f ${UNIF_AWK} -v defines="${MD_OPTIONS}" > ${.TARGET}
195
196 sysinstmsgs.fmtcnt: msg.mi.${SYSINSTLANG} ${MSG_MD} msgtouch msg_defs.h
197 ${_MKTARGET_CREATE}
198 ${TOOL_SED} "s/@@VERSION@@/${DISTRIBVER}/" \
199 ${.ALLSRC:M*.${SYSINSTLANG}} | \
200 ${TOOL_SED} "s/@@MACHINE@@/${MACHINE}/" | \
201 ${TOOL_AWK} -f ${UNIF_AWK} -v defines="${MD_OPTIONS}" | \
202 ${HOST_SH} ${MSG_XLAT_SH} -c > ${.TARGET}
203
204 .for LANG in ${LANGUAGES:N${SYSINSTLANG}}
205 sysinstmsgs.${LANG}: msg.mi.${LANG} ${MSG_MD:S/.${SYSINSTLANG}$/.${LANG}/} msgtouch msg_defs.h sysinstmsgs.fmtcnt
206 ${_MKTARGET_CREATE}
207 ${TOOL_SED} "s/@@VERSION@@/${DISTRIBVER}/" ${.ALLSRC:M*.${LANG}} | \
208 ${TOOL_SED} "s/@@MACHINE@@/${MACHINE}/" | \
209 ${TOOL_AWK} -f ${UNIF_AWK} -v defines="${MD_OPTIONS}" | \
210 ${HOST_SH} ${MSG_XLAT_SH} -f sysinstmsgs.fmtcnt > ${.TARGET}
211
212 DPSRCS+= sysinstmsgs.${LANG}
213 # FILES+= sysinstmsgs.${LANG}
214 # FILESDIR_sysinstmsgs.${LANG}= ${CATALOGDIR}
215 .endfor
216
217 .include <bsd.prog.mk>
218