xref: /freebsd/usr.bin/gh-bc/Makefile (revision b55a927bc884d7780d65a508572023b0dc2dede9)
1# $FreeBSD$
2
3.include <src.opts.mk>
4
5PROG=		gh-bc
6PROGNAME=	bc
7
8BCDIR=		${SRCTOP}/contrib/${PROGNAME}
9
10SRCS=		args.c data.c file.c lang.c lex.c main.c num.c parse.c program.c read.c vector.c vm.c
11SRCS+=		bc.c bc_lex.c bc_parse.c dc.c dc_lex.c dc_parse.c history.c library.c
12SRCS+=		bc_help.c dc_help.c lib.c lib2.c opt.c rand.c
13MAN=		bc.1 dc.1
14
15LINKS=		${BINDIR}/bc ${BINDIR}/dc
16
17.PATH:		${BCDIR}/src ${BCDIR}/gen ${BCDIR}/manuals ${.OBJDIR}
18
19CATALOGS=	en_US.UTF-8
20CATALOGS+=	de_DE.UTF-8 de_DE.ISO8859-1
21CATALOGS+=	es_ES.UTF-8 es_ES.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_RAND
41CFLAGS+=	-DDC_ENABLED
42CFLAGS+=	-DNDEBUG
43CFLAGS+=	-I${BCDIR}/include
44
45.if ${MK_NLS_CATALOGS} == "no"
46CFLAGS+=	-DBC_ENABLE_NLS=0
47MAN_SRC_BC=	bc/N.1
48MAN_SRC_DC=	dc/N.1
49.else
50CFLAGS+=	-DBC_ENABLE_NLS=1
51MAN_SRC_BC=	bc/A.1
52MAN_SRC_DC=	dc/A.1
53
54# prevent floating point incompatibilities caused by -flto on some architectures
55.if ${MACHINE_ARCH} != mips && ${MACHINE_ARCH} != mips64 && \
56    ${MACHINE_ARCH} != powerpc64 && ${MACHINE_ARCH} != riscv64
57CFLAGS+=	-flto
58.endif
59
60HAS_TESTS=
61SUBDIR.${MK_TESTS}+= tests
62
63.for catalog in ${CATALOGS}
64NLS+=           ${catalog:C/.*://}
65NLSSRCFILES_${catalog:C/.*://}= ${catalog:C/.*://}.msg
66.endfor
67
68NLSLINKS_en_US.UTF-8+=	en_AU.UTF-8 en_CA.UTF-8 en_GB.UTF-8 en_IE.UTF-8 \
69			en_NZ.UTF-8 C
70NLSLINKS_en_US.UTF-8+=	en_AU.US-ASCII en_CA.US-ASCII en_GB.US-ASCII \
71			en_NZ.US-ASCII
72NLSLINKS_en_US.UTF-8+=	en_AU.ISO8859-1 en_CA.ISO8859-1 en_GB.ISO8859-1 \
73			en_NZ.ISO8859-1 en_US.ISO8859-1
74NLSLINKS_en_US.UTF-8+=	en_AU.ISO8859-15 en_CA.ISO8859-15 en_GB.ISO8859-15 \
75			en_NZ.ISO8859-15 en_US.ISO8859-15
76
77NLSLINKS_de_DE.UTF-8+=	de_AT.UTF-8 de_CH.UTF-8
78NLSLINKS_de_DE.ISO8859-1+= de_AT.ISO8859-1 de_CH.ISO8859-1
79NLSLINKS_de_DE.ISO8859-1+= de_AT.ISO8859-15 de_CH.ISO8859-15 de_DE.ISO8859-15
80
81NLSLINKS_es_ES.ISO8859-1+= es_ES.ISO8859-15
82
83NLSLINKS_fr_FR.UTF-8+=	fr_BE.UTF-8 fr_CA.UTF-8 fr_CH.UTF-8
84NLSLINKS_fr_FR.ISO8859-1+= fr_BE.ISO8859-1 fr_CA.ISO8859-1 fr_CH.ISO8859-1
85NLSLINKS_fr_FR.ISO8859-1+= fr_BE.ISO8859-15 fr_CA.ISO8859-15 fr_CH.ISO8859-15 \
86			fr_FR.ISO8859-15
87
88NLSLINKS_nl_NL.ISO8859-1+= nl_BE.ISO8859-1
89NLSLINKS_nl_NL.ISO8859-1+= nl_BE.ISO8859-15 nl_NL.ISO8859-15
90
91NLSLINKS_pt_PT.UTF-8+=	pt_BR.UTF-8
92NLSLINKS_pt_PT.ISO8859-1+= pt_BR.ISO8859-1
93NLSLINKS_pt_PT.ISO8859-1+= pt_PT.ISO8859-15
94.endif
95
96lib.c:		lib.bc Makefile
97		cd ${BCDIR} && sh gen/strgen.sh gen/lib.bc ${.OBJDIR}/lib.c bc_lib bc_lib_name 1 1
98
99lib2.c:		lib2.bc Makefile
100		cd ${BCDIR} && sh gen/strgen.sh gen/lib2.bc ${.OBJDIR}/lib2.c bc_lib2 bc_lib2_name 1 1
101
102bc_help.c:	bc_help.txt Makefile
103		cd ${BCDIR} && sh gen/strgen.sh gen/bc_help.txt ${.OBJDIR}/bc_help.c bc_help
104
105dc_help.c:	dc_help.txt Makefile
106		cd ${BCDIR} && sh gen/strgen.sh gen/dc_help.txt ${.OBJDIR}/dc_help.c dc_help
107
108bc.1:
109		${CP} ${BCDIR}/manuals/${MAN_SRC_BC} ${.OBJDIR}/bc.1
110
111dc.1:
112		${CP} ${BCDIR}/manuals/${MAN_SRC_DC} ${.OBJDIR}/dc.1
113
114.include <bsd.prog.mk>
115