From 1a9ed9c863662bc399f80abe4179b29f40ceb9d9 Mon Sep 17 00:00:00 2001
From: Per Cederqvist <ceder@lysator.liu.se>
Date: Sun, 8 Sep 1991 21:09:09 +0000
Subject: [PATCH] New method to set TOPDIR.

---
 Config                           | 24 +++++++++++++-----------
 Makefile                         |  2 +-
 config/Makefile                  |  2 +-
 config/balance-defs.make         |  4 ++--
 config/sun4os4-defs.make         |  4 ++--
 doc/Makefile                     |  2 +-
 doc/man/Makefile                 |  2 +-
 scripts/Makefile                 |  2 +-
 src/Makefile                     |  2 +-
 src/include/Makefile             |  2 +-
 src/include/server/Makefile      |  2 +-
 src/libraries/Makefile           |  2 +-
 src/libraries/libansi/Makefile   |  2 +-
 src/libraries/libcommon/Makefile | 10 +++++-----
 src/libraries/libmisc/Makefile   |  2 +-
 src/server/Makefile              |  4 ++--
 16 files changed, 35 insertions(+), 33 deletions(-)

diff --git a/Config b/Config
index a5281bf45..daf53b620 100755
--- a/Config
+++ b/Config
@@ -1,5 +1,5 @@
 #!/bin/sh
-# $Id: Config,v 1.6 1991/09/08 02:14:33 ceder Exp $
+# $Id: Config,v 1.7 1991/09/08 21:05:05 ceder Exp $
 
 x=
 
@@ -22,23 +22,25 @@ esac
 case "$x" in
 error)	false;;
 *)
+	for i in `find . -type d -print`
+	do  echo TOPDIR=`pwd` > $i/Topdir.make
+	done
+
 	rm -f scripts/import.make
 	ln -s ../config/${x}-config.h include/m-config.h
 	ln -s ../config/${x}-defs.make scripts/import.make
 	ln -s ../src/include/ansi/${x} include/ansi
 	cd include/ansi
-	cat links | while read link target; do	\
-		echo ${link};	\
-		rm -f ${link};		
-		[ "" = "${target}" ] && target=Templates;	\
-		ln -s ../${target}/${link} ${link};	\
+	cat links | while read link target; do
+		rm -f ${link}
+		[ "" = "${target}" ] && target=Templates
+		ln -s ../${target}/${link} ${link}
 	done
 
 	cd sys
-	cat links | while read link target; do	\
-		echo ${link};	\
-		rm -f ${link};			\
-		[ "" = "${target}" ] && target=Templates;	\
-		ln -s ../../${target}/sys/${link} ${link};	\
+	cat links | while read link target; do
+		rm -f ${link};
+		[ "" = "${target}" ] && target=Templates; 
+		ln -s ../../${target}/sys/${link} ${link}; 
 	done;;
 esac
diff --git a/Makefile b/Makefile
index 36e0be3f3..432d0ae2b 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-TOPDIR := $(shell pwd)
+include Topdir.make
 SCRIPTDIR = $(TOPDIR)/scripts
 
 include $(SCRIPTDIR)/import.make
diff --git a/config/Makefile b/config/Makefile
index 9d3fdfc13..9f24795a0 100644
--- a/config/Makefile
+++ b/config/Makefile
@@ -1,4 +1,4 @@
-TOPDIR = /usr/lyskom
+include Topdir.make
 SCRIPTDIR = $(TOPDIR)/scripts
 
 include $(SCRIPTDIR)/import.make
diff --git a/config/balance-defs.make b/config/balance-defs.make
index 4929f4663..d710685ab 100644
--- a/config/balance-defs.make
+++ b/config/balance-defs.make
@@ -1,4 +1,4 @@
-# $Id: balance-defs.make,v 1.2 1991/09/03 22:11:32 ceder Exp $
+# $Id: balance-defs.make,v 1.3 1991/09/08 21:09:06 ceder Exp $
 # This file is included by all Makefiles in the LysKOM hierarchy.
 # It gives default values for all variables that is normally used. 
 # TOPDIR and SCRIPTDIR must be set before this file is included.
@@ -40,7 +40,7 @@ LYSKOMUSRBIN = /usr/local/bin
 
 
 GENERIC-CLEAN = *~ *.o lib*.a dependencies core TAGS temp-Makefile  \
-	 temp-?-Makefile
+	 temp-?-Makefile Topdir.make
 
 EXPORTS =
 
diff --git a/config/sun4os4-defs.make b/config/sun4os4-defs.make
index 7c2e3e8fa..672800465 100644
--- a/config/sun4os4-defs.make
+++ b/config/sun4os4-defs.make
@@ -1,4 +1,4 @@
-# $Id: sun4os4-defs.make,v 1.2 1991/09/03 22:11:30 ceder Exp $
+# $Id: sun4os4-defs.make,v 1.3 1991/09/08 21:09:02 ceder Exp $
 # This file is included by all Makefiles in the LysKOM hierarchy.
 # It gives default values for all variables that is normally used. 
 # TOPDIR and SCRIPTDIR must be set before this file is included.
@@ -41,7 +41,7 @@ LYSKOMUSRBIN = /usr/local/bin
 
 
 GENERIC-CLEAN = *~ *.o lib*.a dependencies core TAGS temp-Makefile  \
-	 temp-?-Makefile
+	 temp-?-Makefile Topdir.make
 
 EXPORTS =
 
diff --git a/doc/Makefile b/doc/Makefile
index 0d1f99b1e..48bfc71ff 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -1,4 +1,4 @@
-TOPDIR = /usr/lyskom
+include Topdir.make
 SCRIPTDIR = $(TOPDIR)/scripts
 
 include $(SCRIPTDIR)/import.make
