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