#==========================================================================+
#    This source code is public domain, and may be freely distributed,     |
#    modified, and used for any purpose.  IT COMES WITH ABSOLUTELY NO      |
#    WARRANTY OF ANY KIND.						   |
#==========================================================================+
#
# Makefile for RD-to-TDT conversion examples.  Assumes $DY_ROOT points to
# the root of the Daylight directory; for example "/usr/local/daylight/v451".
#
# Usage:
#	make		Compiles everything.
#	make clean	Removes all object code that "make" makes.
#	make progname	Compiles and links a particular program 
#			(e.g. "make rd2tdt").


#
# Get OS-specific definitions
#

CONTRIB = $(DY_ROOT)/contrib

include $(CONTRIB)/src/makefile_include
LOCAL_INCLUDES = -I$(CONTRIB)/include

#
#  Default is to make all programs.
#

PROGS = rd2tdt

all: $(PROGS)

#
# Linking the example applications.
#

DULIB = $(CONTRIB)/lib/libdu.a
DEPLIB          =       $(DY_ROOT)/lib/libdt_depict.a \
                        $(DY_ROOT)/contrib/lib/libdl_stubs.a
LIBS  = $(DULIB) $(DEPLIB) $(DY_ROOT)/lib/libdt_smiles.a

RD2TDT  = rd2tdt.o du_ctab2dep.o $(LIBS)
rd2tdt: $(RD2TDT)
	$(CC) -o $@ $(CFLAGS) $(RD2TDT) $(SYSLIBS)

#
# Simple dependencies.  Make(1) has built-in rules for turning a .c file
# into a .o file; we just supply the dependency list.  The instructions to
# link these into programs follow.
#

SMILESH = $(DY_ROOT)/include/dt_smiles.h
DEPICTH = $(DY_ROOT)/include/dt_depict.h

du_ctab2dep.o:  du_ctab2dep.c	$(SMILESH)
rd2tdt.o:       rd2tdt.c	$(SMILESH)

#
# Handy clean-up instructions
# "make clean" removes all programs, .o files, .a files, and "core" files.
#

clean:
	rm -f *.[oa] $(PROGS) core