diff --git a/doc/man/Makefile b/doc/man/Makefile
index 5d929ae13..97c8fe8ab 100644
--- a/doc/man/Makefile
+++ b/doc/man/Makefile
@@ -1,4 +1,4 @@
-TOPDIR = /usr/lyskom/src
+include Topdir.make
 SCRIPTDIR = $(TOPDIR)/scripts
 
 include $(SCRIPTDIR)/import.make
diff --git a/scripts/Makefile b/scripts/Makefile
index 9588f98f6..ac6306c77 100644
--- a/scripts/Makefile
+++ b/scripts/Makefile
@@ -1,4 +1,4 @@
-TOPDIR = /usr/lyskom
+include Topdir.make
 SCRIPTDIR = $(TOPDIR)/scripts
 
 include $(SCRIPTDIR)/import.make
diff --git a/src/Makefile b/src/Makefile
index c44231bd6..b32fc6705 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,4 +1,4 @@
-TOPDIR = /usr/lyskom/src
+include Topdir.make
 SCRIPTDIR = $(TOPDIR)/scripts
 
 include $(SCRIPTDIR)/import.make
diff --git a/src/include/Makefile b/src/include/Makefile
index 63bd44d46..e8c4eaab1 100644
--- a/src/include/Makefile
+++ b/src/include/Makefile
@@ -1,4 +1,4 @@
-TOPDIR = /usr/lyskom
+include Topdir.make
 SCRIPTDIR = $(TOPDIR)/scripts
 
 include $(SCRIPTDIR)/import.make
diff --git a/src/include/server/Makefile b/src/include/server/Makefile
index ff13e37c4..31e71d985 100644
--- a/src/include/server/Makefile
+++ b/src/include/server/Makefile
@@ -1,4 +1,4 @@
-TOPDIR = /usr/lyskom/src
+include Topdir.make
 SCRIPTDIR = $(TOPDIR)/scripts
 
 include $(SCRIPTDIR)/import.make
diff --git a/src/libraries/Makefile b/src/libraries/Makefile
index c41133426..312d8689e 100644
--- a/src/libraries/Makefile
+++ b/src/libraries/Makefile
@@ -1,4 +1,4 @@
-TOPDIR = /usr/lyskom/src
+include Topdir.make
 SCRIPTDIR = $(TOPDIR)/scripts
 
 include $(SCRIPTDIR)/import.make
diff --git a/src/libraries/libansi/Makefile b/src/libraries/libansi/Makefile
index de42e157c..7b6d7c792 100644
--- a/src/libraries/libansi/Makefile
+++ b/src/libraries/libansi/Makefile
@@ -1,4 +1,4 @@
-TOPDIR = /usr/lyskom/src
+include Topdir.make
 SCRIPTDIR = $(TOPDIR)/scripts
 
 include $(SCRIPTDIR)/import.make
diff --git a/src/libraries/libcommon/Makefile b/src/libraries/libcommon/Makefile
index 03c126496..9497ddcd1 100644
--- a/src/libraries/libcommon/Makefile
+++ b/src/libraries/libcommon/Makefile
@@ -1,4 +1,4 @@
-TOPDIR = /usr/lyskom/src
+include Topdir.make
 SCRIPTDIR = $(TOPDIR)/scripts
 
 include $(SCRIPTDIR)/import.make
@@ -14,13 +14,13 @@ all: $(LIBRARIES)
 
 client-dir:
 	mkdir client-dir
-	ln -s `echo $(LIBOBJS) $(INSTALL-HDRS) dependencies| tr ' ' '\012' | \
-	sed 's/.o$$/.c/' | sed 's:^:\.\./:' ` client-dir/
+	ln -s `echo $(LIBOBJS) $(INSTALL-HDRS) dependencies Topdir.make | \
+	tr ' ' '\012' | sed 's/.o$$/.c/' | sed 's:^:\.\./:' ` client-dir/
 
 server-dir:
 	mkdir server-dir
-	ln -s `echo $(LIBOBJS) $(INSTALL-HDRS) dependencies| tr ' ' '\012' | \
-	sed 's/.o$$/.c/' | sed 's:^:\.\./:' ` server-dir/
+	ln -s `echo $(LIBOBJS) $(INSTALL-HDRS) dependencies Topdir.make | \
+	tr ' ' '\012' | sed 's/.o$$/.c/' | sed 's:^:\.\./:' ` server-dir/
 
 .PHONY: liblyskom-server.a
 liblyskom-server.a: server-dir
diff --git a/src/libraries/libmisc/Makefile b/src/libraries/libmisc/Makefile
index 77b04724a..87a797411 100644
--- a/src/libraries/libmisc/Makefile
+++ b/src/libraries/libmisc/Makefile
@@ -1,4 +1,4 @@
-TOPDIR = /usr/lyskom/src
+include Topdir.make
 SCRIPTDIR = $(TOPDIR)/scripts
 
 include $(SCRIPTDIR)/import.make
diff --git a/src/server/Makefile b/src/server/Makefile
index 1d74f8079..f3d16e7c0 100755
--- a/src/server/Makefile
+++ b/src/server/Makefile
@@ -1,6 +1,6 @@
-# $Id: Makefile,v 0.11 1991/09/01 21:26:14 linus Exp $
+# $Id: Makefile,v 0.12 1991/09/08 21:08:47 ceder Exp $
 
-TOPDIR = /usr/lyskom/src
+include Topdir.make
 SCRIPTDIR = $(TOPDIR)/scripts
 
 include $(SCRIPTDIR)/import.make
-- 
GitLab