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