#--*- Makefile -*--------------------------------------------------------------
#$Author: antanas $
#$Revision: 8979 $
#$Date: 2021-11-23 16:02:13 +0200 (Tue, 23 Nov 2021) $
#$URL: svn+ssh://www.crystallography.net/home/coder/svn-repositories/cod-tools/tags/v3.8.1/Makeconf $
#------------------------------------------------------------------------------

PKG_NAME = cod-tools

CWD := ${shell pwd}
TOP := ${CWD}

LOCAL_PERL_LIB   = ${TOP}/src/lib/perl5
LOCAL_PYTHON_LIB = ${TOP}/src/components/pycodcif

PERL_SOURCE_TOP    = ${TOP}/src/lib/perl5
PERL_SOURCE_DIRS   = ${PERL_SOURCE_TOP}/COD
PYTHON_SOURCE_DIRS = ${LOCAL_PYTHON_LIB}

YAPP_MODULE_DIRS := \
	${PERL_SOURCE_DIRS}/Formulae/Parser/AdHoc \
	${PERL_SOURCE_DIRS}/Formulae/Parser/IUCr \
	${PERL_SOURCE_DIRS}/CIF/Parser/Yapp

PERL_SWIG_MODULE_DIRS   := ${PERL_SOURCE_DIRS}/CIF/Parser/Bison \
                           ${PERL_SOURCE_DIRS}/SPGLib
PYTHON_SWIG_MODULE_DIRS := ${PYTHON_SOURCE_DIRS}

C_PARSER_LIB_DIR = ${TOP}/src/components/codcif
LOCAL_LIB_FILES  = ${TOP}/src/externals/cexceptions/lib/libcexceptions.a \
                   ${TOP}/src/externals/getoptions/lib/libgetoptions.a \
                   ${C_PARSER_LIB_DIR}/lib/libcodcif.a

# C programs used in testing: cifparse, cifvalues, cif_list_tags
C_PROGRAM_SOURCE_DIR    = ${C_PARSER_LIB_DIR}/programs
C_PROGRAM_SOURCE_FILES  = ${wildcard ${C_PROGRAM_SOURCE_DIR}/*.c}
C_PROGRAM_EXE_FILES     = ${patsubst %.c, ${C_PARSER_LIB_DIR}/%, \
                            ${notdir ${C_PROGRAM_SOURCE_FILES}}}

CODTOOLS_SCRIPTS = $(sort $(shell find scripts/ -maxdepth 1 -name \*~ -prune -o \
                                                -name cif_printout_Python -prune -o \
                                                -type f -a -executable -print) \
                     scripts/cod-tools-version)

PERL5LIB   := ${LOCAL_PERL_LIB}:${PERL5LIB}
PYTHONPATH := ${LOCAL_PYTHON_LIB}/build/python3:${PYTHONPATH}

export PERL5LIB
export PYTHONPATH

EXT = .cif
TEST_OPTIONS =

PREFIX = /usr
BIN_INSTALL_DIR = ${PREFIX}/bin

filter_perl_messages_user ?= cat
