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