diff --git a/Makefile.src b/Makefile.src
index e3744b1528e9a7b7350fd9f471c72bb67ca1b6ed..799bd4efd3badbe4a10a70365d2ba1a2d2ae70d8 100644
--- a/Makefile.src
+++ b/Makefile.src
@@ -1,5 +1,4 @@
-#
-# $Id: Makefile.src,v 1.6 1993/11/22 18:34:37 ceder Exp $
+# $Id: Makefile.src,v 1.7 1994/03/03 00:35:45 ceder Exp $
 # Copyright (C) 1991  Lysator Academic Computer Association.
 #
 # This file is part of the LysKOM server.
@@ -23,33 +22,19 @@
 # Please mail bug reports to bug-lyskom@lysator.liu.se. 
 #
 
-srcdir = @srcdir@
-VPATH = @srcdir@
-@STDLYSKOM@
-
-SUBDIRS = doc scripts src # config # junk
-SERVER-VER = 1.5
-
-all: msg includes libraries binaries end-msg
+LK_STD
+[SUBDIRS = doc scripts src # config # junk
+SERVER-VER = 1.6
 
-@ALL_DESCEND@
+all: msg includes libraries binaries end-msg]
 
-doincludes:;
-dolibraries:;
-dobinaries:;
-doinstall:;
-dodepend:;
-dopure: dorealclean
-	$(RM) configure
-dorealclean: dodistclean;
-dodistclean: doclean
-	$(RM) $(GENERIC-DISTCLEAN) config.status
+LK_DESCEND
+define([dopure],[LK_CMD([$(RM) configure])])
+define([dodistclean],dnl
+[[	$(RM) $(GENERIC-DISTCLEAN) config.status
 	$(RM) lib/lib*.a
-	rmdir lib
-doclean: domostlyclean;
-domostlyclean:
-	$(RM) $(GENERIC-MOSTLYCLEAN)
-
+	rmdir lib]])
+[
 includes: $(INCLUDEDIR)
 depend: $(INCLUDEDIR) msg includes
 libraries: lib
@@ -57,50 +42,57 @@ libraries: lib
 lib:
 	mkdir lib
 
-configure: configure.in
-	autoconf
+$(srcdir)/configure: configure.in
+	autoconf $(srcdir)/configure.in > $(srcdir)/configure
 
-distribution: distclean configure
-	find . -name '#*#' -print
+.PHONY: distribution
+distribution: $(srcdir)/configure
+	[ ! -f $(srcdir)/Makefile ]
+	find $(srcdir) -name '#*#' -print
 	-$(RM) -r lyskom-$(SERVER-VER)
 	$(MKDIR) lyskom-$(SERVER-VER)
-	cp README-serverrelease lyskom-$(SERVER-VER)/README
-	cp COPYING INSTALL configure configure.in Build Makefile.in \
-		lyskom-$(SERVER-VER)/
+	cp $(srcdir)/README-serverrelease lyskom-$(SERVER-VER)/README
+	for i in COPYING INSTALL configure configure.in Build Makefile.in ; \
+	    do cp $(srcdir)/$$i lyskom-$(SERVER-VER)/; done
 	$(MKDIR) lyskom-$(SERVER-VER)/src
-	cp src/Makefile.in lyskom-$(SERVER-VER)/src/
+	cp $(srcdir)/src/Makefile.in lyskom-$(SERVER-VER)/src/
 	$(MKDIR) lyskom-$(SERVER-VER)/src/libraries
-	cp src/libraries/Makefile.in lyskom-$(SERVER-VER)/src/libraries/
+	cp $(srcdir)/src/libraries/Makefile.in \
+	    lyskom-$(SERVER-VER)/src/libraries/
 	$(MKDIR) lyskom-$(SERVER-VER)/doc
 	for i in ADMINISTRATION Makefile.in misc_items prot-A.txt	\
 		server-async.extend server.extend what-is-unread.swe; 	\
+		server-config.extend					\
 	do 								\
-		cp doc/$$i lyskom-$(SERVER-VER)/doc/$i;			\
+		cp $(srcdir)/doc/$$i lyskom-$(SERVER-VER)/doc/$i;	\
 	done
-	cp -r doc/man lyskom-$(SERVER-VER)/doc/man
-	cp -r scripts lyskom-$(SERVER-VER)/scripts
+	cp -r $(srcdir)/doc/man lyskom-$(SERVER-VER)/doc/man
+	cp -r $(srcdir)/scripts lyskom-$(SERVER-VER)/scripts
+	# Nothing in scripts should be necessary!
 	$(RM) lyskom-$(SERVER-VER)/scripts/import.make
-	cp -r run-support lyskom-$(SERVER-VER)/run-support
-	cp -r src/libraries/libansi lyskom-$(SERVER-VER)/src/libraries
-	cp -r src/libraries/libcommon lyskom-$(SERVER-VER)/src/libraries
-	cp -r src/libraries/libisc-new lyskom-$(SERVER-VER)/src/libraries
-	cp -r src/libraries/libmisc lyskom-$(SERVER-VER)/src/libraries
-	cp -r src/libraries/regex lyskom-$(SERVER-VER)/src/libraries
-	cp -r src/server lyskom-$(SERVER-VER)/src
-	cp -r src/include lyskom-$(SERVER-VER)/src/include
+	cp -r $(srcdir)/run-support lyskom-$(SERVER-VER)/run-support
+	if i in libansi libcommon libisc-new libmisc regex ; do \
+		cp -r $(srcdir)/src/libraries/$$i \
+			lyskom-$(SERVER-VER)/src/libraries \
+		|| exit 1 ; \
+	done
+	cp -r $(srcdir)/src/server lyskom-$(SERVER-VER)/src
+	cp -r $(srcdir)/src/include lyskom-$(SERVER-VER)/src/include
 	$(RM) -r lyskom-$(SERVER-VER)/src/include/ansi
-	cp -r db-crypt lyskom-$(SERVER-VER)
-	cp -r db-nocrypt lyskom-$(SERVER-VER)
+	cp -r $(srcdir)/db-crypt lyskom-$(SERVER-VER)
+	cp -r $(srcdir)/db-nocrypt lyskom-$(SERVER-VER)
 	find lyskom-$(SERVER-VER) -name CVS -print -exec rm -rf "{}" \; -prune
 	tar cvf lyskom-$(SERVER-VER).tar lyskom-$(SERVER-VER)
 	$(RM) lyskom-$(SERVER-VER).tar.gz
-	gzip lyskom-$(SERVER-VER).tar
+	gzip -9v lyskom-$(SERVER-VER).tar
 	$(RM) -r lyskom-$(SERVER-VER)
 
+.PHONY: msg
 msg:
 	@date
 	@echo
 
+.PHONY: end-msg
 end-msg:
 	@echo
 	@echo Finished at
@@ -108,3 +100,4 @@ end-msg:
 
 $(INCLUDEDIR):
 	mkdir $(INCLUDEDIR)
+]
diff --git a/doc/Makefile.src b/doc/Makefile.src
index bee133472c3a97eb285dfe7be91a02d342151ab3..00db105ed9cfa4166d97c6ae63b2b3b7a98942da 100644
--- a/doc/Makefile.src
+++ b/doc/Makefile.src
@@ -1,5 +1,5 @@
 #
