Makefile.inc revision 1.28 1 # $NetBSD: Makefile.inc,v 1.28 2019/10/31 09:44:13 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
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 ${RELEASEMACHINEDIR} != ${MACHINE}
78 CPPFLAGS+= -DARCH_SUBDIR="\"${RELEASEMACHINEDIR}\""
79 CPPFLAGS+= -DPKG_ARCH_SUBDIR="\"${MACHINE_ARCH}\""
80 .endif
81
82 .if defined(NETBSD_OFFICIAL_RELEASE) && ${NETBSD_OFFICIAL_RELEASE} == "yes"
83 CPPFLAGS+= -DSYSINST_FTP_HOST=\"ftp.NetBSD.org\" -DNETBSD_OFFICIAL_RELEASE
84 CPPFLAGS+= -DSYSINST_HTTP_HOST=\"cdn.NetBSD.org\" -DNETBSD_OFFICIAL_RELEASE
85 .else
86 CPPFLAGS+= -DSYSINST_FTP_HOST=\"nyftp.NetBSD.org\"
87 CPPFLAGS+= -DSYSINST_HTTP_HOST=\"nycdn.NetBSD.org\"
88 .if (${DISTRIBVER:M*.99.*})
89 CPPFLAGS+= -DREL_PATH=\"HEAD\"
90 CPPFLAGS+= -DPKG_SUBDIR="\"${DISTRIBVER:C/\.99\.[0-9]*[_A-Z]*$//}.0\""
91 .elif (${DISTRIBVER:M*.[0-9].[0-9]*})
92 CPPFLAGS+= -DREL_PATH=\"netbsd-${DISTRIBVER:C/\.[0-9][_A-Z]*$//:S/./-/}\"
93 CPPFLAGS+= -DPKG_SUBDIR="\"${DISTRIBVER:C/_.*$//}\""
94 .elif (${DISTRIBVER:M*.[0-9]*})
95 CPPFLAGS+= -DREL_PATH=\"netbsd-${DISTRIBVER:C/\.[0-9][_A-Z]*$//}\"
96 CPPFLAGS+= -DPKG_SUBDIR="\"${DISTRIBVER:C/_.*$//}\""
97 .endif
98 .endif
99 CPPFLAGS+= -DNETBSD_MAJOR='"${DISTRIBVER:C/\..*//}"'
100
101 .if !defined(DEBUG)
102 CPPFLAGS+= -DCATALOG_DIR=\"${CATALOGDIR}\"
103 .endif
104
105 .if (defined(DEBUG))
106 .if ${ACTIVE_CC} == "gcc"
107 # make gcc run additional passes for better debug info (only needed
108 # when compiling with -O0)
109 O0TRACKING= -fvar-tracking-assignments -fvar-tracking
110 .endif
111 CPPFLAGS+=-DDEBUG
112 DBG +=-g -O0 ${O0TRACKING}
113 .endif
114
115 .if empty(DBG:M-g)
116 COPTS += -Os
117 .endif
118
119 .if (!defined(SMALLPROG) || defined(SMALLPROG_INET6)) && (${USE_INET6} != "no")
120 CPPFLAGS+=-DINET6
121 .endif
122
123 COPTS+= ${GCC_NO_FORMAT_TRUNCATION}
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 .if !defined(NOPARTMAN)
184 MSG_MD+= msg.pm.${SYSINSTLANG}
185 .endif
186
187 msg.def: msg.mi.${SYSINSTLANG} ${MSG_MD} msgtouch
188 ${_MKTARGET_CREATE}
189 ${TOOL_SED} "s/@@VERSION@@/${DISTRIBVER}/" ${.ALLSRC} | \
190 ${TOOL_SED} "s/@@MACHINE@@/${MACHINE}/" | \
191 ${TOOL_AWK} -f ${UNIF_AWK} -v defines="${MD_OPTIONS}" > ${.TARGET}
192
193 menus.def: ${MENUS_MI} ${MENUS_MD} msgtouch
194 ${_MKTARGET_CREATE}
195 ${TOOL_SED} "s/@@VERSION@@/${DISTRIBVER}/" ${.ALLSRC} | \
196 ${TOOL_SED} "s/@@MACHINE@@/${MACHINE}/" | \
197 ${TOOL_AWK} -f ${UNIF_AWK} -v defines="${MD_OPTIONS}" > ${.TARGET}
198
199 sysinstmsgs.fmtcnt: msg.mi.${SYSINSTLANG} ${MSG_MD} msgtouch msg_defs.h
200 ${_MKTARGET_CREATE}
201 ${TOOL_SED} "s/@@VERSION@@/${DISTRIBVER}/" \
202 ${.ALLSRC:M*.${SYSINSTLANG}} | \
203 ${TOOL_SED} "s/@@MACHINE@@/${MACHINE}/" | \
204 ${TOOL_AWK} -f ${UNIF_AWK} -v defines="${MD_OPTIONS}" | \
205 ${HOST_SH} ${MSG_XLAT_SH} -c > ${.TARGET}
206
207 .for LANG in ${LANGUAGES:N${SYSINSTLANG}}
208 sysinstmsgs.${LANG}: msg.mi.${LANG} ${MSG_MD:S/.${SYSINSTLANG}$/.${LANG}/} msgtouch msg_defs.h sysinstmsgs.fmtcnt
209 ${_MKTARGET_CREATE}
210 ${TOOL_SED} "s/@@VERSION@@/${DISTRIBVER}/" ${.ALLSRC:M*.${LANG}} | \
211 ${TOOL_SED} "s/@@MACHINE@@/${MACHINE}/" | \
212 ${TOOL_AWK} -f ${UNIF_AWK} -v defines="${MD_OPTIONS}" | \
213 ${HOST_SH} ${MSG_XLAT_SH} -f sysinstmsgs.fmtcnt > ${.TARGET}
214
215 DPSRCS+= sysinstmsgs.${LANG}
216 # FILES+= sysinstmsgs.${LANG}
217 # FILESDIR_sysinstmsgs.${LANG}= ${CATALOGDIR}
218 .endfor
219
220 .PHONY: check-lang
221 check-lang: msg.def msg_defs.h
222 ${_MKTARGET_CREATE}
223 ${TOOL_SED} "s/@@VERSION@@/${DISTRIBVER}/" msg.def | \
224 ${TOOL_SED} "s/@@MACHINE@@/${MACHINE}/" | \
225 ${TOOL_AWK} -f ${UNIF_AWK} -v defines="${MD_OPTIONS}" | \
226 ${HOST_SH} ${MSG_XLAT_SH} -i > /tmp/sysinst.en
227 ${HOST_SH} ${MSG_CMP_SH} msg_defs.h /tmp/sysinst.en sysinstmsgs.${LANG}
228 @rm /tmp/sysinst.en
229
230 .include <bsd.prog.mk>
231