xref: /freebsd/usr.bin/gh-bc/Makefile (revision 2ead2969a0bd202c427a4c17a91376d6189b5c1e)
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+=	es_ES.UTF-8 es_ES.ISO8859-1
23CATALOGS+=	fr_FR.UTF-8 fr_FR.ISO8859-1
24CATALOGS+=	ja_JP.UTF-8 ja_JP.eucJP
25CATALOGS+=	nl_NL.UTF-8 nl_NL.ISO8859-1
26CATALOGS+=	pl_PL.UTF-8 pl_PL.ISO8859-2
27CATALOGS+=	pt_PT.UTF-8 pt_PT.ISO8859-1
28CATALOGS+=	ru_RU.UTF-8 ru_RU.ISO8859-5 ru_RU.CP1251 ru_RU.CP866 ru_RU.KOI8-R
29CATALOGS+=	zh_CN.UTF-8 zh_CN.eucCN zh_CN.GB18030 zh_CN.GB2312 zh_CN.GBK
30
31NLSNAME=	bc
32NLSSRCDIR=	${BCDIR}/locales
33
34CFLAGS+=	-DMAINEXEC=${PROGNAME}
35CFLAGS+=	-DNLSPATH=/usr/share/nls/%L/%N.cat
36CFLAGS+=	-DBC_ENABLED
37CFLAGS+=	-DBC_ENABLE_PROMPT
38CFLAGS+=	-DBC_ENABLE_LONG_OPTIONS
39CFLAGS+=	-DBC_ENABLE_EXTRA_MATH
40CFLAGS+=	-DBC_ENABLE_HISTORY
41CFLAGS+=	-DBC_ENABLE_RAND
42CFLAGS+=	-DDC_ENABLED
43CFLAGS+=	-DNDEBUG
44CFLAGS+=	-DVERSION=${BCVERSION}
45CFLAGS+=	-I${BCDIR}/include
46
47.if ${MK_NLS_CATALOGS} == "no"
48CFLAGS+=	-DBC_ENABLE_NLS=0
49MAN_SRC_BC=	bc/N.1
50MAN_SRC_DC=	dc/N.1
51.else
52CFLAGS+=	-DBC_ENABLE_NLS=1
53MAN_SRC_BC=	bc/A.1
54MAN_SRC_DC=	dc/A.1
55
56# prevent floating point incompatibilities caused by -flto on some architectures
57.if ${MACHINE_ARCH} != mips && ${MACHINE_ARCH} != mips64 && \
58    ${MACHINE_ARCH} != powerpc64 && ${MACHINE_ARCH} != riscv64
59CFLAGS+=	-flto
60.endif
61
62.if ${MK_TESTS} != "no"
63#SUBDIR+=	tests
64.endif
65
66.for catalog in ${CATALOGS}
67NLS+=           ${catalog:C/.*://}
68NLSSRCFILES_${catalog:C/.*://}= ${catalog:C/.*://}.msg
69.endfor
70
71NLSLINKS_en_US.UTF-8+=	en_AU.UTF-8 en_CA.UTF-8 en_GB.UTF-8 en_IE.UTF-8 \
72			en_NZ.UTF-8 C
73NLSLINKS_en_US.UTF-8+=	en_AU.US-ASCII en_CA.US-ASCII en_GB.US-ASCII \
74			en_NZ.US-ASCII
75NLSLINKS_en_US.UTF-8+=	en_AU.ISO8859-1 en_CA.ISO8859-1 en_GB.ISO8859-1 \
76			en_NZ.ISO8859-1 en_US.ISO8859-1
77NLSLINKS_en_US.UTF-8+=	en_AU.ISO8859-15 en_CA.ISO8859-15 en_GB.ISO8859-15 \
78			en_NZ.ISO8859-15 en_US.ISO8859-15
79
80NLSLINKS_de_DE.UTF-8+=	de_AT.UTF-8 de_CH.UTF-8
81NLSLINKS_de_DE.ISO8859-1+= de_AT.ISO8859-1 de_CH.ISO8859-1
82NLSLINKS_de_DE.ISO8859-1+= de_AT.ISO8859-15 de_CH.ISO8859-15 de_DE.ISO8859-15
83
84NLSLINKS_es_ES.ISO8859-1+= es_ES.ISO8859-15
85
86NLSLINKS_fr_FR.UTF-8+=	fr_BE.UTF-8 fr_CA.UTF-8 fr_CH.UTF-8
87NLSLINKS_fr_FR.ISO8859-1+= fr_BE.ISO8859-1 fr_CA.ISO8859-1 fr_CH.ISO8859-1
88NLSLINKS_fr_FR.ISO8859-1+= fr_BE.ISO8859-15 fr_CA.ISO8859-15 fr_CH.ISO8859-15 \
89			fr_FR.ISO8859-15
90
91NLSLINKS_nl_NL.ISO8859-1+= nl_BE.ISO8859-1
92NLSLINKS_nl_NL.ISO8859-1+= nl_BE.ISO8859-15 nl_NL.ISO8859-15
93
94NLSLINKS_pt_PT.UTF-8+=	pt_BR.UTF-8
95NLSLINKS_pt_PT.ISO8859-1+= pt_BR.ISO8859-1
96NLSLINKS_pt_PT.ISO8859-1+= pt_PT.ISO8859-15
97.endif
98
99lib.c:		lib.bc
100		cd ${BCDIR} && sh gen/strgen.sh gen/lib.bc ${.OBJDIR}/lib.c bc_lib bc.h bc_lib_name 1 1
101
102lib2.c:		lib2.bc
103		cd ${BCDIR} && sh gen/strgen.sh gen/lib2.bc ${.OBJDIR}/lib2.c bc_lib2 bc.h bc_lib2_name 1 1
104
105bc_help.c:	bc_help.txt
106		cd ${BCDIR} && sh gen/strgen.sh gen/bc_help.txt ${.OBJDIR}/bc_help.c bc_help bc.h
107
108dc_help.c:	dc_help.txt
109		cd ${BCDIR} && sh gen/strgen.sh gen/dc_help.txt ${.OBJDIR}/dc_help.c dc_help dc.h
110
111bc.1:
112		${CP} ${BCDIR}/manuals/${MAN_SRC_BC} ${.OBJDIR}/bc.1
113
114dc.1:
115		${CP} ${BCDIR}/manuals/${MAN_SRC_DC} ${.OBJDIR}/dc.1
116
117.include <bsd.prog.mk>
118