xref: /freebsd/usr.bin/gh-bc/Makefile (revision fdd4c35832deb1d064f64c2c00e3c8c958be9a51)
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
14LIBADD=		edit
15
16MAN=		bc.1 dc.1
17
18LINKS=		${BINDIR}/bc ${BINDIR}/dc
19
20.PATH:		${BCDIR}/src ${BCDIR}/gen ${BCDIR}/manuals ${.OBJDIR}
21
22CATALOGS=	en_US.UTF-8
23CATALOGS+=	de_DE.UTF-8 de_DE.ISO8859-1
24CATALOGS+=	es_ES.UTF-8 es_ES.ISO8859-1
25CATALOGS+=	fr_FR.UTF-8 fr_FR.ISO8859-1
26CATALOGS+=	ja_JP.UTF-8 ja_JP.eucJP
27CATALOGS+=	nl_NL.UTF-8 nl_NL.ISO8859-1
28CATALOGS+=	pl_PL.UTF-8 pl_PL.ISO8859-2
29CATALOGS+=	pt_PT.UTF-8 pt_PT.ISO8859-1
30CATALOGS+=	ru_RU.UTF-8 ru_RU.ISO8859-5 ru_RU.CP1251 ru_RU.CP866 ru_RU.KOI8-R
31CATALOGS+=	zh_CN.UTF-8 zh_CN.eucCN zh_CN.GB18030 zh_CN.GB2312 zh_CN.GBK
32
33NLSNAME=	bc
34NLSSRCDIR=	${BCDIR}/locales
35
36CFLAGS=-g -O0
37CFLAGS+=	-DBC_DEFAULT_BANNER=0
38CFLAGS+=	-DBC_DEFAULT_DIGIT_CLAMP=0
39CFLAGS+=	-DBC_DEFAULT_EXPR_EXIT=1
40CFLAGS+=	-DBC_DEFAULT_PROMPT=0
41CFLAGS+=	-DBC_DEFAULT_SIGINT_RESET=1
42CFLAGS+=	-DBC_DEFAULT_TTY_MODE=1
43CFLAGS+=	-DBC_ENABLED=1
44CFLAGS+=	-DBC_ENABLE_AFL=0
45CFLAGS+=	-DBC_ENABLE_EDITLINE=1
46CFLAGS+=	-DBC_ENABLE_EXTRA_MATH=1
47CFLAGS+=	-DBC_ENABLE_HISTORY=1
48CFLAGS+=	-DBC_ENABLE_LIBRARY=0
49CFLAGS+=	-DBC_ENABLE_MEMCHECK=0
50CFLAGS+=	-DBC_ENABLE_NLS=1
51CFLAGS+=	-DBC_EXCLUDE_EXTRA_MATH=0
52
53CFLAGS+=	-DDC_DEFAULT_DIGIT_CLAMP=0
54CFLAGS+=	-DDC_DEFAULT_EXPR_EXIT=1
55CFLAGS+=	-DDC_DEFAULT_PROMPT=0
56CFLAGS+=	-DDC_DEFAULT_SIGINT_RESET=1
57CFLAGS+=	-DDC_DEFAULT_TTY_MODE=0
58CFLAGS+=	-DDC_ENABLED=1
59
60CFLAGS+=	-DBUILD_TYPE=A
61CFLAGS+=	-DMAINEXEC=${PROGNAME}
62CFLAGS+=	-DNDEBUG
63CFLAGS+=	-DNLSPATH=/usr/share/nls/%L/%N.cat
64CFLAGS+=	-I${BCDIR}/include
65
66.if ${MK_NLS_CATALOGS} == "no"
67CFLAGS+=	-DBC_ENABLE_NLS=0
68MAN_SRC_BC=	bc/N.1
69MAN_SRC_DC=	dc/N.1
70.else
71CFLAGS+=	-DBC_ENABLE_NLS=1
72MAN_SRC_BC=	bc/A.1
73MAN_SRC_DC=	dc/A.1
74
75# prevent floating point incompatibilities caused by -flto on some architectures
76.if ${MACHINE_ARCH:Mmips*} == "" && ${MACHINE_ARCH} != powerpc64 && \
77	${MACHINE_ARCH} != riscv64
78#CFLAGS+=	-flto
79.endif
80
81HAS_TESTS=	yes
82SUBDIR.${MK_TESTS}+= tests
83
84.for catalog in ${CATALOGS}
85NLS+=           ${catalog:C/.*://}
86NLSSRCFILES_${catalog:C/.*://}= ${catalog:C/.*://}.msg
87.endfor
88
89NLSLINKS_en_US.UTF-8+=	en_AU.UTF-8 en_CA.UTF-8 en_GB.UTF-8 en_IE.UTF-8 \
90			en_NZ.UTF-8 C
91NLSLINKS_en_US.UTF-8+=	en_AU.US-ASCII en_CA.US-ASCII en_GB.US-ASCII \
92			en_NZ.US-ASCII
93NLSLINKS_en_US.UTF-8+=	en_AU.ISO8859-1 en_CA.ISO8859-1 en_GB.ISO8859-1 \
94			en_NZ.ISO8859-1 en_US.ISO8859-1
95NLSLINKS_en_US.UTF-8+=	en_AU.ISO8859-15 en_CA.ISO8859-15 en_GB.ISO8859-15 \
96			en_NZ.ISO8859-15 en_US.ISO8859-15
97
98NLSLINKS_de_DE.UTF-8+=	de_AT.UTF-8 de_CH.UTF-8
99NLSLINKS_de_DE.ISO8859-1+= de_AT.ISO8859-1 de_CH.ISO8859-1
100NLSLINKS_de_DE.ISO8859-1+= de_AT.ISO8859-15 de_CH.ISO8859-15 de_DE.ISO8859-15
101
102NLSLINKS_es_ES.ISO8859-1+= es_ES.ISO8859-15
103
104NLSLINKS_fr_FR.UTF-8+=	fr_BE.UTF-8 fr_CA.UTF-8 fr_CH.UTF-8
105NLSLINKS_fr_FR.ISO8859-1+= fr_BE.ISO8859-1 fr_CA.ISO8859-1 fr_CH.ISO8859-1
106NLSLINKS_fr_FR.ISO8859-1+= fr_BE.ISO8859-15 fr_CA.ISO8859-15 fr_CH.ISO8859-15 \
107			fr_FR.ISO8859-15
108
109NLSLINKS_nl_NL.ISO8859-1+= nl_BE.ISO8859-1
110NLSLINKS_nl_NL.ISO8859-1+= nl_BE.ISO8859-15 nl_NL.ISO8859-15
111
112NLSLINKS_pt_PT.UTF-8+=	pt_BR.UTF-8
113NLSLINKS_pt_PT.ISO8859-1+= pt_BR.ISO8859-1
114NLSLINKS_pt_PT.ISO8859-1+= pt_PT.ISO8859-15
115.endif
116
117lib.c:		lib.bc Makefile
118		cd ${BCDIR} && sh gen/strgen.sh gen/lib.bc ${.OBJDIR}/lib.c 0 bc_lib bc_lib_name 1 1
119
120lib2.c:		lib2.bc Makefile
121		cd ${BCDIR} && sh gen/strgen.sh gen/lib2.bc ${.OBJDIR}/lib2.c 0 bc_lib2 bc_lib2_name 1 1
122
123bc_help.c:	bc_help.txt Makefile
124		cd ${BCDIR} && sh gen/strgen.sh gen/bc_help.txt ${.OBJDIR}/bc_help.c 0 bc_help
125
126dc_help.c:	dc_help.txt Makefile
127		cd ${BCDIR} && sh gen/strgen.sh gen/dc_help.txt ${.OBJDIR}/dc_help.c 0 dc_help
128
129bc.1:
130		${CP} ${BCDIR}/manuals/${MAN_SRC_BC} ${.OBJDIR}/bc.1
131
132dc.1:
133		${CP} ${BCDIR}/manuals/${MAN_SRC_DC} ${.OBJDIR}/dc.1
134
135.include <bsd.prog.mk>
136