# included by jcore/Makefile and jx/Makefile
#
# requires that ${JLIB} be defined

#
# JX source distribution (DISTR_TAR_FILE)
#

SRC_FILE_DIR := ${JX}/lib${JLIB}

.PHONY : jxsource
jxsource::
	@cd ${J_DISTR_TAR_DIR}; \
     tar -rf ${DISTR_TAR_FILE} ${filter-out %.o %~, \
                                 ${shell cd ${J_DISTR_TAR_DIR}; echo \
             ${SRC_FILE_DIR}/Make.* \
             ${SRC_FILE_DIR}/code/* \
             ${JX}/lib/lib${JLIB}-* \
             ${JX}/include/${JLIB} }}
	@cd test; ${MAKE} jxsource

#
# JX binary distributions (DISTR_TAR_FILE)
#

.PHONY : jxshared
jxshared: jx_bin_distr
	@cd ${J_DISTR_TAR_DIR}; \
     tar -rhf ${DISTR_TAR_FILE} ${JX}/lib/lib${JLIB}-${JX_LIB_VERSION}.so
	@cd test; ${MAKE} jxshared

.PHONY : jxlink
jxlink: jx_bin_distr
	@cd test; ${MAKE} jxlink

.PHONY : jx_bin_distr
jx_bin_distr: default
  ifdef J_COMPILE_DEBUG
	@strip -g lib${JLIB}-*
  endif
	@cd ${J_DISTR_TAR_DIR}; \
     tar -rhf ${DISTR_TAR_FILE} \
              ${filter-out %.cc %.o %~, ${shell cd ${J_DISTR_TAR_DIR}; echo \
                ${JX}/include/${JLIB}/* }} \
              ${JX}/lib/lib${JLIB}-${JX_LIB_VERSION}.a

	@cd ../lib/util/autodoc; ${MAKE} jxinstall
	@${RM} -r doc
	@mkdir doc
	@cd code; ../../lib/util/autodoc/autodoc *; mv *.doc ../doc
	@cd ${J_DISTR_TAR_DIR}; \
     tar -rf ${DISTR_TAR_FILE} ${SRC_FILE_DIR}/doc/
	@${RM} -r doc
