Commit 02b60157 authored by simonm's avatar simonm

[project @ 1996-11-21 16:45:53 by simonm]

New Build System!
parent c7cfec62
#-----------------------------------------------------------------------------
# $Id: Makefile,v 1.2 1996/11/21 16:45:54 simonm Exp $
TOP = .
SUBDIRS = glafp-utils ghc
include $(TOP)/mk/gen.mk
include $(TOP)/mk/subdir.mk
line = @echo "------------------------------------------------------------------------------"
boot ::
@echo "Bootstrapping $(PROJECTNAME)..."
$(line)
@echo "Booting glafp-utils"
$(line)
@$(MAKE) -C glafp-utils boot
$(line)
@echo "Booting ghc"
$(line)
@$(MAKE) -C ghc boot
@echo "Done!"
# @configure_input@
srcdir = @srcdir@
VPATH = @srcdir@
CC = @CC@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
LIBS = @LIBS@
CFLAGS = -O
LDFLAGS = -O
prefix = /usr/local
exec_prefix = $(prefix)
binprefix =
manprefix =
bindir = $(exec_prefix)/bin
libdir = $(exec_prefix)/lib
mandir = $(prefix)/man/man1
manext = 1
SHELL = /bin/sh
Makefile: Makefile.in config.status
$(SHELL) config.status
config.status: configure
$(SHELL) config.status --recheck
configure: configure.in
cd $(srcdir) && autoconf < configure.in > configure.new
grep -v '# Generated automatically from' < configure.new > configure
#! /bin/sh
#
# die quickly if anything goes astray...
set -e
# figure out the absolute pathname of the "top" directory
# (the one which has "mkworld", "nofib", "glafp-utils", etc., as subdirs)
hardtop=`pwd`
hardtop=`echo $hardtop | sed 's|^/tmp_mnt/|/|' | sed 's|^/export/|/|' | sed 's|^/grasp_tmp|/local/grasp_tmp|'`
echo ''
echo "*** The top of your build tree is: $hardtop"
case "$hardtop" in
# NeXTStep brain damage
/private/tmp_mnt/auto* )
echo '***'
echo '*** AAARRRGGGHHHH!!!'
echo '***'
echo '*** Stupid automounter (and pwd) will not tell me'
echo '*** the absolute pathname for the current directory.'
echo '*** Be sure to set TopDirPwd in mkworld/site-DEF.jm.'
echo '*** (Then it does not matter what this script decides.)'
echo '***'
;;
esac
# make "mkworld", "literate", and "glafp-utils" (no special configuration)
# make all the Makefiles first
for i in @DoingMkWorld@ @DoingGlaFpUtils@ @DoingLiterate@ ; do
if [ -d $i ] ; then
( set -e; \
cd $i ; \
echo '' ; \
echo "*** configuring $i ..." ; \
@MakeCmd@ -f Makefile.BOOT BOOT_DEFINES="-P none -S std -DTopDirPwd=$hardtop"; \
echo '' ; \
echo "*** making Makefiles in $i ..." ; \
@MakeCmd@ Makefile ; \
@MakeCmd@ Makefiles \
)
else
echo warning: $i is not a directory -- doing nothing for it
fi
done
# now make the dependencies and Real Stuff
for i in @DoingMkWorld@ @DoingGlaFpUtils@ @DoingLiterate@ ; do
if [ -d $i ] ; then
( set -e; \
cd $i ; \
echo '' ; \
echo "*** making dependencies in $i ..." ; \
@MakeCmd@ depend ; \
echo '' ; \
echo "*** making all in $i ..." ; \
@MakeCmd@ all \
)
else
echo warning: $i is not a directory -- doing nothing for it
fi
done
# OK, now make the \`real' Makefiles
passed_in_setup="-S @MkWorldSetup@"
for i in @DoingGHC@ @DoingHsLibs@ @DoingHappy@ @DoingHaggis@ @DoingNoFib@ EndOfList ; do
if [ $i = nofib ] ; then
setup=$passed_in_setup
else
setup=''
fi
if [ -d $i ] ; then
( set -e; \
cd $i ; \
echo '' ; \
echo "*** configuring $i ..." ; \
@MakeCmd@ -f Makefile.BOOT BOOT_DEFINES="-P $i $setup -C mkworld -DTopDirPwd=$hardtop"; \
echo '' ; \
echo "*** making Makefiles in $i ..." ; \
@MakeCmd@ Makefile ; \
@MakeCmd@ Makefiles \
)
else
if [ $i != EndOfList ] ; then
echo warning: $i is not a directory -- doing nothing for it
fi
fi
done
# Finally, the dependencies
for i in @DoingGHC@ @DoingHsLibs@ @DoingHappy@ @DoingHaggis@ @DoingNoFib@ EndOfList ; do
if [ -d $i ] ; then
( set -e; \
cd $i ; \
echo '' ; \
echo "*** making dependencies in $i ..." ; \
@MakeCmd@ depend \
)
else
if [ $i != EndOfList ] ; then
echo warning: $i is not a directory -- doing nothing for it
fi
fi
done
echo ''
echo '*******************************************************************'
echo "* Looking good! All you should need to do now is... *"
echo '* *'
for i in @DoingGHC@ @DoingHsLibs@ @DoingHappy@ @DoingHaggis@ @DoingNoFib@ EndOfList ; do
if [ $i != EndOfList ] ; then
echo " cd $i"
if [ $i = nofib ] ; then
echo ' make all # or...'
echo ' make runtests'
else
echo ' make all'
echo ' make install # if you are so inclined...'
fi
fi
done
echo '* *'
echo '*******************************************************************'
exit 0
This diff is collapsed.
#define IHaveSubdirs
/* order in SUBDIRS is not supposed to be important but ...
"compiler" must be before "lib", because we use
the compiler just built to compile pieces of "lib".
"includes" also needs to be v early, to ensure that
GhcConstants.h is made before needed.
if we're building from .hc files, we do the libraries
first, then the compiler; otherwise the other way around
*/
#if HaskellCompilerType == HC_USE_HC_FILES
#define __compiler_and_lib lib compiler
#else
#define __compiler_and_lib compiler lib
#endif
SUBDIRS = includes \
utils \
driver \
runtime \
docs \
__compiler_and_lib
/*OUT: parsers */
#undef __compiler_and_lib
/* "CONTRIB" is also a SUBDIR, but there is nothing to build there.
*/
/* the standard "whoami" target will give the basic info. */
/* this target adds to it. */
whoami::
@echo using a \`$(BUILDPLATFORM)\' host to build a Haskell compiler to run on a
@echo \`$(HOSTPLATFORM)\' host that will generate \`C\' target code
#-----------------------------------------------------------------------------
# $Id: Makefile,v 1.2 1996/11/21 16:46:26 simonm Exp $
TOP=..
include $(TOP)/ghc/mk/ghc.mk
line = @echo "------------------------------------------------------------------------------"
define BuildLibs
$(line)
@echo "Building Libraries"
$(line)
@$(MAKE) -C lib depend all
endef
define BuildCompiler
$(line)
@echo "Building Compiler"
$(line)
@$(MAKE) -C compiler depend all
endef
# dependencies:
# everything needs utils
# includes needs driver (for mkNativeGen.c)
# make depend except in {utils,driver} needs includes
# RTS and compiler need includes
boot ::
$(line)
@echo "Building Utils"
$(line)
@$(MAKE) -C utils depend all
$(line)
@echo "Building Driver"
$(line)
@$(MAKE) -C driver all
$(line)
@echo "Building Includes"
$(line)
@$(MAKE) -C includes all
$(line)
@echo "Building Runtime System"
$(line)
@$(MAKE) -C runtime depend all
$(line)
@echo "Building Docs"
$(line)
@$(MAKE) -C docs depend all
ifeq ($(HaskellCompilerType), HC_USE_HC_FILES)
$(BuildLibs)
$(BuildCompiler)
else
$(BuildCompiler)
$(BuildLibs)
endif
# "CONTRIB" is also a SUBDIR, but there is nothing to build there.
SUBDIRS = utils driver includes runtime docs compiler lib
# Make the required directories for install.
install_dirs ::
$(MKDIRHIER) $(INSTBINDIR_GHC)
$(MKDIRHIER) $(INSTSCRIPTDIR_GHC)
$(MKDIRHIER) $(INSTLIBDIR_GHC)
$(MKDIRHIER) $(INSTLIBDIR_GHC)/includes
$(MKDIRHIER) $(INSTDATADIR_GHC)
$(MKDIRHIER) $(INSTDATADIR_GHC)/includes
$(MKDIRHIER) $(INSTDATADIR_GHC)/imports
install :: install_dirs
include $(TOP)/mk/subdir.mk
# hand-hacked Makefile to boot the "make world" process
#---------------------------------------------------------------------
# Platform-specific configuration stuff was read from: sun.cf
SHELL = /bin/sh
PATHSEP = /
#******** NB: TOP setting
TOP = ..
CURRENT_DIR = ./ghc
RM=rm -f
MV=mv -f
BOOTSTRAPCFLAGS =
# Project identification -- name, version, and stuff
PROJECTNAME = Booting the Make World System
PROJECTVERSION = none
PROJECTLABEL = generic
SETUPLABEL = std
PROJECTCONFIGDIR =
###########################################################################
# Configuration stuff (jmake, its friends and templates)
JMKMF = jmkmf_used_only_with_installed_utils
JRESTOREDEPS = $(JMAKESRC)/jrestoredeps
JMAKE = $(JMAKESRC)/jmake
JMAKE_DEFINES =
JMAKESRC = $(TOP)/mkworld
JMAKE_CMD = $(NEWTOP)$(JMAKE) -I$(NEWTOP)$(JMAKESRC) $(BOOTSTRAPCFLAGS) -DTopDir=$(TOP) -DCurDir=$(CURRENT_DIR) $(BOOT_DEFINES)
###########################################################################
Makefile:: $(JMAKE)
$(JMAKE):
@(cd $(JMAKESRC) && if [ -f Makefile ]; then \
echo "checking $@ in $(JMAKESRC) first..."; $(MAKE) all; else \
echo "bootstrapping $@ from Makefile.BOOT in $(JMAKESRC) first..."; \
$(MAKE) -f Makefile.BOOT BOOTSTRAPCFLAGS=$(BOOTSTRAPCFLAGS); fi; \
echo "okay, continuing in $(CURRENT_DIR)")
Makefile::
-@if [ -f Makefile ]; then \
echo " $(RM) Makefile.bak; $(MV) Makefile Makefile.bak"; \
$(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \
else exit 0; fi
$(JMAKE_CMD)
$(JRESTOREDEPS)
@if cmp -s Makefile Makefile.bak; then $(RM) Makefile.bak ; else exit 0 ; fi
@chmod 444 Makefile
@echo ==== The new Makefile is for\: ====
@$(MAKE) whoami
This diff is collapsed.
# -----------------------------------------------------------------------------
# $Id: Makefile,v 1.2 1996/11/21 16:46:32 simonm Exp $
TOP = ../..
FlexSuffixRules = YES
YaccSuffixRules = YES
SuffixRule_WantStdOnes = NO
include $(TOP)/ghc/mk/ghc.mk
# Problem: don't know whether GhcWithHscBuiltViaC until now, so we have
# to re-include rules.mk to get the correct suffix rules.
FlexSuffixRules =
YaccSuffixRules =
ifeq ($(GhcWithHscBuiltViaC),YES)
HC = $(GHC)
SuffixRule_hc_o = YES
else
HaskellSuffixRules = YES
endif
include $(TOP)/mk/rules.mk
#-----------------------------------------------------------------------------
# make libhsp.a
YFLAGS = -d
CFLAGS = -Iparser -I. -IcodeGen
ARCHIVE = libhsp.a
DESTDIR = $(INSTLIBDIR_GHC)
UGN = $(wildcard parser/*.ugn)
UGNC = $(patsubst %.ugn, %.c, $(UGN))
UGNH = $(patsubst %.ugn, %.h, $(UGN))
UGNHS = $(patsubst parser/%.ugn, parser/U_%.hs, $(UGN))
LIBOBJS = \
$(patsubst %.c, %.o, $(UGNC)) parser/hslexer.o parser/hsparser.tab.o \
parser/id.o parser/infix.o parser/syntax.o parser/type2context.o \
parser/util.o
parser/%.h parser/%.c parser/U_%.hs : parser/%.ugn
@$(RM) $@ parser/$*.hs parser/U_$*.hs parser/$*.h
$(UGEN) $< || $(RM) parser/$*.h parser/$*.hs
@$(MV) -f parser/$*.hs parser/U_$*.hs
@chmod 444 parser/$*.h parser/U_$*.hs
parser/%.o : parser/%.c $(UGNH)
@$(RM) $@
$(CC) $(CFLAGS) -c $< -o $@
clean ::
$(RM) parser/hslexer.c parser/hsparser.tab.h parser/hsparser.tab.c
parser/hslexer.o : parser/hslexer.c parser/hsparser.tab.h
include $(TOP)/mk/lib.mk
#-----------------------------------------------------------------------------
ifeq ($(IncludeTestDirsInBuild),YES)
SUBDIRS = tests
endif
ifeq ($(Ghc2_0),YES)
%.hi : %_1_3.lhi
$(RM) $@
$(GHC_UNLIT) $< $@ || ( $(RM) $@ && exit 1 )
@chmod 444 $@
else
%.hi : %.lhi
$(RM) $@
$(GHC_UNLIT) $< $@ || ( $(RM) $@ && exit 1 )
@chmod 444 $@
endif
DIRS = \
utils basicTypes types hsSyn prelude rename typecheck deSugar coreSyn \
specialise simplCore stranal stgSyn simplStg codeGen absCSyn main \
reader profiling parser
# -----------------------------------------------------------------------------
# optional directories
ifeq ($(GhcWithDeforester),YES)
DIRS += deforest
endif
ifeq ($(GhcWithNativeCodeGen),YES)
DIRS += nativeGen
else
ifeq ($(GhcWithHscBuiltViaC),YES)
# If building via C, we *assume* that it is the distributed C files,
# which do not have a native-code generator in them
else
DIRS += nativeGen
endif
endif
# -----------------------------------------------------------------------------
# wildcard to get the lists of sources/objects
INCLUDEDIRS = $(foreach dir,$(DIRS),-i$(dir))
SRCS = \
$(foreach dir,$(DIRS),$(wildcard $(dir)/*.lhs)) \
$(UGNHS) rename/ParseIface.hs
LOOPS = $(patsubst %.lhi, %.hi, $(wildcard */*.lhi))
HCS = $(patsubst %.hs, %.hc, $(patsubst %.lhs, %.hc, $(SRCS)))
OBJS = \
$(patsubst %.hc, %.o, $(HCS)) rename/ParseIface.o \
parser/hsclink.o parser/hschooks.o libhsp.a
# -----------------------------------------------------------------------------
# options for the Haskell compiler
MAKEFLAGS += --no-builtin-rules
HC_OPTS += \
-cpp $(HcMaxHeapFlag) $(HcMaxStackFlag) -fhaskell-1.3 \
-fglasgow-exts -DCOMPILING_GHC -Rghc-timing -I. -IcodeGen \
-InativeGen -Iparser $(INCLUDEDIRS)
# expect 12 shift/reduce conflicts and 0 reduce/reduce conflicts
ifeq ($(GhcWithHscDebug),YES)
HC_OPTS += -DDEBUG
CFLAGS += -DDEBUG
endif
ifneq ($(Ghc2_0),YES)
HC_OPTS += -fomit-derived-read -fomit-reexported-instances
endif
ifeq ($(GhcWithHscOptimised),YES)
HC_OPTS += -O -fshow-import-specs
endif
ifeq ($(GhcWithDeforester),NO)
HC_OPTS += -DOMIT_DEFORESTER
endif
# ----------------------------------------------------------------------------
all :: hsc libhsp.a
hsc : $(OBJS)
$(HC) $(HC_OPTS) -o $@ $^
parser/hschooks.o : parser/hschooks.c
@$(RM) $@
$(HC) -c -o $@ $(HCFLAGS) parser/hschooks.c
rename/ParseIface.hs : rename/ParseIface.y
@$(RM) rename/ParseIface.hs rename/ParseIface.hinfo
happy -g rename/ParseIface.y
@chmod 444 rename/ParseIface.hs
# ----------------------------------------------------------------------------
# Special flags for particular modules
absCSyn/AbsCSyn_flags = -fno-omit-reexported-instances
hsSyn/HsExpr_flags = -K2m
hsSyn/HsSyn_flags = -fno-omit-reexported-instances
main/Main_flags = -fvia-C
basicTypes/IdInfo_flags = -K2m
main/CmdLineOpts_flags = -fvia-C
coreSyn/AnnCoreSyn_flags = -fno-omit-reexported-instances
nativeGen/PprMach_flags = -K2m
parser/UgenAll_flags = -fvia-C '-\#include"hspincl.h"'
parser/UgenUtil_flags = -fvia-C '-\#include"hspincl.h"'
parser/U_constr_flags = -fvia-C '-\#include"hspincl.h"'
parser/U_binding_flags = -fvia-C '-\#include"hspincl.h"'
parser/U_pbinding_flags = -fvia-C '-\#include"hspincl.h"'
parser/U_entidt_flags = -fvia-C '-\#include"hspincl.h"'
parser/U_list_flags = -fvia-C '-\#include"hspincl.h"'
parser/U_literal_flags = -fvia-C '-\#include"hspincl.h"'
parser/U_maybe_flags = -fvia-C '-\#include"hspincl.h"'
parser/U_either_flags = -fvia-C '-\#include"hspincl.h"'
parser/U_qid_flags = -fvia-C '-\#include"hspincl.h"'
parser/U_tree_flags = -fvia-C '-\#include"hspincl.h"'
parser/U_ttype_flags = -fvia-C '-\#include"hspincl.h"'
prelude/PrimOp_flags = -K3m
reader/ReadPrefix_flags = -fvia-C '-\#include"hspincl.h"'
rename/ParseIface_flags = -Onot -H16m
rename/RnMonad_flags = -fvia-C
rename/RnSource_flags = -H12m
rename/RnIfaces_flags = -H8m
rename/RnNames_flags = -H12m
specialise/Specialise_flags = -Onot -H12m
stgSyn/StgSyn_flags = -fno-omit-reexported-instances
typecheck/TcMonad_flags = -fvia-C
typecheck/TcGenDeriv_flags = -H10m
typecheck/TcExpr_flags = -H10m
utils/Argv_flags = -fvia-C
utils/CharSeq_flags = -fvia-C
utils/SST_flags = -fvia-C
#-----------------------------------------------------------------------------
# make depend, clean, tags and install
MKDEPENDHSFLAGS = -f .depend -I../includes -x HsVersions.h
ifeq ($(GhcWithDeforester),NO)
MKDEPENDHSFLAGS += -DOMIT_DEFORESTER
endif
ifeq ($(GhcWithHscBuiltViaC),YES)
MKDEPENDHSFLAGS += -o .hc
else
HS_DEP_SRCS = $(SRCS) # should add $(LOOPS) ?
include $(TOP)/mk/hsdepend.mk
endif
clean ::
$(RM) */*.o */*.hi $(UGNC) $(UGNH) $(UGNHS)
$(RM) rename/ParseIface.hs
veryclean ::
$(RM) */*.hc
tags ::
@$(RM) TAGS
@touch TAGS
$(HSTAGS) -I../includes $(HSTAGSFLAGS) $(SRCS)
install ::
$(INSTALL) $(INSTBINFLAGS) hsc $(INSTLIBDIR_GHC)
......@@ -66,7 +66,7 @@ import Unique ( Unique{-instance Eq-} )
import UniqSupply ( splitUniqSupply )
import Util ( panic{-ToDo:rm-} )
#if ! OMIT_DEFORESTER
#ifndef OMIT_DEFORESTER
import Deforest ( deforestProgram )
import DefUtils ( deforestable )
#endif
......
#define IHaveSubdirs
/* just documents here */
#define NoAllTargetForSubdirs
#define NoDependTargetForSubdirs
#define NoRunTestsTargetForSubdirs
#define NoInstallTargetForSubdirs
#define NoTagTargetForSubdirs
SUBDIRS = users_guide \
install_guide \
release_notes \
state_interface
TOP = ../..
include $(TOP)/ghc/mk/ghc.mk
SUBDIRS = users_guide install_guide release_notes state_interface
include $(TOP)/mk/subdir.mk
DocProcessingSuffixRules()
LitDocRootTarget(installing,lit)
TOP = ../../..
LiterateSuffixRules = YES
DocProcessingSuffixRules = YES
include $(TOP)/ghc/mk/ghc.mk
#TARGETS = installing.texi installing.dvi
/* there are rules to make this piece of "the book"
* as a standalone document,
* but nothing to "install" it
*/
LiterateSuffixRules()
DocProcessingSuffixRules()
/* no space between the two args! */
LitDocRootTarget(release,lit)
TOP = ../../..
LiterateSuffixRules = YES
include $(TOP)/ghc/mk/ghc.mk
#DocProcessingSuffixRules()
#LitDocRootTarget(release,lit)
TOP = ../../..
include $(TOP)/ghc/mk/ghc.mk
state-interface.dvi : state-interface.tex
$(RM) state-interface.dvi
latex state-interface.tex
$(LATEX) state-interface.tex
state-interface.tex : state-interface.verb
$(RM) state-interface.tex
@$(RM) state-interface.tex
expand state-interface.verb | verbatim > state-interface.tex
LiterateSuffixRules()
DocProcessingSuffixRules()
/* no space between the args! */
/*LitDocRootTarget(profiling,lit)*/
LitDocRootTarget(user,lit)
TOP = ../../..
LiterateSuffixRules = YES
include $(TOP)/ghc/mk/ghc.mk
#DocProcessingSuffixRules()
#LitDocRootTarget(profiling,lit)
#LitDocRootTarget(user,lit)
/* stuff to have before we get going */
MsubNeededHere(ghc)
UnlitNeededHere(depend)
DYN_LOADABLE_BITS = \
ghc-asm.prl \
ghc-recomp.prl \
ghc-iface.prl \
ghc-consist.prl \
ghc-split.prl
/* Literate-pgmming suffix rules used herein */
UnlitSuffixRule(.lprl,.prl)
MsubMakefileDependentProgramScriptTarget(PerlCmd,ghc,ghc.prl,/*no flags*/,/*Makefile*/)
AllTarget( $(DYN_LOADABLE_BITS) )