xref: /freebsd/usr.bin/gh-bc/Makefile (revision 957a8d7e748fde5aa24b094eda1afaa12dbe2c4d)
1# $FreeBSD$
2
3.include <src.opts.mk>
4
5PROG=		gh-bc
6PROGNAME=	bc
7
8BCDIR=		${SRCTOP}/contrib/${PROGNAME}
9BCVERSION!=	sed -n -e '/.*VERSION *= *[0-9]/s/.*VERSION *= *//p' ${BCDIR}/Makefile.in
10
11SRCS=		args.c data.c file.c lang.c lex.c main.c num.c parse.c program.c read.c vector.c vm.c
12SRCS+=		bc/bc.c bc/lex.c bc/parse.c dc/dc.c dc/lex.c dc/parse.c history/history.c
13SRCS+=		bc_help.c dc_help.c lib.c lib2.c opt.c rand/rand.c
14MAN=		bc.1 dc.1
15
16LINKS=		${BINDIR}/bc ${BINDIR}/dc
17
18.PATH:		${BCDIR}/src ${BCDIR}/gen ${BCDIR}/manuals ${.OBJDIR}
19
20CATALOGS=	en_US.UTF-8
21CATALOGS+=	de_DE.UTF-8 de_DE.ISO8859-1
22CATALOGS+=	fr_FR.UTF-8 fr_FR.ISO8859-1
23CATALOGS+=	ja_JP.UTF-8 ja_JP.eucJP
24CATALOGS+=	nl_NL.UTF-8 nl_NL.ISO8859-1
25CATALOGS+=	pl_PL.UTF-8 pl_PL.ISO8859-2
26CATALOGS+=	pt_PT.UTF-8 pt_PT.ISO8859-1
27CATALOGS+=	ru_RU.UTF-8 ru_RU.ISO8859-5 ru_RU.CP1251 ru_RU.CP866 ru_RU.KOI8-R
28CATALOGS+=	zh_CN.UTF-8 zh_CN.eucCN zh_CN.GB18030 zh_CN.GB2312 zh_CN.GBK
29
30NLSNAME=	bc
31NLSSRCDIR=	${BCDIR}/locales
32
33CFLAGS+=	-DMAINEXEC=${PROGNAME}
34CFLAGS+=	-DNLSPATH=/usr/share/nls/%L/%N.cat
35CFLAGS+=	-DBC_ENABLED
36CFLAGS+=	-DBC_ENABLE_PROMPT
37CFLAGS+=	-DBC_ENABLE_LONG_OPTIONS
38CFLAGS+=	-DBC_ENABLE_EXTRA_MATH
39CFLAGS+=	-DBC_ENABLE_HISTORY
40CFLAGS+=	-DBC_ENABLE_SIGNALS=0
41CFLAGS+=	-DBC_NUM_KARATSUBA_LEN=64
42CFLAGS+=	-DDC_ENABLED
43CFLAGS+=	-DNDEBUG
44CFLAGS+=	-DVERSION=${BCVERSION}
45CFLAGS+=	-I${BCDIR}/include
46
47.if ${MK_NLS_CATALOGS} == "no"
48CFLAGS+=	-DBC_ENABLE_NLS=0
49.else
50CFLAGS+=	-DBC_ENABLE_NLS=1
51
52# prevent floating point incompatibilities caused by -flto on some architectures
53.if ${MACHINE_ARCH} != mips && ${MACHINE_ARCH} != mips64 && \
54    ${MACHINE_ARCH} != powerpc64 && ${MACHINE_ARCH} != riscv64
55CFLAGS+=	-flto
56.endif
57
58.for catalog in ${CATALOGS}
59NLS+=           ${catalog:C/.*://}
60NLSSRCFILES_${catalog:C/.*://}= ${catalog:C/.*://}.msg
61.endfor
62
63NLSLINKS_en_US.UTF-8+=	en_AU.UTF-8 en_CA.UTF-8 en_GB.UTF-8 en_IE.UTF-8 \
64			en_NZ.UTF-8 C
65NLSLINKS_en_US.UTF-8+=	en_AU.US-ASCII en_CA.US-ASCII en_GB.US-ASCII \
66			en_NZ.US-ASCII
67NLSLINKS_en_US.UTF-8+=	en_AU.ISO8859-1 en_CA.ISO8859-1 en_GB.ISO8859-1 \
68			en_NZ.ISO8859-1 en_US.ISO8859-1
69NLSLINKS_en_US.UTF-8+=	en_AU.ISO8859-15 en_CA.ISO8859-15 en_GB.ISO8859-15 \
70			en_NZ.ISO8859-15 en_US.ISO8859-15
71
72NLSLINKS_de_DE.UTF-8+=	de_AT.UTF-8 de_CH.UTF-8
73NLSLINKS_de_DE.ISO8859-1+= de_AT.ISO8859-1 de_CH.ISO8859-1
74NLSLINKS_de_DE.ISO8859-1+= de_AT.ISO8859-15 de_CH.ISO8859-15 de_DE.ISO8859-15
75
76NLSLINKS_fr_FR.UTF-8+=	fr_BE.UTF-8 fr_CA.UTF-8 fr_CH.UTF-8
77NLSLINKS_fr_FR.ISO8859-1+= fr_BE.ISO8859-1 fr_CA.ISO8859-1 fr_CH.ISO8859-1
78NLSLINKS_fr_FR.ISO8859-1+= fr_BE.ISO8859-15 fr_CA.ISO8859-15 fr_CH.ISO8859-15 \
79			fr_FR.ISO8859-15
80
81NLSLINKS_nl_NL.ISO8859-1+= nl_BE.ISO8859-1
82NLSLINKS_nl_NL.ISO8859-1+= nl_BE.ISO8859-15 nl_NL.ISO8859-15
83
84NLSLINKS_pt_PT.UTF-8+=	pt_BR.UTF-8
85NLSLINKS_pt_PT.ISO8859-1+= pt_BR.ISO8859-1
86NLSLINKS_pt_PT.ISO8859-1+= pt_PT.ISO8859-15
87.endif
88
89lib.c:		lib.bc
90		cd ${BCDIR} && sh gen/strgen.sh gen/lib.bc ${.OBJDIR}/lib.c bc_lib bc.h bc_lib_name 1 1
91
92lib2.c:		lib2.bc
93		cd ${BCDIR} && sh gen/strgen.sh gen/lib2.bc ${.OBJDIR}/lib2.c bc_lib2 bc.h bc_lib2_name 1 1
94
95bc_help.c:	bc_help.txt
96		cd ${BCDIR} && sh gen/strgen.sh gen/bc_help.txt ${.OBJDIR}/bc_help.c bc_help bc.h
97
98dc_help.c:	dc_help.txt
99		cd ${BCDIR} && sh gen/strgen.sh gen/dc_help.txt ${.OBJDIR}/dc_help.c dc_help dc.h
100
101.include <bsd.prog.mk>
102