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