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