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.c bc_lex.c bc_parse.c dc.c dc_lex.c dc_parse.c history.c library.c 13SRCS+= bc_help.c dc_help.c lib.c lib2.c opt.c 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 62HAS_TESTS= 63SUBDIR.${MK_TESTS}+= tests 64 65.for catalog in ${CATALOGS} 66NLS+= ${catalog:C/.*://} 67NLSSRCFILES_${catalog:C/.*://}= ${catalog:C/.*://}.msg 68.endfor 69 70NLSLINKS_en_US.UTF-8+= en_AU.UTF-8 en_CA.UTF-8 en_GB.UTF-8 en_IE.UTF-8 \ 71 en_NZ.UTF-8 C 72NLSLINKS_en_US.UTF-8+= en_AU.US-ASCII en_CA.US-ASCII en_GB.US-ASCII \ 73 en_NZ.US-ASCII 74NLSLINKS_en_US.UTF-8+= en_AU.ISO8859-1 en_CA.ISO8859-1 en_GB.ISO8859-1 \ 75 en_NZ.ISO8859-1 en_US.ISO8859-1 76NLSLINKS_en_US.UTF-8+= en_AU.ISO8859-15 en_CA.ISO8859-15 en_GB.ISO8859-15 \ 77 en_NZ.ISO8859-15 en_US.ISO8859-15 78 79NLSLINKS_de_DE.UTF-8+= de_AT.UTF-8 de_CH.UTF-8 80NLSLINKS_de_DE.ISO8859-1+= de_AT.ISO8859-1 de_CH.ISO8859-1 81NLSLINKS_de_DE.ISO8859-1+= de_AT.ISO8859-15 de_CH.ISO8859-15 de_DE.ISO8859-15 82 83NLSLINKS_es_ES.ISO8859-1+= es_ES.ISO8859-15 84 85NLSLINKS_fr_FR.UTF-8+= fr_BE.UTF-8 fr_CA.UTF-8 fr_CH.UTF-8 86NLSLINKS_fr_FR.ISO8859-1+= fr_BE.ISO8859-1 fr_CA.ISO8859-1 fr_CH.ISO8859-1 87NLSLINKS_fr_FR.ISO8859-1+= fr_BE.ISO8859-15 fr_CA.ISO8859-15 fr_CH.ISO8859-15 \ 88 fr_FR.ISO8859-15 89 90NLSLINKS_nl_NL.ISO8859-1+= nl_BE.ISO8859-1 91NLSLINKS_nl_NL.ISO8859-1+= nl_BE.ISO8859-15 nl_NL.ISO8859-15 92 93NLSLINKS_pt_PT.UTF-8+= pt_BR.UTF-8 94NLSLINKS_pt_PT.ISO8859-1+= pt_BR.ISO8859-1 95NLSLINKS_pt_PT.ISO8859-1+= pt_PT.ISO8859-15 96.endif 97 98lib.c: lib.bc Makefile 99 cd ${BCDIR} && sh gen/strgen.sh gen/lib.bc ${.OBJDIR}/lib.c bc_lib bc_lib_name 1 1 100 101lib2.c: lib2.bc Makefile 102 cd ${BCDIR} && sh gen/strgen.sh gen/lib2.bc ${.OBJDIR}/lib2.c bc_lib2 bc_lib2_name 1 1 103 104bc_help.c: bc_help.txt Makefile 105 cd ${BCDIR} && sh gen/strgen.sh gen/bc_help.txt ${.OBJDIR}/bc_help.c bc_help 106 107dc_help.c: dc_help.txt Makefile 108 cd ${BCDIR} && sh gen/strgen.sh gen/dc_help.txt ${.OBJDIR}/dc_help.c dc_help 109 110bc.1: 111 ${CP} ${BCDIR}/manuals/${MAN_SRC_BC} ${.OBJDIR}/bc.1 112 113dc.1: 114 ${CP} ${BCDIR}/manuals/${MAN_SRC_DC} ${.OBJDIR}/dc.1 115 116.include <bsd.prog.mk> 117