This should make life a little simpler for those apps that use libtool to build DLLs and depend on libcrypt -- since libtool tries very hard to ensure that all dependencies of a DLL are themselves DLLs.

Corinna, please consider this patch.

--
Chuck
diff -urN crypt-1.0-2-orig/Makefile crypt-1.0-2/Makefile
--- crypt-1.0-2-orig/Makefile   2000-05-21 16:47:40.000000000 -0400
+++ crypt-1.0-2/Makefile        2003-10-18 17:16:59.526728000 -0400
@@ -3,24 +3,45 @@
 CFLAGS=-g -O2
 
 prefix:=/usr
+bindir=$(prefix)/bin
+libdir=$(prefix)/lib
+incdir=$(prefix)/include
+DLLVER=0
+EXE=.exe
 
-all: crypt
+STATICLIB=libcrypt.a
+SHAREDLIB=cygcrypt-$(DLLVER).dll
+IMPORTLIB=libcrypt.dll.a
 
-crypt: crypt.o libcrypt.a
-       $(CC) -o $@ crypt.o libcrypt.a
+APPS=crypt$(EXE)
+LIBS=$(STATICLIB) $(SHAREDLIB)
 
-libcrypt.a: encrypt.o
+all: $(APPS) $(LIBS)
+
+crypt$(EXE): crypt.o $(LIBS)
+       $(CC) -static -o $@ crypt.o -L. -lcrypt
+
+$(STATICLIB): encrypt.o
        ar rv $@ encrypt.o
 
+$(SHAREDLIB): encrypt.o
+       $(CC) -shared -Wl,--out-implib=$(IMPORTLIB) -Wl,--export-all \
+       $^ -o $@
+
 encrypt.o: encrypt.h
 
 distclean: clean
 
 clean:
-       -rm *.o *.exe *.a
+       -rm *.o *.exe *.a *.dll
 
 install: all
-       install -s crypt.exe $(prefix)/bin
-       install encrypt.h $(prefix)/include/crypt.h
-       install libcrypt.a $(prefix)/lib
+       if [ ! -d $(DESTDIR)$(bindir) ] ; then mkdir -p $(DESTDIR)$(bindir) ; fi
+       if [ ! -d $(DESTDIR)$(libdir) ] ; then mkdir -p $(DESTDIR)$(libdir) ; fi
+       if [ ! -d $(DESTDIR)$(incdir) ] ; then mkdir -p $(DESTDIR)$(incdir) ; fi
+       install -m 755 -s $(APPS)      $(DESTDIR)$(bindir)
+       install -m 644 encrypt.h       $(DESTDIR)$(incdir)/crypt.h
+       install -m 644 $(STATICLIB)    $(DESTDIR)$(libdir)
+       install -m 644 $(IMPORTLIB)    $(DESTDIR)$(libdir)
+       install -m 755 -s $(SHAREDLIB) $(DESTDIR)$(bindir)
 

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

Reply via email to