diff libcruft/Makefile.in @ 1682:e436e535e295

[project @ 1995-12-30 03:42:27 by jwe]
author jwe
date Sat, 30 Dec 1995 03:45:22 +0000
parents 6e8ac624ed9b
children 5738406d6759
line wrap: on
line diff
--- a/libcruft/Makefile.in	Sat Dec 30 03:39:44 1995 +0000
+++ b/libcruft/Makefile.in	Sat Dec 30 03:45:22 1995 +0000
@@ -32,7 +32,7 @@
 
 DISTFILES = Makefile.in Makerules.in $(SOURCES) STOP.patch
 
-all: $(SUBDIRS) libcruft.a
+all: $(SUBDIRS) libcruft.a stamp-shared
 .PHONY: all
 
 $(SUBDIRS):
@@ -40,17 +40,34 @@
 	cd $@; $(MAKE) all
 .PHONY: $(SUBDIRS)
 
-CRUFT_FSRC = $(foreach dir, $(SUBDIRS), $(wildcard $(srcdir)/$(dir)/*.f))
-CRUFT_OBJ3 = $(patsubst $(srcdir)/%, %, $(CRUFT_FSRC))
-CRUFT_OBJ2 = $(patsubst %.f, %.o, $(CRUFT_OBJ3))
-CRUFT_OBJ1 = $(subst misc/d1mach.o, , $(CRUFT_OBJ2))
-CRUFT_OBJ = $(CRUFT_OBJ1) misc/d1mach.o misc/dostop.o
+CRUFT_FSRC := $(foreach dir, $(SUBDIRS), $(wildcard $(srcdir)/$(dir)/*.f))
+CRUFT_OBJ3 := $(patsubst $(srcdir)/%, %, $(CRUFT_FSRC))
+CRUFT_OBJ2 := $(patsubst %.f, %.o, $(CRUFT_OBJ3))
+CRUFT_OBJ1 := $(subst misc/d1mach.o, , $(CRUFT_OBJ2))
+CRUFT_OBJ := $(CRUFT_OBJ1) misc/d1mach.o misc/dostop.o
+
+ifeq ($(SHARED_LIBS), true)
+  ifdef FPICFLAG
+    CRUFT_OBJ_DIR := $(dir $(CRUFT_OBJ))
+    CRUFT_OBJ_PICDIR := $(addsuffix pic/, $(CRUFT_OBJ_DIR))
+    CRUFT_OBJ_NOTDIR := $(notdir $(CRUFT_OBJ))
+    CRUFT_PICOBJ := $(join $(CRUFT_OBJ_PICDIR), $(CRUFT_OBJ_NOTDIR))
+  else
+    CRUFT_PICOBJ := $(CRUFT_OBJ)
+  endif
+endif
 
 libcruft.a: $(CRUFT_OBJ)
 	rm -f libcruft.a
 	$(AR) $(ARFLAGS) libcruft.a $(CRUFT_OBJ)
 	$(RANLIB) libcruft.a
 
+stamp-shared:
+	if $(SHARED_LIBS); then \
+	  $(CXX) -shared -o libcruft.$(SHLEXT) $(CRUFT_PICOBJ) $(FLIBS); \
+	else true; fi
+	touch stamp-shared
+
 $(CRUFT_OBJ):
 
 check: all
@@ -64,6 +81,10 @@
 	rm -f $(libdir)/libcruft.a
 	$(INSTALL_DATA) libcruft.a $(libdir)/libcruft.a
 	$(RANLIB) $(libdir)/libcruft.a
+	if $(SHARED_LIBS); then \
+	  rm -f $(libdir)/libcruft.$(SHLEXT); \
+	  $(INSTALL_DATA) libcruft.$(SHLEXT) $(libdir)/libcruft.$(SHLEXT); \
+	fi
 
 uninstall::
 	rm -f $(libdir)/libcruft.a