From afeac0a0dbf9f29408abca2b40d575930f65dec2 Mon Sep 17 00:00:00 2001
From: Simon Marlow <simonmar@microsoft.com>
Date: Fri, 13 Jan 2006 14:58:26 +0000
Subject: [PATCH] Tranform info an fptools-ready package The fptools version of
 this package needs different Makefiles, so add them and remove the original
 GNUmakefiles.

---
 GNUmakefile     | 180 ------------------------------------------------
 Makefile        |  24 +++++++
 Makefile.inc    |   7 ++
 Makefile.nhc98  |  46 +++++++++++++
 doc/GNUmakefile |   5 --
 doc/Makefile    |   7 ++
 prologue.txt    |   7 ++
 7 files changed, 91 insertions(+), 185 deletions(-)
 delete mode 100644 GNUmakefile
 create mode 100644 Makefile
 create mode 100644 Makefile.inc
 create mode 100644 Makefile.nhc98
 delete mode 100644 doc/GNUmakefile
 create mode 100644 doc/Makefile
 create mode 100644 prologue.txt

diff --git a/GNUmakefile b/GNUmakefile
deleted file mode 100644
index 79a69680e3..0000000000
--- a/GNUmakefile
+++ /dev/null
@@ -1,180 +0,0 @@
-CABALVERSION=1.1.4
-KIND=rc
-#KIND=latest
-GHCFLAGS= --make -Wall -fno-warn-unused-matches -cpp
-# later: -Wall
-PREF=/usr/local
-USER_FLAG =
-GHCPKGFLAGS = 
-#HCBASE=/tmp/ghc/bin/
-HCBASE=/usr/bin/
-HC=$(HCBASE)ghc
-HC_PKG=$(HCBASE)/ghc-pkg
-# Comment out this line if your system doesn't have System.Posix.
-ISPOSIX=-DHAVE_UNIX_PACKAGE
-
-ifdef user
-USER_FLAG = --user
-GHCPKGFLAGS = -f ~/.ghc-packages
-GHCFLAGS += -package-conf ~/.ghc-packages
-endif
-
-# the cabal tarball...
-CABALBALL=cabal.tar.gz
-
-all: moduleTest
-
-# build the library itself
-
-setup::
-	mkdir -p dist/tmp
-	$(HC) $(GHCFLAGS) -i. -odir dist/tmp -hidir dist/tmp Setup.lhs -o setup
-
-Setup-nhc:
-	hmake -nhc98 -package base -prelude Setup
-
-config: setup
-	./setup configure --ghc --prefix=$(PREF)
-
-build: build-stamp
-build-stamp: config
-	./setup build
-
-install: build-stamp
-	./setup install $(USER_FLAG)
-	cd cabal-install && mkdir -p dist/tmp && $(HC) $(GHCFLAGS) -i. -odir dist/tmp -hidir dist/tmp Setup.lhs -o setup && ./setup configure --ghc --prefix=$(PREF) && ./setup build && ./setup install
-
-hugsbootstrap:
-	rm -rf dist/tmp dist/hugs
-	mkdir -p dist/tmp
-	mkdir dist/hugs
-	cp -r Distribution dist/tmp
-	hugs-package dist/tmp dist/hugs
-	cp Setup.lhs Cabal.cabal dist/hugs
-
-hugsinstall: hugsbootstrap
-	cd dist/hugs && ./Setup.lhs configure --hugs
-	cd dist/hugs && ./Setup.lhs build
-	cd dist/hugs && ./Setup.lhs install
-
-haddock: setup
-	./setup configure
-	./setup haddock
-
-clean-doc:
-	cd doc && make clean
-
-doc: haddock
-	docbook2html doc/Cabal.xml --output doc/users-guide
-
-clean: clean-cabal clean-hunit clean-test clean-doc
-
-clean-cabal:
-	-rm -f Distribution/*.o Distribution/*.hi
-	-rm -f Distribution/Simple/*.o Distribution/Simple/*.hi
-	-rm -f Compat/*.o Compat/*.hi
-	-rm -f darcs* out.build *~ semantic.cache* x*.html
-	-rm -f library-infrastructure--darcs.tar.gz
-	-rm -rf setup *.o *.hi moduleTest dist installed-pkg-config
-	-rm -f build-stamp
-	-rm -rf dist/hugs
-
-clean-hunit:
-	-rm -f hunit-stamp hunitInstall-stamp
-	cd tests/HUnit-1.0 && make clean
-
-clean-test:
-	cd tests/A && make clean
-	cd tests/wash2hs && make clean
-
-remove: remove-cabal remove-hunit
-remove-cabal:
-	-$(HC_PKG) $(GHCPKGFLAGS) -r Cabal
-	-rm -rf $(PREF)/lib/Cabal-0.1
-remove-hunit:
-	-$(HC_PKG) $(GHCPKGFLAGS) -r HUnit
-	-rm -rf $(PREF)/lib/HUnit-1.0
-
-# dependencies (included):
-
-hunit: hunit-stamp
-hunit-stamp:
-	cd tests/HUnit-1.0 && make && ./setup configure --prefix=$(PREF) && ./setup build
-	touch $@
-
-hunitInstall: hunitInstall-stamp
-hunitInstall-stamp: hunit-stamp
-	cd tests/HUnit-1.0 && ./setup install $(USER_FLAG)
-	touch $@
-
-# testing...
-
-moduleTest:
-	mkdir -p dist/debug
-	$(HC) $(GHCFLAGS) $(ISPOSIX) -DDEBUG -odir dist/debug -hidir dist/debug -idist/debug/:src:tests/HUnit-1.0/src tests/ModuleTest.hs -o moduleTest 
-
-tests: moduleTest clean
-	cd tests/A && make clean
-	cd tests/HUnit-1.0 && make clean
-	cd tests/A && make
-	cd tests/HUnit-1.0 && make
-
-check:
-	rm -f moduleTest
-	make moduleTest
-	./moduleTest
-
-# distribution...
-
-pushall:
-	darcs push --all ijones@cvs.haskell.org:/home/darcs/cabal
-
-
-pushdist: pushall dist
-	scp $(TMPDISTLOC)/cabal.tar.gz ijones@www.haskell.org:~/cabal/cabal-code.tgz
-#	PUSH ELSEWHERE: scp changelog ijones@www.haskell.org:~/cabal/release/changelog
-#	PUSH ELSEWHERE: scp releaseNotes ijones@www.haskell.org:~/cabal/release/notes
-#	rm -f /tmp/cabal-code.tgz
-
-deb: dist
-	cd $(TMPDISTLOC) && ln -s $(CABALBALL) haskell-cabal_$(CABALVERSION).orig.tar.gz
-	cd $(TMPDISTLOC) && tar -zxvf $(CABALBALL)
-	mv $(TMPDISTLOC)/cabal $(TMPDISTLOC)/haskell-cabal-$(CABALVERSION)
-	cd $(TMPDISTLOC)/haskell-cabal-$(CABALVERSION) && debuild
-
-$(CABALBALL):
-	darcs record
-	rm -rf /tmp/cabal* /tmp/Cabal*
-	rm -rf $(TMPDISTLOC)
-	darcs dist
-	mv Cabal.tar.gz $(CABALBALL)
-
-TMPDISTLOC=/tmp/cabaldist
-
-# after this command, there will be cabal.tar.gz in $(TMPDISTLOC),
-# which will have built docs, haddock, and source code.
-
-dist: haddock $(CABALBALL)
-	rm -rf $(TMPDISTLOC)
-	mkdir $(TMPDISTLOC)
-	mv $(CABALBALL) $(TMPDISTLOC)
-	cd $(TMPDISTLOC) && tar -zxvf $(CABALBALL) && mv Cabal cabal
-	#mkdir $(TMPDISTLOC)/cabal/doc
-	make doc
-	cp -r dist/doc/html $(TMPDISTLOC)/cabal/doc/API
-	cp -r doc/users-guide $(TMPDISTLOC)/cabal/doc/users-guide
-	cd ~/usr/doc/haskell/haskell-report/packages && docbook2html -o /tmp/pkg-spec-html pkg-spec.sgml && docbook2pdf pkg-spec.sgml -o /tmp
-	cp -r /tmp/pkg-spec{-html,.pdf} $(TMPDISTLOC)/cabal/doc
-
-	cd $(TMPDISTLOC) && tar -zcvf $(CABALBALL) cabal
-#	rm -f /tmp/Cabal.tar.gz
-#	rm -rf /tmp/cabal
-
-release: dist
-	mkdir $(TMPDISTLOC)/release
-	cp $(TMPDISTLOC)/cabal/releaseNotes $(TMPDISTLOC)/release
-	cp $(TMPDISTLOC)/cabal/changelog $(TMPDISTLOC)/release
-	cp -r $(TMPDISTLOC)/cabal/doc $(TMPDISTLOC)/release
-	cp $(TMPDISTLOC)/cabal.tar.gz  $(TMPDISTLOC)/release/cabal-$(CABALVERSION).tar.gz
-	scp -r $(TMPDISTLOC)/release ijones@www.haskell.org:~/cabal/release/cabal-$(CABALVERSION)
-	ssh ijones@www.haskell.org 'cd ~/cabal/release && rm -f $(KIND) && ln -s cabal-$(CABALVERSION) $(KIND)'
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000000..28069476b9
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,24 @@
+TOP=..
+include $(TOP)/mk/boilerplate.mk
+
+SUBDIRS = doc
+
+ALL_DIRS = \
+	Distribution \
+	Distribution/Simple \
+	Distribution/PreProcess \
+	Distribution/Compat \
+	Language/Haskell
+
+EXCLUDED_SRCS = DefaultSetup.lhs
+
+PACKAGE		= Cabal
+VERSION		= 1.0
+
+PACKAGE_DEPS	= base
+
+SRC_HADDOCK_OPTS += -t "Haskell Core Libraries (Cabal package)"
+
+SRC_HC_OPTS   += -cpp
+
+include $(TOP)/mk/target.mk
diff --git a/Makefile.inc b/Makefile.inc
new file mode 100644
index 0000000000..91ac818437
--- /dev/null
+++ b/Makefile.inc
@@ -0,0 +1,7 @@
+ifeq "" "${MKDIR}"
+MKDIR:=$(shell pwd)
+#MKDIR:=$(PWD)
+else
+MKDIR:=$(patsubst %/$(notdir ${MKDIR}),%, ${MKDIR})
+endif
+include ${MKDIR}/Makefile.inc
diff --git a/Makefile.nhc98 b/Makefile.nhc98
new file mode 100644
index 0000000000..7dd17a4673
--- /dev/null
+++ b/Makefile.nhc98
@@ -0,0 +1,46 @@
+# Hey Emacs, this is a -*- makefile -*- !
+
+THISPKG       = Cabal
+SEARCH        = -package base
+EXTRA_H_FLAGS = -K4M 
+EXTRA_HBC_FLAGS = -H80M -A4M
+
+SRCS          = \
+	Distribution/Extension.hs \
+	Distribution/GetOpt.hs \
+	Distribution/InstalledPackageInfo.hs \
+	Distribution/License.hs \
+	Distribution/Make.hs \
+	Distribution/Package.hs \
+	Distribution/PackageDescription.hs \
+	Distribution/ParseUtils.hs \
+	Distribution/PreProcess.hs \
+	Distribution/Setup.hs \
+	Distribution/Simple.hs \
+	Distribution/Version.hs \
+ \
+	Distribution/Compat/Directory.hs \
+	Distribution/Compat/Exception.hs \
+	Distribution/Compat/FilePath.hs \
+	Distribution/Compat/RawSystem.hs \
+	Distribution/Compat/ReadP.hs \
+ \
+	Distribution/PreProcess/Unlit.hs \
+ \
+	Distribution/Simple/Build.hs \
+	Distribution/Simple/Configure.hs \
+	Distribution/Simple/GHCPackageConfig.hs \
+	Distribution/Simple/Install.hs \
+	Distribution/Simple/LocalBuildInfo.hs \
+	Distribution/Simple/Register.hs \
+	Distribution/Simple/SrcDist.hs \
+	Distribution/Simple/Utils.hs \
+
+
+# Here are the main rules.
+include ../Makefile.common
+
+# Here are any extra dependencies.
+
+# C-files dependencies.
+
diff --git a/doc/GNUmakefile b/doc/GNUmakefile
deleted file mode 100644
index 2dce7bab0b..0000000000
--- a/doc/GNUmakefile
+++ /dev/null
@@ -1,5 +0,0 @@
-all: Cabal.xml
-	docbook2pdf Cabal.xml
-
-clean:
-	rm -fr *~ API users-guide Cabal.pdf Cabal.dvi semantic.cache
diff --git a/doc/Makefile b/doc/Makefile
new file mode 100644
index 0000000000..1c1be5e829
--- /dev/null
+++ b/doc/Makefile
@@ -0,0 +1,7 @@
+TOP = ../..
+include $(TOP)/mk/boilerplate.mk
+
+XML_DOC = Cabal
+INSTALL_XML_DOC = $(XML_DOC)
+
+include $(TOP)/mk/target.mk
diff --git a/prologue.txt b/prologue.txt
new file mode 100644
index 0000000000..f583baae63
--- /dev/null
+++ b/prologue.txt
@@ -0,0 +1,7 @@
+The Haskell Cabal is the Common Architecture for Building Applications
+and Libraries.  It is a framework which defines a common interface for
+authors to more easily build their applications in a portable way. The
+Haskell Cabal is meant to be a part of a larger infrastructure for
+distributing, organizing, and cataloging Haskell Libraries and
+Tools. For more information, please see:
+<http://www.haskell.org/cabal/>.
-- 
GitLab