

#
# This Makefile is for the Sybase/Sybperl extension to perl.
# It was written by Makefile.PL, so don't edit it, edit
# Makefile.PL instead. ANY CHANGES MADE HERE WILL BE LOST!
# 

DISTNAME = sybperl
VERSION = 2a7

TOP = /export/home1/local/src/lang/perl5.000
ABSTOP = /export/home1/local/src/lang/perl5.000
PERL = /export/home1/local/src/lang/perl5.000/perl
FULLPERL = /export/home1/local/src/lang/perl5.000/perl
INC = -I/usr/local/sybase/include
DEFINE = -DDBLIBVS=461 -DSYBPLVER='"${VERSION}"'
OBJECT = $(BASEEXT).o
LDTARGET = $(OBJECT)

CC = cc
LIBC = /usr/lib/libc.so
LDFLAGS = 
CLDFLAGS = 
LINKTYPE = dynamic
ARMAYBE = :
RANLIB = :

SMALL = 
LARGE =  
# The following are used to build and install shared libraries for
# dynamic loading.
LDDLFLAGS = -G
CCDLFLAGS = 
CCCDLFLAGS = -K pic
SO = so
DLEXT = so
DLSRC = dl_dlopen.xs

# Sybase/Sybperl might need to be linked with some extra libraries.
# EXTRALIBS =  full list of libraries needed for static linking.
#		Only those libraries that actually exist are included.
# DYNALOADLIBS = list of those libraries that are needed but can be
#		linked in dynamically on this platform.  On SunOS, for
#		example, this would be .so* libraries, but not archive
#		libraries.  The bootstrap file is installed only if
#		this list is not empty.
# STATLOADLIBS = list of those libraries which must be statically
#		linked into the shared library.  On SunOS 4.1.3, 
#		for example,  I have only an archive version of
#		-lm, and it must be linked in statically.
EXTRALIBS = 
DYNALOADLIBS = 
STATLOADLIBS = -lm


# EXTMODNAME = The perl module name for this extension.
# FULLEXT = Full pathname to extension directory.
# BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT.
# ROOTEXT = Directory part of FULLEXT. May be empty.
EXTMODNAME = Sybase::Sybperl
FULLEXT = Sybase/Sybperl
BASEEXT = Sybperl
ROOTEXT = Sybase
# and for backward compatibility and for AIX support (due to change!)
EXT = Sybperl

# Sybase/Sybperl might have its own typemap
EXTTYPEMAP = 
# Sybase/Sybperl might have its own bootstrap support
BOOTSTRAP = Sybperl.bs
BOOTDEP = 

# Where to put things:
AUTO = $(TOP)/lib/auto
AUTOEXT = $(TOP)/lib/auto/$(FULLEXT)
INST_BOOT = $(AUTOEXT)/$(BASEEXT).bs
INST_DYNAMIC = $(AUTOEXT)/$(BASEEXT).$(DLEXT)
INST_STATIC = $(BASEEXT).a
INST_PM = $(TOP)/lib/$(FULLEXT).pm

# These two are only used by install: targets
INSTALLPRIVLIB = /usr/local/lib/perl5
INSTALLARCHLIB = /usr/local/lib/perl5/i86pc-solaris

# Tools
SHELL = /bin/sh
CCCMD = `sh $(shellflags) $(ABSTOP)/cflags $@`
XSUBPP = $(TOP)/ext/xsubpp
# the following is a portable way to say mkdir -p
MKPATH = $(PERL) -we '$$"="/"; foreach(split(/\//,$$ARGV[0])){ push(@p, $$_); next if -d "@p"; print "mkdir @p\n"; mkdir("@p",0777)||die "mkdir @p: $$!" } exit 0;'
AUTOSPLITLIB = cd $(TOP); \
	$(PERL) -Ilib -e 'use AutoSplit; $$AutoSplit::Maxlen=8; autosplit_lib_modules(@ARGV) ;'


all :: 

config :: Makefile
	@$(MKPATH) $(AUTOEXT)

install ::




all::	dynamic