-# $Id: Makefile.src,v 1.2 1993/10/10 11:38:33 ceder Exp $
+# $Id: Makefile.src,v 1.3 1994/03/03 00:35:54 ceder Exp $
 # Copyright (C) 1991  Lysator Academic Computer Association.
 #
 # This file is part of the LysKOM server.
@@ -22,26 +22,6 @@
 #
 # Please mail bug reports to bug-lyskom@lysator.liu.se. 
 #
-
-srcdir = @srcdir@
-VPATH = @srcdir@
-
-SUBDIRS = man
-
-all:;
-depend:;
-includes:;
-libraries:;
-binaries:;
-
-@CLEAN@
-@INSTALL_DESCEND@
-
-doinstall:;
-dopure: dorealclean;
-dorealclean: dodistclean;
-dodistclean: doclean
-	$(RM) $(GENERIC-DISTCLEAN)
-doclean: domostlyclean;
-domostlyclean:
-	$(RM) $(GENERIC-MOSTLYCLEAN)
+LK_STD
+[SUBDIRS = man]
+LK_DESCEND
diff --git a/doc/man/Makefile.src b/doc/man/Makefile.src
index 94c0a9f2c06050543bebf9f02c9b9f40f67330e0..4b83373573b8e7c95d5cf03c72bfad83637af2cc 100644
--- a/doc/man/Makefile.src
+++ b/doc/man/Makefile.src
@@ -1,5 +1,5 @@
 #
-# $Id: Makefile.src,v 1.3 1994/02/24 10:38:51 ceder Exp $
+# $Id: Makefile.src,v 1.4 1994/03/03 00:36:05 ceder Exp $
 # Copyright (C) 1991  Lysator Academic Computer Association.
 #
 # This file is part of the LysKOM server.
@@ -22,35 +22,25 @@
 #
 # Please mail bug reports to bug-lyskom@lysator.liu.se. 
 #
-@STDLYSKOM@
-
-man5dir = \$(prefix)/man/man5\\
-man8dir = \$(prefix)/man/man8\\
-man5ext = .5\\
-man8ext = .8\\
+LK_STD
+[
+SUBDIRS =
+man5dir = $(prefix)/man/man5
+man8dir = $(prefix)/man/man8
+man5ext = .5
+man8ext = .8
 
 # List of man pages in the various sections to install
 MAN5 = lyskom
 MAN8 = dbck lyskomd updateLysKOM
-
-all:;
-depend:;
-
-@CLEAN@
-dopure: dorealclean
-dorealclean: dodistclean;
-dodistclean: doclean
-	$(RM) $(GENERIC-DISTCLEAN)
-doclean: domostlyclean
-domostlyclean:
-	$(RM) $(GENERIC-MOSTLYCLEAN)
-
-install:
-	-for i in $(MAN5); \
+]
+define([doinstall],dnl
+[[	-for i in $(MAN5); \
 	do \
 		$(INSTALL_DATA) $$i.5 $(man5dir)/$$i.$(man5ext); \
 	done
 	-for i in $(MAN8); \
 	do \
 		$(INSTALL_DATA) $$i.8 $(man8dir)/$$i.$(man8ext); \
-	done
+	done]])dnl
+LK_DESCEND
diff --git a/scripts/Makefile.src b/scripts/Makefile.src
index ca4b1025d06a160c4f898a559234d70267ac9472..4efaa51dd637c0c859a1f9d79b3809147a7db255 100644
--- a/scripts/Makefile.src
+++ b/scripts/Makefile.src
@@ -1,5 +1,5 @@
 #
