Makefile.inc revision 1.4 1 # $NetBSD: Makefile.inc,v 1.4 2014/08/05 18:46:04 martin Exp $
2 #
3 # Makefile for sysinst
4
5 .if exists(${.CURDIR}/../../../Makefile.inc)
6 .include "${.CURDIR}/../../../Makefile.inc"
7 .endif
8
9 .if empty(DBG:M-g)
10 COPTS += -Os
11 .endif
12
13 PROG= sysinst
14 NOMAN= # defined
15
16 WARNS= 4
17
18 SRCS+= menu_defs.c msg_defs.c main.c install.c upgrade.c \
19 txtwalk.c run.c factor.c net.c disks.c disks_lfs.c util.c geom.c \
20 label.c target.c md.c sizemultname.c configmenu.c checkrc.c partman.c
21
22 SRCS+= ${MD_OPTIONS:MAOUT2ELF:S/AOUT2ELF/aout2elf.c/}
23 SRCS+= ${MENUS_MD:Mmenus.mbr:S/menus.mbr/mbr.c/}
24 SRCS+= ${CPPFLAGS:M-DWSKBD:S/-DWSKBD/wskbd.c/}
25 SRCS+= ${NODISKLABEL:D:Ubsddisklabel.c savenewlabel.c}
26
27 DPSRCS+= defs.h
28
29 SYSINSTLANG?= en
30 LANGUAGES?= de en es fr pl
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 CATALOGDIR= /usr/share/sysinst/catalog
51 CPPFLAGS+= -I. -I${.CURDIR}/../.. -I${.CURDIR} \
52 -DREL=\"${DISTRIBVER}\" -DMACH=\"${MACHINE}\" \
53 -DMACH_${MACHINE} -DARCH_${MACHINE_ARCH} \
54 ${NODISKLABEL:D-DNO_DISKLABEL} \
55 -DCATALOG_DIR=\"${CATALOGDIR}\"
56
57 .if (defined(DEBUG))
58 CPPFLAGS+=-DDEBUG -g -O0
59 .endif
60
61 .if (!defined(SMALLPROG) || defined(SMALLPROG_INET6)) && (${USE_INET6} != "no")
62 CPPFLAGS+=-DINET6
63 .endif
64
65 .if defined(HAVE_GCC) || defined(HAVE_PCC)
66 COPTS.label.c+= -Wno-pointer-sign
67 .endif
68 COPTS.main.c += -Wno-format-nonliteral
69 COPTS.disks.c += -Wno-format-nonliteral
70 COPTS.util.c += -Wno-format-nonliteral
71 COPTS.label.c += -Wno-format-nonliteral
72 COPTS.target.c += -Wno-format-nonliteral
73 COPTS.mbr.c += -Wno-format-nonliteral
74 COPTS.msg_defs.c += -Wno-format-nonliteral
75 COPTS.bsddisklabel.c += -Wno-format-nonliteral
76 COPTS.md.c += -Wno-format-nonliteral
77 COPTS.partman.c += -Wno-format-nonliteral
78
79 # Host to ftp from. Default:
80 # "ftp.NetBSD.org"
81 #
82 .if defined(SYSINST_FTP_HOST)
83 CPPFLAGS+= -DSYSINST_FTP_HOST=\"${SYSINST_FTP_HOST}\"
84 .endif
85
86 # Top-level ftp directory. Default:
87 # "pub/NetBSD/NetBSD-" + VER + "/" + MACH
88 #
89 .if defined(SYSINST_FTP_DIR)
90 CPPFLAGS+= -DSYSINST_FTP_DIR=\"${SYSINST_FTP_DIR}\"
91 .endif
92
93 # Top-level CDROM directory. Default:
94 # "/" + MACH
95 #
96 .if defined(SYSINST_CDROM_DIR)
97 CPPFLAGS+= -DSYSINST_CDROM_DIR=\"${SYSINST_CDROM_DIR}\"
98 .endif
99
100
101 DPSRCS+= msg_defs.h menu_defs.h
102
103 CLEANFILES= menu_defs.c menu_defs.h menus.def \
104 msg_defs.c msg_defs.h msg.def msgtouch \
105 sysinstmsgs.*
106
107 .PATH: ${.CURDIR}/../..
108
109 menu_defs.h: menu_defs.c
110 [ -f ${.TARGET} ] || { \
111 ${_MKSHTARGET_CREATE}; \
112 ${TOOL_MENUC} menus.def; \
113 }
114 menu_defs.c: menus.def
115 ${_MKTARGET_CREATE}
116 [ ! -f menu_defs.h ] || mv -f menu_defs.h menu_defs.oh
117 ${TOOL_MENUC} menus.def
118 ! cmp -s menu_defs.oh menu_defs.h || mv -f menu_defs.oh menu_defs.h
119 @rm -f menu_defs.oh
120
121 msg_defs.h: msg_defs.c
122 [ -f ${.TARGET} ] || { \
123 ${_MKSHTARGET_CREATE}; \
124 ${TOOL_MSGC} msg.def; \
125 }
126 msg_defs.c: msg.def
127 ${_MKTARGET_CREATE}
128 [ ! -f msg_defs.h ] || mv -f msg_defs.h msg_defs.oh
129 ${TOOL_MSGC} msg.def
130 ! cmp -s msg_defs.oh msg_defs.h || mv -f msg_defs.oh msg_defs.h
131 @rm -f msg_defs.oh
132
133 # Needed to get proper dependency checks on osrelease
134 msgtouch: ${DISTRIBVERDEP}
135 touch ${.TARGET}
136
137 msg.def: msg.mi.${SYSINSTLANG} ${MSG_MD} msgtouch
138 ${_MKTARGET_CREATE}
139 ${TOOL_SED} "s/@@VERSION@@/${DISTRIBVER}/" ${.ALLSRC} | \
140 ${TOOL_SED} "s/@@MACHINE@@/${MACHINE}/" | \
141 ${TOOL_AWK} -f ${UNIF_AWK} -v defines="${MD_OPTIONS}" > ${.TARGET}
142
143 menus.def: menus.mi ${MENUS_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 sysinstmsgs.fmtcnt: msg.mi.${SYSINSTLANG} ${MSG_MD} msgtouch msg_defs.h
150 ${_MKTARGET_CREATE}
151 ${TOOL_SED} "s/@@VERSION@@/${DISTRIBVER}/" \
152 ${.ALLSRC:M*.${SYSINSTLANG}} | \
153 ${TOOL_SED} "s/@@MACHINE@@/${MACHINE}/" | \
154 ${TOOL_AWK} -f ${UNIF_AWK} -v defines="${MD_OPTIONS}" | \
155 ${HOST_SH} ${MSG_XLAT_SH} -c > ${.TARGET}
156
157 .for LANG in ${LANGUAGES:N${SYSINSTLANG}}
158 sysinstmsgs.${LANG}: msg.mi.${LANG} ${MSG_MD:S/.${SYSINSTLANG}$/.${LANG}/} msgtouch msg_defs.h sysinstmsgs.fmtcnt
159 ${_MKTARGET_CREATE}
160 ${TOOL_SED} "s/@@VERSION@@/${DISTRIBVER}/" ${.ALLSRC:M*.${LANG}} | \
161 ${TOOL_SED} "s/@@MACHINE@@/${MACHINE}/" | \
162 ${TOOL_AWK} -f ${UNIF_AWK} -v defines="${MD_OPTIONS}" | \
163 ${HOST_SH} ${MSG_XLAT_SH} -f sysinstmsgs.fmtcnt > ${.TARGET}
164
165 DPSRCS+= sysinstmsgs.${LANG}
166 FILES+= sysinstmsgs.${LANG}
167 FILESDIR_sysinstmsgs.${LANG}= ${CATALOGDIR}
168 .endfor
169
170 .include <bsd.prog.mk>
171