# Target for Dynamic Loading:
dynamic::	$(INST_PM)



# Phony target to force checking subdirectories.
FORCE:


# Target for Static Loading:
static:: $(INST_STATIC) $(INST_PM)

$(INST_STATIC): $(OBJECT)
	ar cr $@ $(OBJECT)
	$(RANLIB) $@
	echo $(EXTRALIBS) >> $(TOP)/ext.libs


.c.o:
	$(CCCMD) $(CCCDLFLAGS) $(DEFINE) -I$(TOP) $(INC) $*.c


$(BASEEXT).c:	$(BASEEXT).xs $(XSUBPP) $(TOP)/ext/typemap $(EXTTYPEMAP) $(TOP)/cflags
	$(PERL) $(XSUBPP) $(BASEEXT).xs >tmp
	mv tmp $@


$(INST_PM):	$(BASEEXT).pm
	@$(MKPATH) $(TOP)/lib/$(ROOTEXT)
	rm -f $@
	cp $(BASEEXT).pm $@
	@$(AUTOSPLITLIB) $(EXTMODNAME)
	cp sybperl.pl $(ABSTOP)/lib
	chmod 644 $(ABSTOP)/lib/sybperl.pl


clean::
	rm -f *.o *.a mon.out core $(BASEEXT).c so_locations
	rm -f makefile Makefile $(BOOTSTRAP) $(BASEEXT).bso
	rm -f *~ t/*~ lib/*~ eg/*~


realclean:: 	clean
	rm -f $(INST_DYNAMIC) $(INST_STATIC) $(INST_BOOT)
	rm -rf $(INST_PM) $(AUTOEXT) 

purge:	realclean


test: all
	$(FULLPERL) -I$(TOP)/lib -e 'use Test::Harness; runtests @ARGV;' t/*.t


# used if installperl will not be installing it for you
install:: all
	# not yet defined


$(OBJECT) : Makefile
$(OBJECT) : $(TOP)/EXTERN.h
$(OBJECT) : $(TOP)/INTERN.h
$(OBJECT) : $(TOP)/XSUB.h
$(OBJECT) : $(TOP)/av.h
$(OBJECT) : $(TOP)/cop.h
$(OBJECT) : $(TOP)/cv.h
$(OBJECT) : $(TOP)/dosish.h
$(OBJECT) : $(TOP)/embed.h
$(OBJECT) : $(TOP)/form.h
$(OBJECT) : $(TOP)/gv.h
$(OBJECT) : $(TOP)/handy.h
$(OBJECT) : $(TOP)/hv.h
$(OBJECT) : $(TOP)/keywords.h
$(OBJECT) : $(TOP)/mg.h
$(OBJECT) : $(TOP)/op.h
$(OBJECT) : $(TOP)/opcode.h
$(OBJECT) : $(TOP)/patchlevel.h
$(OBJECT) : $(TOP)/perl.h
$(OBJECT) : $(TOP)/perly.h
$(OBJECT) : $(TOP)/pp.h
$(OBJECT) : $(TOP)/proto.h
$(OBJECT) : $(TOP)/regcomp.h
$(OBJECT) : $(TOP)/regexp.h
$(OBJECT) : $(TOP)/scope.h
$(OBJECT) : $(TOP)/sv.h
$(OBJECT) : $(TOP)/unixish.h
$(OBJECT) : $(TOP)/util.h
$(TOP)/config.h:        $(TOP)/config.sh; cd $(TOP); /bin/sh config_h.SH
$(TOP)/embed.h: $(TOP)/config.sh; cd $(TOP); /bin/sh embed_h.SH
$(TOP)/cflags:  $(TOP)/config.sh; cd $(TOP); /bin/sh cflags.SH

Makefile:	Makefile.PL
	$(PERL) -I$(TOP)/lib Makefile.PL


distclean:     clean
	rm -f Makefile *~ t/*~
	cd ..; tar cvf "$(DISTNAME)-$(VERSION).tar" $(BASEEXT)
	cd ..; compress "$(DISTNAME)-$(VERSION).tar"