-# $Id: Makefile.src,v 1.2 1993/10/10 11:38:46 ceder Exp $
+# $Id: Makefile.src,v 1.3 1994/03/03 00:36:14 ceder Exp $
 # Copyright (C) 1991  Lysator Academic Computer Association.
 #
 # This file is part of the LysKOM server.
@@ -22,23 +22,6 @@
 #
 # Please mail bug reports to bug-lyskom@lysator.liu.se. 
 #
-
-srcdir = @srcdir@
-VPATH = @srcdir@
-
-all:;
-depend:;
-install:;
-includes:;
-libraries:;
-binaries:;
-	
-
-@CLEAN@
-dopure: dorealclean
-dorealclean: dodistclean;
-dodistclean: doclean
-	$(RM) $(GENERIC-DISTCLEAN)
-doclean: domostlyclean;
-domostlyclean:
-	$(RM) $(GENERIC-MOSTLYCLEAN)
+LK_STD
+[SUBDIRS=]
+LK_DESCEND	
diff --git a/src/Makefile.src b/src/Makefile.src
index fbdff7a86735feacfbe28b6eaf5332d690c5f75f..28602febc3b3b423b352912f605ca4599edc3118 100644
--- a/src/Makefile.src
+++ b/src/Makefile.src
@@ -1,5 +1,5 @@
 #
-# $Id: Makefile.src,v 1.2 1993/10/10 11:38:53 ceder Exp $
+# $Id: Makefile.src,v 1.3 1994/03/03 00:36:25 ceder Exp $
 # Copyright (C) 1991  Lysator Academic Computer Association.
 #
 # This file is part of the LysKOM server.
@@ -22,26 +22,6 @@
 #
 # Please mail bug reports to bug-lyskom@lysator.liu.se. 
 #
-
-srcdir = @srcdir@
-VPATH = @srcdir@
-@STDLYSKOM@
-
-SUBDIRS = include libraries server # komutils clients
-
-all: includes libraries binaries
-
-@ALL_DESCEND@
-
-doincludes:;
-dolibraries:;
-dobinaries:;
-doinstall:;
-dodepend:;
-dopure: dorealclean
-dorealclean: dodistclean;
-dodistclean: doclean
-	$(RM) $(GENERIC-DISTCLEAN)
-doclean: domostlyclean;
-domostlyclean:
-	$(RM) $(GENERIC-MOSTLYCLEAN)
+LK_STD
+[SUBDIRS = include libraries server]
+LK_DESCEND
diff --git a/src/include/Makefile.src b/src/include/Makefile.src
index 4668a0b609cbefbe55bc2c68f7de902a3905d0c2..87ff6be3a43f6d11e2da933ecd11ba0937a64114 100644
--- a/src/include/Makefile.src
+++ b/src/include/Makefile.src
@@ -1,5 +1,5 @@
 #
-# $Id: Makefile.src,v 1.2 1993/10/10 11:39:03 ceder Exp $
+# $Id: Makefile.src,v 1.3 1994/03/03 00:36:34 ceder Exp $
 # Copyright (C) 1991  Lysator Academic Computer Association.
 #
 # This file is part of the LysKOM server.
@@ -22,37 +22,8 @@
 #
 # Please mail bug reports to bug-lyskom@lysator.liu.se. 
 #
-
-srcdir = @srcdir@
-VPATH = @srcdir@
-@STDLYSKOM@
-
-SUBDIRS = server # ansi 
-
-INSTALL-HDRS = compiler.h debug.h kom-types.h config.h kom-errno.h \
-	misc-types.h services.h rcs.h
-
-all: includes libraries binaries
-
-libraries:;
-binaries:;
-
-
-@INCLUDES_DESCEND@
-doincludes:
-	for i in $(INSTALL-HDRS) ; \
-	do	\
-		( cmp $(srcdir)/$$i $(INCLUDEDIR)/$$i 2>/dev/null ) \
-		  || cp $(srcdir)/$$i $(INCLUDEDIR)/$$i; \
-	done;
-
-@CLEAN@
-dopure: dorealclean
-dorealclean: dodistclean;
-dodistclean: doclean
-	$(RM) $(GENERIC-DISTCLEAN)
-doclean: domostlyclean;
-domostlyclean:
-	$(RM) $(GENERIC-MOSTLYCLEAN)
-
-depend:;
+LK_STD
+[SUBDIRS = server]
+LK_INSTALL_HDRS([compiler.h debug.h kom-types.h config.h kom-errno.h dnl
+	misc-types.h services.h rcs.h])
+LK_DESCEND
diff --git a/src/include/server/Makefile.src b/src/include/server/Makefile.src
index 28210eca6b77b5ca6fa9e4135e328e0222049c9e..584222c85ef59fb750ed30076a9df274520e7154 100644
--- a/src/include/server/Makefile.src
+++ b/src/include/server/Makefile.src
@@ -1,5 +1,5 @@
 #
