From 84ce62c8ff45de6779a393f4032e85431ff26583 Mon Sep 17 00:00:00 2001
From: Per Cederqvist <ceder@lysator.liu.se>
Date: Fri, 30 Aug 1991 01:23:24 +0000
Subject: [PATCH] Set TOPDIR to pwd. Added config subdir. Remove INCLUDEDIR and
 LIBDIR on 'make clean'. Check that Config has been run.

---
 Makefile | 38 +++++++++++++++++++++++++++++++-------
 1 file changed, 31 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index bc57d8b79..404845984 100644
--- a/Makefile
+++ b/Makefile
@@ -1,14 +1,14 @@
-TOPDIR = /usr/lyskom
+TOPDIR := $(shell pwd)
 SCRIPTDIR = $(TOPDIR)/scripts
 
 include $(SCRIPTDIR)/import.make
 
-SUBDIRS = doc junk scripts src
+SUBDIRS = doc junk scripts src config
 SERVER-VER = 1.0
 
-all: includes libraries binaries
+all: msg includes libraries binaries end-msg
 
-includes:
+includes: $(INCLUDEDIR)/m-config.h
 	-mkdir $(INCLUDEDIR)
 	for i in $(SUBDIRS) ;	\
 	do	\
@@ -17,7 +17,7 @@ includes:
 	done
 
 
-libraries:
+libraries: $(INCLUDEDIR)/m-config.h
 	-mkdir $(LIBDIR)
 	for i in $(SUBDIRS) ;	\
 	do	\
@@ -27,10 +27,20 @@ libraries:
 
 include $(SCRIPTDIR)/sub-binaries.make
 include $(SCRIPTDIR)/sub-install.make
-include $(SCRIPTDIR)/sub-clean.make
 include $(SCRIPTDIR)/sub-depend.make
 
-depend: includes
+.PHONY: clean
+clean:
+	$(RM) $(GENERIC-CLEAN)
+	$(RM) -r $(INCLUDEDIR)
+	$(RM) -r $(LIBDIR)
+	-for i in $(SUBDIRS); \
+	do \
+	   [ -d $$i ] && { echo making clean in directory $$i; \
+	   (cd $$i; $(MAKE) $(EXPORTS) clean) } \
+	done
+
+depend: $(INCLUDEDIR)/m-config.h msg includes
 
 distribution: clean
 	-$(RM) -r lyskom-$(SERVER-VER)
@@ -53,3 +63,17 @@ distribution: clean
 	$(RM) lyskom-$(SERVER-VER).tar.Z
 	compress lyskom-$(SERVER-VER).tar
 	$(RM) -r lyskom-$(SERVER-VER)
+
+msg:
+	@echo Top-level source directory is believed to be $(TOPDIR)
+	@date
+	@echo
+
+end-msg:
+	@echo
+	@echo Finished at
+	@date
+
+$(INCLUDEDIR)/m-config.h:
+	@echo You must run Config before Build or make.
+	@exit 1
-- 
GitLab