--- makefile.orig	Wed Sep 25 23:32:22 1996
+++ makefile	Mon Mar 13 01:34:19 2000
@@ -1,7 +1,7 @@
 PURIFY   = #purify
 PURELINK = #purelink
-C++    = $(PURIFY) g++  
-LD     = $(PURELINK) g++
+C++    = ${CXX}
+LD     = ${CXX}
 
 #C++    = $(PURIFY) g++ -w  -I/sgisoft/gnu/lib/g++-include 	# !!! SGI GNU 2.7.1
 #LD     = $(PURIFY) g++ -w 
@@ -18,25 +18,33 @@
 #FORFLAGS = -O -extend_source 				# SGI
 
 DEBFLAG  = -g
-OPTFLAG  = -Wall -O -g
+OPTFLAG  = ${CXXFLAGS}
 
 LIBS     = -lX11 -lm $(F77LIBS) 
-#LIBDIR  = /usr/X11/lib						# PC LINUX, XFree86 3.1.1
+.if ${PORTOBJFORMAT} == "elf"
+LIBS+=-Wl,-rpath,${X11BASE}/lib
+.endif
 
-F77LIBS  = -L/opt/SUNWspro/SC4.0/lib -lF77 -lM77 -lsunmath -lsocket -lnsl # SUN
+LIBDIR  = ${X11BASE}/lib
+
+#F77LIBS  = -L/opt/SUNWspro/SC4.0/lib -lF77 -lM77 -lsunmath -lsocket -lnsl # SUN
 #F77LIBS  = -lftn						# SGI
 #F77LIBS  = -L/opt/SUNWspro/SC3.0/lib -lF77 -lM77 -lcomplex -lsunmath  -lnsl -lsocket # SUN SC3.0
 # F77LIBS  =  -lxlf -lxlf90 -lxlfutil     			# IBM
 # F77LIBS  =  -lfor     			      		# DEC Alpha
-# F77LIBS  =  -lf2c						# PC LINUX, XFree86 3.1.1
-
-CFLAGS   = -ansi 
-CPPFLAGS =  
-LDFLAGS  = $(DEBFLAG)
+.if defined(HAVE_G2C)
+F77LIBS  =  -lg2c						# PC LINUX, XFree86 3.1.1
+.else
+F77LIBS  =  -lf2c						# PC LINUX, XFree86 3.1.1
+.endif
+
+#CFLAGS   = -ansi 
+CPPFLAGS = -I${X11BASE}/include
+#LDFLAGS  = $(DEBFLAG)
 
 # -------------------------------------------------------------------------
 
-TargetDirectory = /temp		# used for command 'copy'
+TargetDirectory = /tmp		# used for command 'copy'
 
 default: k6
 
@@ -77,18 +85,18 @@
 FSources = ma28.f madc28.f
 
 # SUN / SGI:
-ma28.o: ma28.f sysmat.h sysmatml.h sysmatsp.h 
-	$(FOR) -c $(FORFLAGS) ma28.f
-madc28.o: madc28.f sysmat.h sysmatml.h sysmatsp.h 
-	$(FOR) -c $(FORFLAGS) madc28.f
-
-
-# SUN and PC LINUX:
 #ma28.o: ma28.f sysmat.h sysmatml.h sysmatsp.h 
 #	$(FOR) -c $(FORFLAGS) ma28.f
 #madc28.o: madc28.f sysmat.h sysmatml.h sysmatsp.h 
 #	$(FOR) -c $(FORFLAGS) madc28.f
 
+
+# SUN and PC LINUX:
+ma28.o: ma28.f sysmat.h sysmatml.h sysmatsp.h 
+	$(FOR) -c $(FORFLAGS) ma28.f
+madc28.o: madc28.f sysmat.h sysmatml.h sysmatsp.h 
+	$(FOR) -c $(FORFLAGS) madc28.f
+
 # IBM:
 #ma28.o: ma28.f  sysmat.h sysmatml.h sysmatsp.h 
 #	$(FOR)  -c -qextname  $(FORFLAGS) ma28.f
@@ -224,12 +232,12 @@
 k3: 	$(k3O) 
 	$(LD) $(LDFLAGS) -o  k3   $(k3O) $(LIBS)
 
-k6: 	$(k6O) 
-	$(LD) $(LDFLAGS) -o  k6   $(k6O) $(LIBS)
+#k6: 	$(k6O) 
+#	$(LD) $(LDFLAGS) -o  k6   $(k6O) $(LIBS)
 
 #	under PC Linux add "-L$(LIBDIR)"
-#k6: 	$(k6O) 
-#	$(LD) $(LDFLAGS) -o  k6   $(k6O) $(LIBS) -L$(LIBDIR)
+k6: 	$(k6O) 
+	$(LD) $(LDFLAGS) -o  k6   $(k6O) $(LIBS) -L$(LIBDIR)
 
 
 