-# $Id: Makefile.src,v 1.2 1993/10/10 11:39:11 ceder Exp $
+# $Id: Makefile.src,v 1.3 1994/03/03 00:36:44 ceder Exp $
 # Copyright (C) 1991  Lysator Academic Computer Association.
 #
 # This file is part of the LysKOM server.
@@ -22,34 +22,6 @@
 #
 # Please mail bug reports to bug-lyskom@lysator.liu.se. 
 #
-srcdir = @srcdir@
-VPATH = @srcdir@
-@STDLYSKOM@
-
-INSTALL-HDRS = smalloc.h
-
-all: includes libraries binaries
-
-libraries:;
-binaries:;
-
-.PHONY : includes
-includes:
-	if [ ! -d $(INCLUDEDIR)/server ] ;then \
-		 $(MKDIR) $(INCLUDEDIR)/server; \
-	fi
-	for i in $(INSTALL-HDRS);\
-	do	\
-		( cmp $(srcdir)/$$i $(INCLUDEDIR)/server/$$i 2>/dev/null ) \
-		|| cp $(srcdir)/$$i $(INCLUDEDIR)/server/$$i; \
-	done
-
-@CLEAN@
-depend:;
-dopure: dorealclean
-dorealclean: dodistclean;
-dodistclean: doclean
-	$(RM) $(GENERIC-DISTCLEAN)
-doclean: domostlyclean;
-domostlyclean:
-	$(RM) $(GENERIC-MOSTLYCLEAN)
+LK_STD
+LK_INSTALL_HDRS([smalloc.h],[/server])
+LK_DESCEND
diff --git a/src/libraries/Makefile.src b/src/libraries/Makefile.src
index 3345441971568ff82a06130525c67adab0e8abb8..faa02bb39b0b0149c621e2e4cb28cdd0d7f00527 100644
--- a/src/libraries/Makefile.src
+++ b/src/libraries/Makefile.src
@@ -1,33 +1,27 @@
-VPATH = @srcdir@
-SUBMAKEFLAGS = MAKE='${MAKE}' OPTFLAGS='${OPTFLAGS}'
-
-# This target is used by tty-client.
-all: libclient-sup.a liblyskom-client.a libmisc.a
-
-.PHONY: libclient-sup.a liblyskom-client.a libmisc.a
-
-libclient-sup.a:
-	cd libclient; ${MAKE} -f client-Makefile ${SUBMAKEFLAGS}
-
-liblyskom-client.a:
-	cd libcommon; ${MAKE} -f client-Makefile ${SUBMAKEFLAGS}
-
-libmisc.a:
-	cd libmisc; ${MAKE} -f client-Makefile ${SUBMAKEFLAGS}
-
-# The remaining of the Makefile is used by the server.
-@STDLYSKOM@
-SUBDIRS = libisc-new libansi regex libcommon libmisc
-@ALL_DESCEND@
-doincludes:;
-dolibraries:;
-dobinaries:;
-doinstall:;
-dodepend:;
-dopure: dorealclean
-dorealclean: dodistclean;
-dodistclean: doclean
-	$(RM) $(GENERIC-DISTCLEAN)
-doclean: domostlyclean;
-domostlyclean:
-	$(RM) $(GENERIC-MOSTLYCLEAN)
+#
+# $Id: Makefile.src,v 1.6 1994/03/03 00:36:52 ceder Exp $
+# Copyright (C) 1991  Lysator Academic Computer Association.
+#
+# This file is part of the LysKOM server.
+# 
+# LysKOM is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by 
+# the Free Software Foundation; either version 1, or (at your option) 
+# any later version.
+# 
+# LysKOM is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with LysKOM; see the file COPYING.  If not, write to
+# Lysator, c/o ISY, Linkoping University, S-581 83 Linkoping, SWEDEN,
+# or the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, 
+# MA 02139, USA.
+#
+# Please mail bug reports to bug-lyskom@lysator.liu.se. 
+#
+LK_STD
+[SUBDIRS = libisc-new libansi regex libcommon libmisc]
+LK_DESCEND
diff --git a/src/libraries/libansi/Makefile.src b/src/libraries/libansi/Makefile.src
index 903760088574f64bc74bf9030d5540724a49484d..ef92a97ce6b4f26bd2ea1516bf930d3fdaeb8fdb 100644
--- a/src/libraries/libansi/Makefile.src
+++ b/src/libraries/libansi/Makefile.src
@@ -1,5 +1,5 @@
 #
-# $Id: Makefile.src,v 1.3 1993/10/10 22:33:52 ceder Exp $
+# $Id: Makefile.src,v 1.4 1994/03/03 00:37:01 ceder Exp $
 # Copyright (C) 1991  Lysator Academic Computer Association.
 #
 # This file is part of the LysKOM server.
@@ -22,43 +22,10 @@
 #
 # Please mail bug reports to bug-lyskom@lysator.liu.se. 
 #
