1# $FreeBSD$
2
3.if ${MACHINE_CPUARCH} != "ia64"
4_wizard=	wizard.c
5.endif
6
7PROG=	sysinstall
8MAN=	sysinstall.8
9SRCS=	anonFTP.c cdrom.c command.c config.c devices.c dhcp.c \
10	disks.c dispatch.c dist.c dmenu.c doc.c dos.c floppy.c \
11	ftp.c globals.c http.c httpdirect.c index.c install.c \
12	installUpgrade.c keymap.c label.c main.c makedevs.c media.c menus.c \
13	misc.c modules.c mouse.c msg.c network.c nfs.c options.c package.c \
14	system.c tcpip.c termcap.c ttys.c ufs.c usb.c user.c \
15	variable.c ${_wizard} keymap.h countries.h
16
17CFLAGS+= -DUSE_GZIP=1 
18.if ${MACHINE} == "pc98"
19CFLAGS+= -DPC98
20.endif
21CFLAGS+= -I${.CURDIR}/../../gnu/lib/libodialog -I.
22
23WARNS?=  2	
24
25DPADD=	${LIBODIALOG} ${LIBNCURSES} ${LIBUTIL} ${LIBDISK} ${LIBFTPIO}
26LDADD=	-lodialog -lncurses -lutil -ldisk -lftpio
27
28CLEANFILES=	makedevs.c rtermcap
29CLEANFILES+=	keymap.tmp keymap.h countries.tmp countries.h
30
31.if exists(${.CURDIR}/../../share/termcap/termcap.src)
32RTERMCAP=	TERMCAP=${.CURDIR}/../../share/termcap/termcap.src ./rtermcap
33.else
34RTERMCAP=	./rtermcap
35.endif
36
37makedevs.c:	Makefile rtermcap
38	echo '#include <sys/types.h>' > makedevs.c
39	${RTERMCAP} ansi | \
40		file2c 'const char termcap_ansi[] = {' ',0};' \
41		>> makedevs.c
42	${RTERMCAP} cons25w | \
43		file2c 'const char termcap_cons25w[] = {' ',0};' \
44		>> makedevs.c
45	${RTERMCAP} cons25 | \
46		file2c 'const char termcap_cons25[] = {' ',0};' \
47		>> makedevs.c
48	${RTERMCAP} cons25-m | \
49		file2c 'const char termcap_cons25_m[] = {' ',0};' \
50		>> makedevs.c
51	${RTERMCAP} cons25r | \
52		file2c 'const char termcap_cons25r[] = {' ',0};' \
53		>> makedevs.c
54	${RTERMCAP} cons25r-m | \
55		file2c 'const char termcap_cons25r_m[] = {' ',0};' \
56		>> makedevs.c
57	${RTERMCAP} cons25l1 | \
58		file2c 'const char termcap_cons25l1[] = {' ',0};' \
59		>> makedevs.c
60	${RTERMCAP} cons25l1-m | \
61		file2c 'const char termcap_cons25l1_m[] = {' ',0};' \
62		>> makedevs.c
63	${RTERMCAP} vt100 | \
64		file2c 'const char termcap_vt100[] = {' ',0};' \
65		>> makedevs.c
66	${RTERMCAP} xterm | \
67		file2c 'const char termcap_xterm[] = {' ',0};' \
68		>> makedevs.c
69
70build-tools:	rtermcap
71
72rtermcap:	rtermcap.c
73	${CC} -o ${.TARGET} ${.ALLSRC} -ltermcap
74
75.if ${MACHINE} == "pc98"
76KEYMAPS= jp.pc98 jp.pc98.iso
77.else
78KEYMAPS= be.iso bg.bds.ctrlcaps bg.phonetic.ctrlcaps br275.iso \
79	ce.iso2 cs.latin2.qwertz danish.iso el.iso07 \
80	estonian.cp850 estonian.iso estonian.iso15 finnish.iso fr.iso \
81	german.iso gr.elot.acc gr.us101.acc  hr.iso hu.iso2.101keys \
82	it.iso icelandic.iso jp.106 latinamerican latinamerican.iso.acc \
83	norwegian.iso pl_PL.ISO8859-2 \
84	pt.iso ru.koi8-r si.iso sk.iso2 spanish.iso spanish.iso.acc swedish.iso \
85	swissfrench.iso \
86	swissgerman.iso ua.koi8-u ua.koi8-u.shift.alt uk.iso us.dvorak \
87	us.iso us.pc-ctrl us.unix
88.endif
89
90keymap.h:
91	rm -f keymap.tmp
92	for map in ${KEYMAPS} ; do \
93		KEYMAP_PATH=${.CURDIR}/../../share/syscons/keymaps \
94			kbdcontrol -L $$map | \
95			sed -e '/^static accentmap_t/,$$d' >> keymap.tmp ; \
96	done
97	echo "static struct keymapInfo keymapInfos[] = {" >> keymap.tmp
98	for map in ${KEYMAPS} ; do \
99		echo -n '	{ "'$$map'", ' >> keymap.tmp ; \
100		echo "&keymap_$$map }," | tr '[-.]' '_' >> keymap.tmp ; \
101	done
102	( echo "	{ NULL, NULL }"; echo "};" ; echo "" ) >> keymap.tmp
103	mv keymap.tmp keymap.h
104
105countries.h: ${.CURDIR}/../../share/misc/iso3166
106	rm -f countries.tmp
107	awk 'BEGIN { \
108	    FS = "\t"; \
109	    num = 1; \
110	    print "DMenu MenuCountry = {"; \
111	    print "    DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,"; \
112	    print "    \"Country Selection\","; \
113	    print "    \"Please choose a country, region, or group.\\n\""; \
114	    print "    \"Select an item using [SPACE] or [ENTER].\","; \
115	    printf "    NULL,\n    NULL,\n    { "; \
116	} \
117	/^[[:space:]]*#/ {next;} \
118	{if (num > 1) {printf "      ";} \
119	    print "{ \"" num "\", \"" $$4 "\"" \
120	    ", dmenuVarCheck, dmenuSetCountryVariable" \
121	    ", NULL, VAR_COUNTRY \"=" tolower($$1) "\" },"; \
122	    ++num;} \
123	END {print "      { NULL } }\n};\n";}' < ${.ALLSRC} > countries.tmp
124	mv countries.tmp ${.TARGET}
125
126.include <bsd.prog.mk>
127