Makefile.inc revision 1.7 1 # $NetBSD: Makefile.inc,v 1.7 2015/05/10 09:13:15 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 partman.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
23 DPSRCS+= defs.h
24
25 SYSINSTLANG?= en
26 LANGUAGES?= de en es fr pl
27
28 MSG_MD?= msg.md.${SYSINSTLANG}
29 MENUS_MD?= menus.md.${SYSINSTLANG}
30
31 .include <bsd.own.mk> # for mk.conf
32 #.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
33
34 DISTRIBVER!= ${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh
35 DISTRIBVERDEP= ${NETBSDSRCDIR}/sys/sys/param.h \
36 ${NETBSDSRCDIR}/sys/conf/osrelease.sh
37
38 _MKSHTARGET_CREATE?= ${_MKSHMSG_CREATE} ${.CURDIR:T}/${.TARGET}
39
40 DPADD= ${LIBCURSES} ${LIBTERMLIB} ${LIBUTIL}
41 LDADD= -lcurses -ltermlib -lutil
42
43 UNIF_AWK= ${.CURDIR}/../../unif.awk
44 MSG_XLAT_SH= ${.CURDIR}/../../msg_xlat.sh
45
46 CATALOGDIR= /usr/share/sysinst/catalog
47 CPPFLAGS+= -I. -I${.CURDIR}/../.. -I${.CURDIR} \
48 -DREL=\"${DISTRIBVER}\" -DMACH=\"${MACHINE}\" \
49 -DMACH_${MACHINE} -DARCH_${MACHINE_ARCH} \
50 ${NODISKLABEL:D-DNO_DISKLABEL} \
51 -DCATALOG_DIR=\"${CATALOGDIR}\"
52
53 .if (defined(DEBUG))
54 .if ${ACTIVE_CC} == "gcc"
55 # make gcc run additional passes for better debug info (only needed
56 # when compiling with -O0)
57 O0TRACKING= -fvar-tracking-assignments -fvar-tracking
58 .endif
59 CPPFLAGS+=-DDEBUG
60 DBG +=-g -O0 ${O0TRACKING}
61 .endif
62
63 .if empty(DBG:M-g)
64 COPTS += -Os
65 .endif
66
67 .if (!defined(SMALLPROG) || defined(SMALLPROG_INET6)) && (${USE_INET6} != "no")
68 CPPFLAGS+=-DINET6
69 .endif
70
71 .if defined(HAVE_GCC) || defined(HAVE_PCC)
72 COPTS.label.c+= -Wno-pointer-sign
73 .endif
74 COPTS.main.c += -Wno-format-nonliteral
75 COPTS.disks.c += -Wno-format-nonliteral
76 COPTS.util.c += -Wno-format-nonliteral
77 COPTS.label.c += -Wno-format-nonliteral
78 COPTS.target.c += -Wno-format-nonliteral
79 COPTS.mbr.c += -Wno-format-nonliteral
80 COPTS.msg_defs.c += -Wno-format-nonliteral
81 COPTS.bsddisklabel.c += -Wno-format-nonliteral
82 COPTS.md.c += -Wno-format-nonliteral
83 COPTS.partman.c += -Wno-format-nonliteral
84
85 # Host to ftp from. Default:
86 # "ftp.NetBSD.org"
87 #
88 .if defined(SYSINST_FTP_HOST)
89 CPPFLAGS+= -DSYSINST_FTP_HOST=\"${SYSINST_FTP_HOST}\"
90 .endif
91
92 # Top-level ftp directory. Default:
93 # "pub/NetBSD/NetBSD-" + VER + "/" + MACH
94 #
95 .if defined(SYSINST_FTP_DIR)
96 CPPFLAGS+= -DSYSINST_FTP_DIR=\"${SYSINST_FTP_DIR}\"
97 .endif
98
99 # Top-level CDROM directory. Default:
100 # "/" + MACH
101 #
102 .if defined(SYSINST_CDROM_DIR)
103 CPPFLAGS+= -DSYSINST_CDROM_DIR=\"${SYSINST_CDROM_DIR}\"
104 .endif
105
106
107 DPSRCS+= msg_defs.h menu_defs.h
108
109 CLEANFILES= menu_defs.c menu_defs.h menus.def \
110 msg_defs.c msg_defs.h msg.def msgtouch \
111 sysinstmsgs.*
112
113 .PATH: ${.CURDIR}/../..
114
115 menu_defs.h: menu_defs.c
116 [ -f ${.TARGET} ] || { \
117 ${_MKSHTARGET_CREATE}; \
118 ${TOOL_MENUC} menus.def; \
119 }
120 menu_defs.c: menus.def
121 ${_MKTARGET_CREATE}
122 [ ! -f menu_defs.h ] || mv -f menu_defs.h menu_defs.oh
123 ${TOOL_MENUC} menus.def
124 ! cmp -s menu_defs.oh menu_defs.h || mv -f menu_defs.oh menu_defs.h
125 @rm -f menu_defs.oh
126
127 msg_defs.h: msg_defs.c
128 [ -f ${.TARGET} ] || { \
129 ${_MKSHTARGET_CREATE}; \
130 ${TOOL_MSGC} msg.def; \
131 }
132 msg_defs.c: msg.def
133 ${_MKTARGET_CREATE}
134 [ ! -f msg_defs.h ] || mv -f msg_defs.h msg_defs.oh
135 ${TOOL_MSGC} msg.def
136 ! cmp -s msg_defs.oh msg_defs.h || mv -f msg_defs.oh msg_defs.h
137 @rm -f msg_defs.oh
138
139 # Needed to get proper dependency checks on osrelease
140 msgtouch: ${DISTRIBVERDEP}
141 touch ${.TARGET}
142
143 msg.def: msg.mi.${SYSINSTLANG} ${MSG_MD} msgtouch
144 ${_MKTARGET_CREATE}
145 ${TOOL_SED} "s/@@VERSION@@/${DISTRIBVER}/" ${.ALLSRC} | \
146 ${TOOL_SED} "s/@@MACHINE@@/${MACHINE}/" | \
147 ${TOOL_AWK} -f ${UNIF_AWK} -v defines="${MD_OPTIONS}" > ${.TARGET}
148
149 menus.def: menus.mi ${MENUS_MD} msgtouch
150 ${_MKTARGET_CREATE}
151 ${TOOL_SED} "s/@@VERSION@@/${DISTRIBVER}/" ${.ALLSRC} | \
152 ${TOOL_SED} "s/@@MACHINE@@/${MACHINE}/" | \
153 ${TOOL_AWK} -f ${UNIF_AWK} -v defines="${MD_OPTIONS}" > ${.TARGET}
154
155 sysinstmsgs.fmtcnt: msg.mi.${SYSINSTLANG} ${MSG_MD} msgtouch msg_defs.h
156 ${_MKTARGET_CREATE}
157 ${TOOL_SED} "s/@@VERSION@@/${DISTRIBVER}/" \
158 ${.ALLSRC:M*.${SYSINSTLANG}} | \
159 ${TOOL_SED} "s/@@MACHINE@@/${MACHINE}/" | \
160 ${TOOL_AWK} -f ${UNIF_AWK} -v defines="${MD_OPTIONS}" | \
161 ${HOST_SH} ${MSG_XLAT_SH} -c > ${.TARGET}
162
163 .for LANG in ${LANGUAGES:N${SYSINSTLANG}}
164 sysinstmsgs.${LANG}: msg.mi.${LANG} ${MSG_MD:S/.${SYSINSTLANG}$/.${LANG}/} msgtouch msg_defs.h sysinstmsgs.fmtcnt
165 ${_MKTARGET_CREATE}
166 ${TOOL_SED} "s/@@VERSION@@/${DISTRIBVER}/" ${.ALLSRC:M*.${LANG}} | \
167 ${TOOL_SED} "s/@@MACHINE@@/${MACHINE}/" | \
168 ${TOOL_AWK} -f ${UNIF_AWK} -v defines="${MD_OPTIONS}" | \
169 ${HOST_SH} ${MSG_XLAT_SH} -f sysinstmsgs.fmtcnt > ${.TARGET}
170
171 DPSRCS+= sysinstmsgs.${LANG}
172 # FILES+= sysinstmsgs.${LANG}
173 # FILESDIR_sysinstmsgs.${LANG}= ${CATALOGDIR}
174 .endfor
175
176 .include <bsd.prog.mk>
177