--- ../cracklib,2.7.orig/util/Makefile	Sun Dec 14 14:49:34 1997
+++ util/Makefile	Wed Apr 21 11:11:58 2004
@@ -14,27 +14,48 @@
 #SunOS users (and others?) should consider static linking of their passwd binary
 #CFLAGS= -O -I../cracklib '-DCRACKLIB_DICTPATH="$(DICTPATH)"' -Bstatic
 
-CFLAGS= -O -I../cracklib '-DCRACKLIB_DICTPATH="$(DICTPATH)"'
-LIBS=	../cracklib/libcrack.a
+PREFIX=		/usr/local
+CC=			gcc
+INSTALL=	install
+LN=			ln
+CFLAGS= -O2 -g -I../cracklib -L../cracklib '-DCRACKLIB_DICTPATH="$(DICTPATH)"'
+LDFLAGS=-L../cracklib
+LIBS=	-lcrack
 
 all:	packer unpacker testnum teststr testlib
 	touch all
 
-packer: packer.o $(LIBS)
-	cc $(CFLAGS) -o $@ $@.o $(LIBS)
+install: all
+	$(INSTALL) -d -m 0755 $(DESTDIR)$(PREFIX)/bin
+	$(INSTALL) -c -m 0755 mkdict $(DESTDIR)$(PREFIX)/bin
+	$(INSTALL) -c -m 0755 packer $(DESTDIR)$(PREFIX)/bin
+	$(INSTALL) -c -m 0755 unpacker $(DESTDIR)$(PREFIX)/bin
+	$(INSTALL) -c -m 0755 testlib $(DESTDIR)$(PREFIX)/bin
+	$(INSTALL) -c -m 0755 testnum $(DESTDIR)$(PREFIX)/bin
+	$(INSTALL) -c -m 0755 teststr $(DESTDIR)$(PREFIX)/bin
+	$(INSTALL) -d -m 0755 $(DESTDIR)$(PREFIX)/share/man/man1
+	$(INSTALL) -c -m 0644 mkdict.1 $(DESTDIR)$(PREFIX)/share/man/man1
+	$(LN) -fs mkdict.1 $(DESTDIR)$(PREFIX)/share/man/man1/packer.1
+	$(LN) -fs mkdict.1 $(DESTDIR)$(PREFIX)/share/man/man1/unpacker.1
+	$(INSTALL) -c -m 0644 teststr.1 $(DESTDIR)$(PREFIX)/share/man/man1
+	$(LN) -fs teststr.1 $(DESTDIR)$(PREFIX)/share/man/man1/testnum.1
+	$(LN) -fs teststr.1 $(DESTDIR)$(PREFIX)/share/man/man1/testlib.1
+
+packer: packer.o
+	$(CC) $(LDFLAGS) -o $@ $@.o $(LIBS)
+
+unpacker: unpacker.o
+	$(CC) $(LDFLAGS) -o $@ $@.o $(LIBS)
 
-unpacker: unpacker.o $(LIBS)
-	cc $(CFLAGS) -o $@ $@.o $(LIBS)
+testnum: testnum.o
+	$(CC) $(LDFLAGS) -o $@ $@.o $(LIBS)
 
-testnum: testnum.o $(LIBS)
-	cc $(CFLAGS) -o $@ $@.o $(LIBS)
+teststr: teststr.o
+	$(CC) $(LDFLAGS) -o $@ $@.o $(LIBS)
 
-teststr: teststr.o $(LIBS)
-	cc $(CFLAGS) -o $@ $@.o $(LIBS)
-
-testlib: testlib.o $(LIBS)
-	cc $(CFLAGS) -o $@ $@.o $(LIBS)
+testlib: testlib.o
+	$(CC) $(LDFLAGS) -o $@ $@.o $(LIBS)
 
 clean:
-	-rm *.o *~ all
-	-rm teststr testnum testlib packer unpacker
+	-rm -f *.o *~ all
+	-rm -f teststr testnum testlib packer unpacker