-srcdir = @srcdir@
-VPATH = @srcdir@
-@STDLYSKOM@
-
-LIBNAME = libansi$(PROFILE-LIB-SUFFIX).a
-LIBOBJS = @LIBOBJS@ empty.o
-
-INSTALL-HDRS = tmp-difftime.h
-
-all:	$(LIBNAME)
-
-$(LIBNAME): $(LIBOBJS)
-	$(AR) $(ARFLAGS) $(LIBNAME) $?
-	$(RANLIB) $(LIBNAME)
-
-include $(SCRIPTDIR)/install-includes.make
-
-libraries: $(LIBNAME)
-	$(RM) $(LIBDIR)/$(LIBNAME)
-	cp $(LIBNAME) $(LIBDIR)/$(LIBNAME)
-	$(TOUCHLIB) $(LIBDIR)/$(LIBNAME)
-
-binaries:;
-
-@CLEAN@
-dopure: dorealclean
-dorealclean: dodistclean;
-dodistclean: doclean
-	$(RM) $(GENERIC-DISTCLEAN)
-doclean: domostlyclean;
-domostlyclean:
-	$(RM) $(GENERIC-MOSTLYCLEAN)
-
-# Recreate the Makefile
-include $(SCRIPTDIR)/Single-depend.make
-
-tags:
-	etags -t *.[hc]	
-
-include dependencies
+LK_STD
+LK_INSTALL_HDRS(tmp-difftime.h)
+LK_STD_LIB([libansi$(PROFILE-LIB-SUFFIX).a],[@LIBOBJS@ empty.o])
+LK_ALL_C_DEPEND
+LK_DESCEND
+[tags:
+	etags -t *.[hc]]
diff --git a/src/libraries/libcommon/Makefile.src b/src/libraries/libcommon/Makefile.src
index 9dd01e689924f6590170941b9b0b8be8527dd9ab..0c703e1186847d8cb41a4f312c4e3c7c988b82a7 100644
--- a/src/libraries/libcommon/Makefile.src
+++ b/src/libraries/libcommon/Makefile.src
@@ -1,5 +1,5 @@
 #
-# $Id: Makefile.src,v 1.2 1993/10/10 11:39:38 ceder Exp $
+# $Id: Makefile.src,v 1.3 1994/03/03 00:37:10 ceder Exp $
 # Copyright (C) 1991  Lysator Academic Computer Association.
 #
 # This file is part of the LysKOM server.
@@ -22,42 +22,11 @@
 #
 # Please mail bug reports to bug-lyskom@lysator.liu.se. 
 #
