--- makemake.orig	2009-02-28 16:57:42.000000000 -0500
+++ makemake	2009-02-28 16:58:30.000000000 -0500 
@@ -100,6 +100,7 @@
 #-----------------------------------------------------------------------
 # Device drivers
 #-----------------------------------------------------------------------
+AQDRIV="aqdriv.o"
 ARDRIV="ardriv.o"
 BCDRIV="bcdriv.o"
 CADRIV="cadriv.o"
@@ -657,7 +658,9 @@
 # Shared library creation.
 #
 SHARED_LIB=$SHARED_LIB
+CSHARED_LIB=$CSHARED_LIB
 SHARED_LD=$SHARED_LD
+CSHARED_LD=$CSHARED_LD
 #
 # The libraries that the shared PGPLOT library depends upon.
 # This is for systems that allow one to specify what libraries
@@ -824,7 +827,7 @@
 cat >> makefile << \EOD
 $(SHARED_LIB): $(PG_ROUTINES) $(PG_NON_STANDARD) \
 	$(GR_ROUTINES) $(DISPATCH_ROUTINE) $(DRIVERS) $(SYSTEM_ROUTINES)
-	$(SHARED_LD) `ls $(PG_ROUTINES) \
+	$(SHARED_LD) -o $@ `ls $(PG_ROUTINES) \
 	$(PG_NON_STANDARD) $(GR_ROUTINES) $(DISPATCH_ROUTINE) \
 	$(DRIVERS) $(SYSTEM_ROUTINES) | sort | uniq` $(SHARED_LIB_LIBS)
 EOD
@@ -1025,32 +1028,41 @@
 grivas.o : $(DRVDIR)/gadef.h
 grtv00.o : $(DRVDIR)/imdef.h
 pgxwin.o : $(DRVDIR)/pgxwin.h
-pndriv.o : ./png.h ./pngconf.h ./zlib.h ./zconf.h
 
 x2driv.o figdisp_comm.o: $(DRVDIR)/commands.h
 
 
-cpg:	libcpgplot.a cpgplot.h cpgdemo 
+cpg:	libcpgplot.a cpgplot.h $(CSHARED_LIB) cpgdemo 
 	@echo ' '
 	@echo '*** Finished compilation of the C PGPLOT wrapper library ***'
 	@echo ' '
 	@echo 'Note that if you plan to install the library in a different'
-	@echo 'directory than the current one, both libcpgplot.a and cpgplot.h'
+	@echo 'directory than the current one, both libcpgplot.a, $(CSHARED_LIB), and cpgplot.h'
 	@echo 'will be needed.'
 	@echo ' '
 
 pgbind: $(SRC)/cpg/pgbind.c
 	$(CCOMPL) $(CFLAGC) $(SRC)/cpg/pgbind.c -o pgbind
 
-libcpgplot.a cpgplot.h: $(PG_SOURCE) pgbind 
-	./pgbind $(PGBIND_FLAGS) -h -w $(PG_SOURCE)
+cpgplot.h: $(PG_SOURCE) pgbind
+	./pgbind $(PGBIND_FLAGS) -h $(PG_SOURCE)
+
+libcpgplot.a : cpgplot.h
+	./pgbind $(PGBIND_FLAGS) -w $(PG_SOURCE)
 	$(CCOMPL) -c $(CFLAGC) cpg*.c
 	rm -f cpg*.c
 	ar ru libcpgplot.a cpg*.o
 	$(RANLIB) libcpgplot.a
 	rm -f cpg*.o
 
-cpgdemo: cpgplot.h $(SRC)/cpg/cpgdemo.c libcpgplot.a
+$(CSHARED_LIB): cpgplot.h
+	./pgbind $(PGBIND_FLAGS) -w $(PG_SOURCE)
+	$(CCOMPL) -c $(CFLAGC) cpg*.c
+	rm -f cpg*.c
+	$(CSHARED_LD) -o $@ cpg*.o $(SHARED_LIB)
+	rm -f cpg*.o
+
+cpgdemo: cpgplot.h $(SRC)/cpg/cpgdemo.c $(CSHARED_LIB)
 	$(CCOMPL) $(CFLAGD) -c -I. $(SRC)/cpg/cpgdemo.c
 	$(FCOMPL) -o cpgdemo cpgdemo.o $(CPGPLOT_LIB) $(LIBS)
 	rm -f cpgdemo.o
@@ -1058,13 +1070,13 @@
 pgmdemo: pgmdemo.o libXmPgplot.a
 	$(FCOMPL) -o pgmdemo pgmdemo.o -L`pwd` -lXmPgplot $(CPGPLOT_LIB) $(MOTIF_LIBS)
 
-pgmdemo.o: $(XMDIR)/pgmdemo.c XmPgplot.h libcpgplot.a cpgplot.h
+pgmdemo.o: $(XMDIR)/pgmdemo.c XmPgplot.h $(CSHARED_LIB) cpgplot.h
 	$(CCOMPL) $(CFLAGD) -c -I`pwd` $(MOTIF_INCL) $(XMDIR)/pgmdemo.c
 
 pgawdemo: pgawdemo.o libXaPgplot.a
 	$(FCOMPL) -o pgawdemo pgawdemo.o -L`pwd` -lXaPgplot $(CPGPLOT_LIB) $(ATHENA_LIBS)
 
-pgawdemo.o: $(XADIR)/pgawdemo.c XaPgplot.h libcpgplot.a cpgplot.h
+pgawdemo.o: $(XADIR)/pgawdemo.c XaPgplot.h $(CSHARED_LIB) cpgplot.h
 	$(CCOMPL) $(CFLAGD) -c -I`pwd` $(ATHENA_INCL) $(XADIR)/pgawdemo.c
 
 pgtkdemo: pgtkdemo.o libtkpgplot.a
@@ -1074,6 +1086,6 @@
 	cp $(TKDIR)/pgtkdemo.tcl pgtkdemo.tcl
 	chmod a+x pgtkdemo.tcl
 
-pgtkdemo.o: $(TKDIR)/pgtkdemo.c tkpgplot.h libcpgplot.a cpgplot.h
+pgtkdemo.o: $(TKDIR)/pgtkdemo.c tkpgplot.h $(CSHARED_LIB) cpgplot.h
 	$(CCOMPL) $(CFLAGD) -c -I`pwd` $(TK_INCL) $(TKDIR)/pgtkdemo.c
 EOD