Commit 0065d5ab authored by Simon Marlow's avatar Simon Marlow

Reorganisation of the source tree

Most of the other users of the fptools build system have migrated to
Cabal, and with the move to darcs we can now flatten the source tree
without losing history, so here goes.

The main change is that the ghc/ subdir is gone, and most of what it
contained is now at the top level.  The build system now makes no
pretense at being multi-project, it is just the GHC build system.

No doubt this will break many things, and there will be a period of
instability while we fix the dependencies.  A straightforward build
should work, but I haven't yet fixed binary/source distributions.
Changes to the Building Guide will follow, too.
parent 28a464a7

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

......@@ -175,6 +175,13 @@ A rough roadmap to the source tree:
Resources
---------
The GHC Developer's Wiki
The home for GHC Developers, with information on accessing the latest sources,
the bug tracker, and further documentation on the code.
http://hackage.haskell.org/trac/ghc
The Building Guide
Full documentation on the build system.
......
############################################################################
#
# fptools/Makefile
# This is the top-level Makefile for GHC
#
# This is the main Makefile for fptools.
# Targets:
#
# bootsrap (DEFAULT)
# Builds GHC, then builds the libraries,
# then uses this GHC ("stage 1") to build itself
# ("stage 2").
#
# bootstrap2
# Same as bootstrap
#
# bootstrap3
# bootstrap2 + we build GHC one more time ("stage 3")
#
# stage1
# Just build up to stage 1
#
# stage2
# Just build stage 2 (stage 1 must be built)
#
# stage3
# Just build stage 3 (stage 2 must be built)
#
# all
# Same as bootstrap
#
# install
# Install everything, including stage 2 compiler by default
# (override with stage=3, for example).
#
# dist
# Make a source dist (WARNING: runs 'make distclean' first)
#
# binary-dist
# Builds a binary distribution
#
# hc-file-bundle
# Builds an HC-file bundle, for bootstrapping
#
# clean, distclean, maintainer-clean
# Increasing levels of cleanliness
#
############################################################################
TOP=.
include $(TOP)/mk/boilerplate.mk
# find the projects that actually exist...
ProjectsThatExist = $(filter $(patsubst %/, %, $(wildcard */)), $(AllProjects))
# and filter only those that the user requested, if necessary
ifeq "$(ProjectsToBuild)" ""
SUBDIRS = $(ProjectsThatExist)
else
SUBDIRS = $(filter $(ProjectsToBuild), $(ProjectsThatExist))
endif
ifneq "$(Project)" ""
ifeq "$(Project)" "GreenCard"
ProjectDirectory=greencard
else
ifeq "$(Project)" "HaskellDirect"
ProjectDirectory=hdirect
else
ProjectDirectory=$(Project)
endif
endif
-include $(shell echo $(ProjectDirectory) | tr A-Z a-z)/mk/config.mk
-include $(shell echo $(ProjectDirectory) | tr A-Z a-z)/mk/version.mk
endif
# -----------------------------------------------------------------------------
# Certain targets require that Project is set from the command line.
CURRENT_TARGET = $(MAKECMDGOALS)
project-check :
@if [ "$(Project)" = "" ]; then \
echo " You need to set \"Project\" in order to make $(CURRENT_TARGET)"; \
echo " eg. make $(CURRENT_TARGET) Project=Ghc"; \
exit 1; \
fi
# -----------------------------------------------------------------------------
# Targets: all, stage1, stage2, stage3
DIST_CLEAN_FILES += config.cache config.status mk/config.h mk/stamp-h
extraclean::
$(RM) -rf autom4te.cache
#
# If you've ended up using an in-place version of Happy,
# make sure it gets built early on.
# Order is important! It's e.g. necessary to descend into include/
# before the rest to have a config.h, etc.
#
ifeq "$(HAPPY)" "$(FPTOOLS_TOP_ABS)/happy/src/happy-inplace"
build :: $(FPTOOLS_TOP_ABS)/happy/src/happy-inplace
# If we're booting from .hc files, swap the order
# we descend into subdirs - to boot utils must be before driver.
#
.PHONY: stage1 stage2 stage3 bootstrap bootstrap2 bootstrap3
$(FPTOOLS_TOP_ABS)/happy/src/happy-inplace : glafp-utils
$(MAKE) -C happy boot all
# We can't 'make boot' in libraries until stage1 is built
ifeq "$(BootingFromHc)" "YES"
SUBDIRS_NOLIB = includes rts docs compiler compat utils driver
else
SUBDIRS_NOLIB = includes compat utils driver docs compiler rts
endif
# Build all projects that we know about
build ::
SUBDIRS = $(SUBDIRS_NOLIB) libraries
stage1 :
$(MAKE) -C utils/mkdependC boot
@case '${MFLAGS}' in *-[ik]*) x_on_err=0;; *-r*[ik]*) x_on_err=0;; *) x_on_err=1;; esac; \
for i in $(SUBDIRS); do \
if [ -d $$i ]; then \
$(MAKE) -C $$i boot; \
if [ $$? -eq 0 -o $$x_on_err -eq 0 ] ; then true; else exit 1; fi; \
$(MAKE) -C $$i all; \
if [ $$? -eq 0 -o $$x_on_err -eq 0 ] ; then true; else exit 1; fi; \
fi; \
for i in $(SUBDIRS_NOLIB); do \
echo "------------------------------------------------------------------------"; \
echo "== $(MAKE) boot $(MFLAGS);"; \
echo " in $(shell pwd)/$$i"; \
echo "------------------------------------------------------------------------"; \
$(MAKE) --no-print-directory -C $$i $(MFLAGS) boot; \
if [ $$? -eq 0 -o $$x_on_err -eq 0 ] ; then true; else exit 1; fi; \
done; \
for i in $(SUBDIRS_NOLIB); do \
echo "------------------------------------------------------------------------"; \
echo "== $(MAKE) all $(MFLAGS);"; \
echo " in $(shell pwd)/$$i"; \
echo "------------------------------------------------------------------------"; \
$(MAKE) --no-print-directory -C $$i $(MFLAGS) all; \
if [ $$? -eq 0 -o $$x_on_err -eq 0 ] ; then true; else exit 1; fi; \
done
ifeq "$(findstring ghc, $(SUBDIRS))" "ghc"
.PHONY: stage1 stage2 stage3 bootstrap bootstrap2 bootstrap3
stage1 : build
@$(MAKE) -C libraries boot
@$(MAKE) -C libraries all
stage2 :
$(MAKE) -C ghc/compiler boot stage=2
$(MAKE) -C ghc/compiler stage=2
$(MAKE) -C compiler boot stage=2
$(MAKE) -C compiler stage=2
stage3 :
$(MAKE) -C ghc/compiler boot stage=3
$(MAKE) -C ghc/compiler stage=3
$(MAKE) -C compiler boot stage=3
$(MAKE) -C compiler stage=3
bootstrap : bootstrap2
......@@ -99,6 +106,9 @@ bootstrap3 : bootstrap2
all :: bootstrap
# -----------------------------------------------------------------------------
# Installing
# We want to install the stage 2 bootstrapped compiler by default, but we let
# the user override this by saying 'make install stage=1', for example.
ifeq "$(stage)" ""
......@@ -107,27 +117,25 @@ else
INSTALL_STAGE =
endif
else # Not building GHC
all :: build
INSTALL_STAGE =
endif
boot ::
@echo "Please use \`make all' only from the top-level, or \`make boot' followed"
@echo "by \`make all' in an individual project subdirectory (ghc, hslibs etc.)."
# Same as default rule, but we pass $(INSTALL_STAGE) to $(MAKE) too
install ::
@case '${MFLAGS}' in *-[ik]*) x_on_err=0;; *-r*[ik]*) x_on_err=0;; *) x_on_err=1;; esac; \
for i in $(filter-out $(ProjectsDontInstall), $(SUBDIRS)); do \
if [ -d $$i ]; then \
$(MAKE) -C $$i $(INSTALL_STAGE) install; \
if [ $$? -eq 0 -o $$x_on_err -eq 0 ] ; then true; else exit 1; fi; \
fi; \
for i in $(SUBDIRS); do \
echo "------------------------------------------------------------------------"; \
echo "== $(MAKE) $@ $(MFLAGS);"; \
echo " in $(shell pwd)/$$i"; \
echo "------------------------------------------------------------------------"; \
$(MAKE) --no-print-directory -C $$i $(INSTALL_STAGE) $(MFLAGS) $@; \
if [ $$? -eq 0 -o $$x_on_err -eq 0 ] ; then true; else exit 1; fi; \
done
ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
# These files need to be in the InstallShield
# INSTALL_DATAS rather than INSTALL_DOCS is used so these files go
# in the top-level directory of the distribution
INSTALL_DATAS += ANNOUNCE LICENSE README VERSION
endif
# If installing on Windows with MinGW32, copy the gcc compiler, headers and libs
# and the perl interpreter and dll into the GHC prefix directory.
# Gcc and Perl source locations derived from configuration data.
......@@ -152,11 +160,13 @@ endif
install-docs ::
@case '${MFLAGS}' in *-[ik]*) x_on_err=0;; *-r*[ik]*) x_on_err=0;; *) x_on_err=1;; esac; \
for i in $(filter-out $(ProjectsDontInstall), $(SUBDIRS)); do \
if [ -d $$i ]; then \
$(MAKE) -C $$i $(INSTALL_STAGE) install-docs; \
if [ $$? -eq 0 -o $$x_on_err -eq 0 ] ; then true; else exit 1; fi; \
fi; \
for i in $(SUBDIRS); do \
echo "------------------------------------------------------------------------"; \
echo "== $(MAKE) $@ $(MFLAGS);"; \
echo " in $(shell pwd)/$$i"; \