# -----------------------------------------------------------------------
# $Id: lib_sh.in,v 1.6 1994/07/29 06:54:25 mjl Exp $
#
# Maurice LeBrun
# IFS, University of Texas at Austin
# 14-Jul-1994
#
# PLplot build rules for archive and shared library under Unix.
# -----------------------------------------------------------------------

# -----------------------------------------------------------------------
# Set up inference rules appropriate for building both archive and shared
# libraries. 
# -----------------------------------------------------------------------

.c$O:
	$(CC) $(CC_FLAGS) $*.c
	cd shared; $(CC) $(SHLIB_CCFLAGS) $(CC_FLAGS) ../$*.c

.f$O:
	$(F77) $(F77_FLAGS) $*.f
	cd shared; $(F77) $(SHLIB_F77FLAGS) $(F77_FLAGS) ../$*.f

# -----------------------------------------------------------------------
# Library dependency list and targets
# -----------------------------------------------------------------------

PLLIBS = $(PLLIB_AR) $(PLLIB_SH)

libs:	$(PLLIBS)

$(PLLIB_AR):	$(LIB_OBJS)
	-rm $(PLLIB_AR)
	@echo ""; echo "Building archive library"; echo ""
	$(ARLIB_BUILD) $(PLLIB_AR) $(LIB_OBJS)
	$(RANLIB) $(PLLIB_AR)

$(PLLIB_SH):	$(LIB_OBJS)
	-rm $(PLLIB_SH)
	@echo ""; echo "Building shared library"; echo ""
	cd shared; \
	$(SHLIB_BUILD) ../$(PLLIB_SH) $(LIB_OBJS)
	@echo ""

# -----------------------------------------------------------------------
# Sick hacks.
# -----------------------------------------------------------------------

# Needs to be compiled using K&R C.

tcpip$O:	plserver.h plplotTK.h plplotX.h plplotP.h plplot.h pdf.h \
		plstream.h tcpip.c
	$(OCC) $(CC_FLAGS) tcpip.c
	cd shared; $(OCC) $(SHLIB_CCFLAGS) $(CC_FLAGS) ../tcpip.c

# Optimizer under AIX 3.2.3 bogues out here.

xwin$O:		plplotP.h plplot.h drivers.h pdf.h plstream.h plplotX.h xwin.c
	$(CC) $(CC_FLAGS_XWIN) xwin.c
	cd shared; $(CC) $(SHLIB_CCFLAGS) $(CC_FLAGS_XWIN) ../xwin.c

# Optimizer on SX-3 makes bogus code here.

sccont$O:	plstubs.h plplotP.h plplot.h sccont.c
	$(CC) $(CC_FLAGS_SCCONT) sccont.c
	cd shared; $(CC) $(SHLIB_CCFLAGS) $(CC_FLAGS_SCCONT) ../sccont.c