-srcdir = @srcdir@
-VPATH = @srcdir@
-@STDLYSKOM@
-LIBOBJS = kom-errno.o misc-parser.o parser.o
-INSTALL-HDRS = misc-parser.h parser.h
-LIBRARIES = liblyskom-server$(PROFILE-LIB-SUFFIX).a
-
-all: $(LIBRARIES)
-
-liblyskom-server$(PROFILE-LIB-SUFFIX).a: $(LIBOBJS)
-	$(AR) $(ARFLAGS) $@ $?
-	$(RANLIB) $@
-
-@CLEAN@
-dopure: dorealclean
-dorealclean: dodistclean;
-dodistclean: doclean
-	$(RM) $(GENERIC-DISTCLEAN)
-doclean: domostlyclean
-domostlyclean:
-	$(RM) $(GENERIC-MOSTLYCLEAN)
-
-libraries: liblyskom-server$(PROFILE-LIB-SUFFIX).a
-	(cd $(LIBDIR); $(RM)  $(LIBRARIES))
-	cp $(LIBRARIES) $(LIBDIR)
-	(cd $(LIBDIR); $(TOUCHLIB) $(LIBRARIES))
-
-include $(SCRIPTDIR)/install-includes.make
-
-binaries:;
-
-tags:
-	etags -t $(INCLUDEDIR)/*.h *.[hc]	
-
-# Recreate the Makefile from Makefile
-
-include $(SCRIPTDIR)/Single-depend.make
-
-include dependencies
+LK_STD
+LK_STD_LIBS([liblyskom-server$(PROFILE-LIB-SUFFIX).a],
+	[kom-errno.o misc-parser.o parser.o])
+LK_INSTALL_HDRS([misc-parser.h parser.h])
+LK_ALL_C_DEPEND
+LK_DESCEND
+[tags:
+	etags -t $(INCLUDEDIR)/*.h *.[hc]]
diff --git a/src/libraries/libisc-new/Makefile.src b/src/libraries/libisc-new/Makefile.src
index e128b7ab101797ab9c812e6ffaa538d9728812be..d2a69e3ed4a44a618add27db968a212b1d8d2e50 100644
--- a/src/libraries/libisc-new/Makefile.src
+++ b/src/libraries/libisc-new/Makefile.src
@@ -1,5 +1,5 @@
 #
-# $Id: Makefile.src,v 1.2 1993/10/10 11:39:46 ceder Exp $
+# $Id: Makefile.src,v 1.3 1994/03/03 00:37:21 ceder Exp $
 # Copyright (C) 1991  Lysator Academic Computer Association.
 #
 # This file is part of the LysKOM server.
@@ -22,24 +22,6 @@
 #
 # Please mail bug reports to bug-lyskom@lysator.liu.se. 
 #
-srcdir = @srcdir@
-VPATH = @srcdir@
-@STDLYSKOM@
-
-SUBDIRS = src
-
-all: includes libraries binaries
-
-@ALL_DESCEND@
-doincludes:;
-dolibraries:;
-dobinaries:;
-doinstall:;
-dodepend:;
-dopure: dorealclean
-dorealclean: dodistclean;
-dodistclean: doclean
-	$(RM) $(GENERIC-DISTCLEAN)
-doclean: domostlyclean;
-domostlyclean:
-	$(RM) $(GENERIC-MOSTLYCLEAN)
+LK_STD
+[SUBDIRS = src]
+LK_DESCEND
diff --git a/src/libraries/libisc-new/src/Makefile.src b/src/libraries/libisc-new/src/Makefile.src
index 053d9fc14ee640a606be84961a6e3072a882350d..de57161d588296dee6dbc839115ff687dbefa7b6 100644
--- a/src/libraries/libisc-new/src/Makefile.src
+++ b/src/libraries/libisc-new/src/Makefile.src
@@ -7,56 +7,15 @@
 #
 #
 #
-srcdir = @srcdir@
-VPATH = @srcdir@
-@STDLYSKOM@
-
-SOURCES=isc_event.c isc_session.c isc_abort.c isc_alloc.c isc_master.c\
-        isc_output.c isc_queue.c isc_message.c isc_handler.c\
-        isc_stdout.c isc_socket.c isc_tcp.c isc_udp.c printf.c
-LIBOBJS=isc_event.o isc_session.o isc_abort.o isc_alloc.o isc_master.o\
+LK_STD
+LK_STD_LIB([libisc-new$(PROFILE-LIB-SUFFIX).a],
+	[isc_event.o isc_session.o isc_abort.o isc_alloc.o isc_master.o\
         isc_output.o isc_queue.o isc_message.o isc_handler.o\
-        isc_stdout.o isc_socket.o isc_tcp.o isc_udp.o printf.o
-
-
-LIBNAME = libisc-new$(PROFILE-LIB-SUFFIX).a
-
-INSTALL-HDRS = isc.h
-
-all: 		$(LIBNAME)
-
-binaries:;
-
-libraries: $(LIBDIR)/$(LIBNAME)
-
-includes:
-	( cmp $(srcdir)/isc.h $(INCLUDEDIR)/isc-new.h 2>/dev/null ) \
-	  || ( $(RM) $(INCLUDEDIR)/isc-new.h; \
-		cp $(srcdir)/isc.h $(INCLUDEDIR)/isc-new.h; \
-		chmod a-w $(INCLUDEDIR)/isc-new.h ) \
-
-$(LIBDIR)/$(LIBNAME): $(LIBNAME)
-	$(RM) $(LIBDIR)/$(LIBNAME)
-	cp $(LIBNAME) $(LIBDIR)/$(LIBNAME)
-	$(TOUCHLIB) $(LIBDIR)/$(LIBNAME)
-
-tags:
-	etags -t *.[hc]
-
-
-@CLEAN@
-dopure: dorealclean
-dorealclean: dodistclean;
-dodistclean: doclean
-	$(RM) $(GENERIC-DISTCLEAN)
-doclean: domostlyclean
-domostlyclean:
-	$(RM) $(GENERIC-MOSTLYCLEAN)
-
-include $(SCRIPTDIR)/Single-depend.make
-
-include dependencies
-
-$(LIBNAME): $(LIBOBJS)
-	$(AR) $(ARFLAGS) $(LIBNAME) $?
-	$(RANLIB) $(LIBNAME)
+        isc_stdout.o isc_socket.o isc_tcp.o isc_udp.o printf.o])
+LK_INSTALL_HDRS(isc-new.h)
+LK_ALL_C_DEPEND
+LK_DESCEND
+[tags:
+	etags -t *.[hc]]
+[isc-new.h: isc.h
+	cp isc.h isc-new.h]
diff --git a/src/libraries/libmisc/Makefile.src b/src/libraries/libmisc/Makefile.src
index edabd1779069dfd173cdc5cc9cdde739eab586be..a7046fbee6ec2ee9a2d724d7c4a79bb4f9284840 100644
--- a/src/libraries/libmisc/Makefile.src
+++ b/src/libraries/libmisc/Makefile.src
@@ -1,5 +1,5 @@
 #
-# $Id: Makefile.src,v 1.2 1993/10/10 11:39:53 ceder Exp $
+# $Id: Makefile.src,v 1.3 1994/03/03 00:37:38 ceder Exp $
 # Copyright (C) 1991  Lysator Academic Computer Association.
 #
 # This file is part of the LysKOM server.
@@ -22,47 +22,13 @@
 #
 # Please mail bug reports to bug-lyskom@lysator.liu.se. 
 #
-srcdir = @srcdir@
-VPATH = @srcdir@
-@STDLYSKOM@
-
-LIBNAME = libmisc$(PROFILE-LIB-SUFFIX).a
-
-LIBOBJS = pom.o s-collat-tabs.o s-string.o zmalloc.o
-
-INSTALL-HDRS = pom.h s-collat-tabs.h s-string.h zmalloc.h
-
-all:	$(LIBNAME)
-
-$(LIBNAME): $(LIBOBJS)
-	$(AR) $(ARFLAGS) $(LIBNAME) $?
-	$(RANLIB) $(LIBNAME)
-
-libraries: $(LIBNAME)
-	$(RM) $(LIBDIR)/$(LIBNAME)
-	cp $(LIBNAME) $(LIBDIR)/$(LIBNAME)
-	$(TOUCHLIB) $(LIBDIR)/$(LIBNAME)
-
-include $(SCRIPTDIR)/install-includes.make
-
-binaries:;
-
-testnumlist: testnumlist.o numlist.o
-	$(CC) -o testnumlist testnumlist.o numlist.o
-
-
-@CLEAN@
-dopure: dorealclean
-dorealclean: dodistclean;
-dodistclean: doclean
-	$(RM) $(GENERIC-DISTCLEAN)
-doclean: domostlyclean
-domostlyclean:
-	$(RM) $(GENERIC-MOSTLYCLEAN)
-
-include $(SCRIPTDIR)/Single-depend.make
-
-tags:
-	etags -t $(INCLUDEDIR)/*.h *.[hc]	
-
-include dependencies
+LK_STD
+LK_STD_LIB([libmisc$(PROFILE-LIB-SUFFIX).a],
+	[pom.o s-collat-tabs.o s-string.o zmalloc.o])
+LK_INSTALL_HDRS([pom.h s-collat-tabs.h s-string.h zmalloc.h])
+LK_ALL_C_DEPEND
+LK_DESCEND
+#testnumlist: testnumlist.o numlist.o
+#	$(CC) -o testnumlist testnumlist.o numlist.o
+[tags:
+	etags -t $(INCLUDEDIR)/*.h *.[hc]]
diff --git a/src/libraries/regex/Makefile.src b/src/libraries/regex/Makefile.src
index a87216c7fc3b7b4b0c96175e4909967b567d3976..90c8d7806b6400053427f057d4d92a2cec466445 100644
--- a/src/libraries/regex/Makefile.src
+++ b/src/libraries/regex/Makefile.src
@@ -16,69 +16,25 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-version = 0.12
+# Note that this Makefile has been almost totally rewritten by Per
+# Cederqvist <ceder@lysator.liu.se> to fit into the LysKOM
+# environment.  If you want to use GNU regex in a project of your own,
+# you should get the latest release of GNU regex from FSF.  For your
+# own sake, do not start from these sources.  This Makefile suits
+# LysKOM, but it is inferior from the Makefile distributed by vanilla
+# regex 0.12.
+version = 0.12-lyskom
+
+# LysKOM doesn't require the doc and test subdirectory.
+# Don't bother integrating the Makefiles into the LysKOM environment.
+SUBDIRS = # doc test
 
 # Special support for LysKOM
-srcdir = @srcdir@
-VPATH = @srcdir@
-@STDLYSKOM@
-LIBNAME = libregex$(PROFILE-LIB-SUFFIX).a
-LIBOBJS = regex.o
-INSTALL-HDRS = regex.h
-
-SUBDIRS = doc test
-
-default all:: regex.o
-.PHONY: default all
-
-$(LIBNAME): $(LIBOBJS)
-	$(AR) $(ARFLAGS) $(LIBNAME) $?
-	$(RANLIB) $(LIBNAME)
-
-libraries: $(LIBNAME)
-	$(RM) $(LIBDIR)/$(LIBNAME)
-	cp $(LIBNAME) $(LIBDIR)/$(LIBNAME)
-	$(TOUCHLIB) $(LIBDIR)/$(LIBNAME)
-
-include $(SCRIPTDIR)/install-includes.make
-depend:;
-binaries:;
-
-regex.o: regex.c regex.h
-	$(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) -I. -I$(srcdir) -c $<
-@CLEAN@
-
-dopure: dorealclean;
-dorealclean: dodistclean;
-dodistclean: doclean
-	$(RM) $(GENERIC-DISTCLEAN)
-doclean: domostlyclean;
-domostlyclean:
-	$(RM) $(GENERIC-MOSTLYCLEAN)
-
-makeargs = $(MFLAGS) CPPFLAGS='$(CPPFLAGS)' CFLAGS='$(CFLAGS)' CC='$(CC)' \
-DEFS='$(DEFS)' LDFLAGS='$(LDFLAGS)' LOADLIBES='$(LOADLIBES)'
-
-default all install \
-TAGS check::
-	for d in $(SUBDIRS); do (cd $$d; $(MAKE) $(makeargs) $@); done
-.PHONY: install mostlyclean clean distclean extraclean realclean TAGS check
-
-# Prevent GNU make 3 from overflowing arg limit on system V.
-.NOEXPORT:
-
-distfiles = AUTHORS ChangeLog COPYING INSTALL NEWS README \
-            *.in configure regex.c regex.h 
-distdir = regex-$(version)
-distargs = version=$(version) distdir=../$(distdir)/$$d
-dist: TAGS configure
-	@echo "Version numbers in: Makefile.in, ChangeLog, NEWS,"
-	@echo "  regex.c, regex.h,"
-	@echo "  and doc/xregex.texi (if modified)."
-	rm -rf $(distdir)
-	mkdir $(distdir)
-	ln $(distfiles) $(distdir)
-	for d in $(SUBDIRS); do (cd $$d; $(MAKE) $(distargs) dist); done
-	tar czhf $(distdir).tar.Z $(distdir)
-	rm -rf $(distdir)
-.PHONY: dist
+LK_STD
+LK_STD_LIB([libregex$(PROFILE-LIB-SUFFIX).a],
+	[regex.o])
+LK_INSTALL_HDRS(regex.h)
+LK_ALL_C_DEPEND
+[regex.o: regex.c regex.h
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) -I. -I$(srcdir) -c $<]
+LK_DESCEND
diff --git a/src/server/Makefile.src b/src/server/Makefile.src
index 0c6b21bd383d03970d31b4a5ea53805bd7e235dd..c4e370d9c6dd74238bbfa6c6e30332c371652db9 100644
--- a/src/server/Makefile.src
+++ b/src/server/Makefile.src
@@ -1,5 +1,5 @@
 #
-# $Id: Makefile.src,v 1.9 1994/02/24 10:32:25 ceder Exp $
+# $Id: Makefile.src,v 1.10 1994/03/03 00:37:57 ceder Exp $
 # Copyright (C) 1991  Lysator Academic Computer Association.
 #
 # This file is part of the LysKOM server.
@@ -22,10 +22,9 @@
 #
 # Please mail bug reports to bug-lyskom@lysator.liu.se. 
 #
-srcdir = @srcdir@
-VPATH = @srcdir@
-@STDLYSKOM@
-
+LK_STD
+ifelse( # These are not used, but let's keep them here. Maybe they 
+	# turn out to be good for something.
 HDRS = admin.h isc-parse.h prot-a-output.h async.h isc-interface.h \
 	prot-a-parse.h cache.h tmp-limits.h prot-a-send-async.h connections.h \
 	log.h prot-a.h dbck-cache.h lyskomd.h ram-output.h disk-cache.h \
@@ -33,14 +32,8 @@ HDRS = admin.h isc-parse.h prot-a-output.h async.h isc-interface.h \
 	minmax.h internal-connections.h mux-parse.h \
 	internal-services.h mux.h text-garb.h \
 	version.incl cache-node.h conf-file.h param.h
-
-# See config/sun4os4-defs.make about LIBRESOLV if you are running SunOS 4.1.1.
-
-#LIBS = -L$(LIBDIR) \
-#	-lisc-new$(PROFILE-LIB-SUFFIX) -lmisc$(PROFILE-LIB-SUFFIX) \
-#	-llyskom-server$(PROFILE-LIB-SUFFIX) -lansi$(PROFILE-LIB-SUFFIX) \
-#	$(LIBRESOLV) $(LIBIDENT) -lregex @LIBS@
-
+)
+[
 LIBS = $(LIBDIR)/libisc-new$(PROFILE-LIB-SUFFIX).a \
 	$(LIBDIR)/libmisc$(PROFILE-LIB-SUFFIX).a \
 	$(LIBDIR)/liblyskom-server$(PROFILE-LIB-SUFFIX).a \
@@ -96,25 +89,23 @@ DBCK_SRCS = dbck.c dbck-cache.c ram-smalloc.c ram-parse.c server-config.c\
 	kom-types.c\
 	ram-output.c memory.c conf-file.c
 
-ENCRYPT = encrypt-passwd.o dbck-cache.o ram-smalloc.o ram-parse.o server-config.o\
+ENCRYPT = encrypt-passwd.o dbck-cache.o ram-smalloc.o ram-parse.o 
+	server-config.o\
 	kom-types.o\
 	ram-output.o memory.o
 
-SPECIALS = call-switch.incl com.h fnc-def-init.incl prot-a-parse-arg.c\
-	prot-a-parse-arg.h fncdef-no-str-limit.txt .gdbinit
+C_SPECIALS = prot-a-parse-arg.c
+
+SPECIALS = call-switch.incl com.h fnc-def-init.incl \
+	prot-a-parse-arg.h fncdef-no-str-limit.txt .gdbinit \
+	$(C_SPECIALS)
 
 SRCS = $(GEN_SRCS) $(RAM_SRCS) $(DISK_SRCS) $(LYS_SRCS) $(DBCK_SRCS)
 
 PROGRAMS = lyskomd dbck
 
-
 all binaries: $(PROGRAMS)
 
-includes: com.h
-	cp com.h $(INCLUDEDIR)
-
-libraries:;
-
 lyskomd: $(DISKOBJS) $(GENOBJS)
 	$(CC) $(LDFLAGS) -o lyskomd $(DISKOBJS) $(GENOBJS) $(LIBS)
 
@@ -164,18 +155,6 @@ install:  $(PROGRAMS)
 #	strip $(DESTDIR)/dbck
 # Don't strip ramkomd - we want debugging info!
 
-@CLEAN@
-dopure: dorealclean
-dorealclean: dodistclean;
-dodistclean: doclean
-	$(RM) $(GENERIC-DISTCLEAN)
-doclean: domostlyclean
-	$(RM) $(SPECIALS)
-domostlyclean:
-	$(RM) $(GENERIC-MOSTLYCLEAN) $(PROGRAMS)
-
-specials: $(SPECIALS)
-
 tags:
 	$(RM) TAGS
 	etags -t $(INCLUDEDIR)/*.h *.h \
@@ -184,7 +163,8 @@ tags:
 		*.c \
 		$(TOPDIR)/src/libraries/libisc-new/src/*.c \
 		$(TOPDIR)/src/libraries/lib*/*.c
-
-include $(SCRIPTDIR)/Parallell-depend.make
-
-include dependencies
+]
+LK_INSTALL_HDRS([com.h])
+LK_ALL_C_DEPEND
+define([predepend],[[$(SPECIALS)]])])dnl
+LK_DESCEND