# defs.mak.in --
# source file for autoconf-generated "defs.mak" for magic

# @configure_input@
# Feel free to change the values in here to suit your needs.
# Be aware that running scripts/configure again will overwrite
# any changes!

SHELL                  = @SHELL@

prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
libdir = @libdir@
mandir = @mandir@

SCRIPTS		       = ${MAGICDIR}/scripts

INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@

# Override standard "make" target when compiling under TCL
ALL_TARGET = @ALL_TARGET@
INSTALL_TARGET = @INSTALL_TARGET@

# Change libdir to install in a different place
BINDIR                 = ${bindir}
MANDIR                 = ${mandir}
LIBDIR                 = ${libdir}
SYSDIR                 = ${libdir}/magic/sys
SCMDIR                 = ${libdir}/magic/scm
TCLDIR                 = ${libdir}/magic/tcl

# Install targets may be different if dist_prefix is set by configure
INSTALL_BINDIR         = @DIST_DIR@/bin
INSTALL_MANDIR         = @DIST_DIR@/share/man
INSTALL_LIBDIR         = @DIST_DIR@/lib
INSTALL_SYSDIR         = ${INSTALL_LIBDIR}/magic/sys
INSTALL_SCMDIR         = ${INSTALL_LIBDIR}/magic/scm
INSTALL_TCLDIR         = ${INSTALL_LIBDIR}/magic/tcl

MAIN_EXTRA_LIBS	       = @extra_libs@
LD_EXTRA_LIBS	       = @ld_extra_libs@
LD_SHARED	       = @ld_extra_objs@
TOP_EXTRA_LIBS	       = @top_extra_libs@
SUB_EXTRA_LIBS	       = @sub_extra_libs@
LIBS		       = @LIBS@

MODULES               += @modules@
UNUSED_MODULES        += @unused@
PROGRAMS	      += @programs@
INSTALL_CAD_DIRS      += @cadinstall@

RM                     = rm -f
RMDIR                  = rmdir
CP                     = cp
MV                     = mv
LN                     = ln
AR                     = ar
ARFLAGS                = cr
LINK                   = @LD@ -r
LD                     = @LD@
MKDIR                  = mkdir
PERL                   = @PERL@
SED                    = @SED@
MCPP		       = @MCPP@
MSED		       = @MSED@
RANLIB                 = @RANLIB@
SHDLIB_EXT             = @SHDLIB_EXT@
ZLIB_FLAG              = @ZLIB_FLAG@
LDDL_FLAGS             = ${LDFLAGS} @LDDL_FLAGS@
LD_RUN_PATH	       = @LD_RUN_PATH@
LIB_SPECS	       = @LIB_SPECS@
LIB_SPECS_NOSTUB       = @LIB_SPECS_NOSTUB@
LIB_SPECS_GRNULL       = @LIB_SPECS_GRNULL@
WISH_EXE	       = @WISH_EXE@
TCL_LIB_DIR	       = @TCL_LIB_DIR@

MAGIC_VERSION	       ?= $(shell cat ${MAGICDIR}/VERSION | cut -d. -f1-2)
MAGIC_REVISION	       ?= $(shell cat ${MAGICDIR}/VERSION | cut -d. -f3)
MAGIC_COMMIT	       ?= $(shell git rev-parse HEAD)
MAGIC_BUILDDATE	       ?= $(shell date | tr -d '\r\n')

# This allow inheritence of the values from toplevel Makefile
export MAGIC_VERSION
export MAGIC_REVISION
export MAGIC_COMMIT
export MAGIC_BUILDDATE

CC                     = @CC@
CPP                    = @CPP@
CXX		       = @CXX@

###
### Feature flags (to enable uncomment these from ./defs.mak after your ./configure)
###
### SUPPORT_DIRECT_MALLOC: this removes the legacy malloc/free APIs that are
###   not thread-safe and have a defer-free-by-1 quirk that maybe covering
###   up unknown problems.   See utils/malloc.[ch] for more info.
###
###   Status: EXPERIMENTAL (this is expected to uncover issues we don't know about yet)
#FEATURE_FLAGS += -DSUPPORT_DIRECT_MALLOC
###
### SUPPORT_REMOVE_MALLOC_LEGACY this completely removes the older non-threadsafe API
###   from the output binaries.
###   This option is dependent on SUPPORT_DIRECT_MALLOC
###
###   Status: NOT-STABILITY-AFFECTING (if your binary links you are good to continue)
#FEATURE_FLAGS += -DSUPPORT_REMOVE_MALLOC_LEGACY

CPPFLAGS               = -I${MAGICDIR} @CPPFLAGS@
DFLAGS_MAGICVERSION    = -DMAGIC_VERSION=\"${MAGIC_VERSION}\" -DMAGIC_REVISION=\"${MAGIC_REVISION}\" -DMAGIC_COMMIT=\"${MAGIC_COMMIT}\" "-DMAGIC_BUILDDATE=\"${MAGIC_BUILDDATE}\""
DFLAGS                 = @extra_defs@ @stub_defs@ @DEFS@ ${DFLAGS_MAGICVERSION} -DGCORE=\"@GCORE@\"
DFLAGS		      += -DSHDLIB_EXT=\"@SHDLIB_EXT@\" @NDEBUG_defs@ @DEBUG_defs@ ${FEATURE_FLAGS}
DFLAGS_NOSTUB	       = @extra_defs@             @DEFS@ ${DFLAGS_MAGICVERSION} -DGCORE=\"@GCORE@\"
DFLAGS_NOSTUB	      += -DSHDLIB_EXT=\"@SHDLIB_EXT@\" @NDEBUG_defs@ @DEBUG_defs@ ${FEATURE_FLAGS}
CFLAGS                 = @CFLAGS@ @SHLIB_CFLAGS@ @INC_SPECS@

READLINE_DEFS          = @rl_defs@
READLINE_LIBS          = @rl_libs@

DEPEND_FILE	       = Depend
DEPEND_FLAG	       = @DEPEND_FLAG@
EXEEXT		       = @EXEEXT@

GR_CFLAGS              = @X_CFLAGS@ @gr_cflags@
GR_DFLAGS	       = @gr_dflags@
GR_LIBS                = @X_LIBS@ @X_PRE_LIBS@ @gr_libs@ @X_EXTRA_LIBS@
GR_SRCS                = @gr_srcs@
GR_HELPER_SRCS         = @gr_hsrcs@
GR_HELPER_PROG         = @gr_hprog@

OA		       = @OA@
OA_LIBS		       = @OA_LIBS@

DEPSRCS	  = ${SRCS}
C_OBJS    = ${SRCS:.c=.o}
CXX_OBJS  = ${CXXSRCS:.cpp=.o}
OBJS      = ${CXX_OBJS} ${C_OBJS}
LIB_OBJS  = ${LIB_SRCS:.c=.o}
CLEANS    = Depend ${OBJS} ${LIB_OBJS} lib${MODULE}.a lib${MODULE}.o ${MODULE}

# allows Makefile to be selective
MAKE_TCL           = @MAKE_TCL@
MAKE_X11           = @MAKE_X11@
MAKE_GL            = @MAKE_GL@
MAKE_GLU           = @MAKE_GLU@
MAKE_CAIRO         = @MAKE_CAIRO@
MAKE_READLINE      = @MAKE_READLINE@
