Ticket #1346: ghc.diff

File ghc.diff, 17.9 KB (added by kili, 7 years ago)

Work in Progres, QUICK HACK ALERT!

  • Makefile

    To create an unregisterised bundle, run make witht he targets "boostrap"
    and "hc-file-bundle". I'm using the following settings in mk/build.mk:
    
    	GhcBootLibs =		YES
    	GhcLibHcOpts =   	-O -fvia-C -keep-hc-files
    	GhcLibWays =
    	GhcRTSWays =
    	GhcRtsHcOpts =		-keep-hc-files
    	GhcStage1HcOpts =	-O
    	GhcStage2HcOpts =	-O -fvia-C -keep-hc-files
    	GhcUnregisterised =	YES
    	GhcWithInterpreter =	NO
    	GhcWithSMP =		NO
    	SRC_HC_OPTS =    	-H64
    	SplitObjs =      	NO
    
    ===== Start of diffs, comments above each diff ===
    
    No need to build compat when booting from HC files.
    Generate and include dependency makefiles.
    Don't bail out on a missing Parser.hs (from package haskell-src,
    i.e. extralibs).
    
    diff -rNup ghc-6.8.2.orig/Makefile ghc-6.8.2/Makefile
    old new include $(TOP)/mk/boilerplate.mk 
    5959 
    6060# We can't 'make boot' in libraries until stage1 is built 
    6161ifeq "$(BootingFromHc)" "YES" 
    62 SUBDIRS_BUILD = gmp includes rts compat compiler docs utils driver 
     62SUBDIRS_BUILD = gmp includes rts compiler docs utils driver 
    6363else 
    6464SUBDIRS_BUILD = gmp includes compat utils driver docs compiler rts libraries/Cabal/doc 
    6565endif 
    endif 
    498498# HC file bundles 
    499499 
    500500hc-file-bundle : 
     501        cd libraries && $(MAKE) bootmakefiles 
    501502        $(RM) -r ghc-$(ProjectVersion) 
    502503        $(LN_S) . ghc-$(ProjectVersion) 
    503504        $(FIND) ghc-$(ProjectVersion)/compiler \ 
    504505             ghc-$(ProjectVersion)/utils \ 
    505              ghc-$(ProjectVersion)/compat \ 
    506506             ghc-$(ProjectVersion)/libraries -follow \ 
    507           \( -name "*.hc" -o -name "*_hsc.[ch]" -o -name "*_stub.[ch]" \) -print > hc-files-to-go 
     507          \( -name "*.hc" -o -name "*_hsc.[ch]" -o -name "*_stub.[ch]" \ 
     508                -o -name boot.mk \ 
     509          \) -print > hc-files-to-go 
    508510        for f in `$(FIND) ghc-$(ProjectVersion)/compiler ghc-$(ProjectVersion)/utils ghc-$(ProjectVersion)/libraries -name "*.hsc" -follow -print` ""; do \ 
    509511             if test "x$$f" != "x" && test -e `echo "$$f" | sed 's/hsc$$/hs/g'`; then \ 
    510512                echo `echo "$$f" | sed 's/hsc$$/hs/g' ` >> hc-files-to-go ; \ 
    hc-file-bundle : 
    515517                echo `echo "$$f" | sed 's/cmm$$/hc/g' ` >> hc-files-to-go ; \ 
    516518             fi; \ 
    517519        done; 
     520        echo ghc-$(ProjectVersion)/driver/package.conf.inplace >> hc-files-to-go 
    518521        echo ghc-$(ProjectVersion)/libraries/base/GHC/PrimopWrappers.hs >> hc-files-to-go 
    519522        echo ghc-$(ProjectVersion)/compiler/parser/Parser.hs >> hc-files-to-go 
    520523        echo ghc-$(ProjectVersion)/compiler/parser/ParserCore.hs >> hc-files-to-go 
    521524        echo ghc-$(ProjectVersion)/compiler/main/ParsePkgConf.hs >> hc-files-to-go 
    522         echo ghc-$(ProjectVersion)/libraries/haskell-src/Language/Haskell/Parser.hs >> hc-files-to-go 
    523525        tar czf ghc-$(ProjectVersion)-$(TARGETPLATFORM)-hc.tar.gz `cat hc-files-to-go` 
    524526 
    525527# ----------------------------------------------------------------------------- 
  • aclocal.m4

    Don't use homebrewn pwd implemented in Haskell.
    Yes, I know, this patch will break MINGW, but I've already suggested
    a fix to the mailing lists.
    
    diff -rNup ghc-6.8.2.orig/aclocal.m4 ghc-6.8.2/aclocal.m4
    old new AC_REQUIRE([AC_PROG_CC]) 
    10981098AC_DEFUN([FP_FIND_ROOT],[ 
    10991099AC_MSG_CHECKING(for path to top of build tree) 
    11001100 
    1101 dnl This would be 
    1102 dnl     make -C utils/pwd clean && make -C utils/pwd 
    1103 dnl except we don't want to have to know what make is called. Sigh. 
    1104 if test ! -f utils/pwd/pwd && test ! -f utils/pwd/pwd.exe; then 
    1105   cd utils/pwd 
    1106   rm -f *.o 
    1107   rm -f *.hi 
    1108   rm -f pwd 
    1109   rm -f pwd.exe 
    1110   $WithGhc -v0 --make pwd -o pwd 
    1111   cd ../.. 
    1112 fi 
    1113  
    1114 hardtop=`utils/pwd/pwd forwardslash` 
    1115  
    1116 if ! test -d "$hardtop"; then 
    1117   AC_MSG_ERROR([cannot determine current directory]) 
    1118 fi    
     1101hardtop=`pwd` 
    11191102 
    11201103dnl Remove common automounter nonsense 
    11211104dnl 
  • compiler/Makefile

    
    When bootstrapping from HC-files, don't try to build with interpreter
    and don't links against libghccompat.
    Use CC to build ghc-inplace, not HC.
    Don't set DESTDIR (sorry, I forgot why I need this).
    Pull in required libraries.
    
    diff -rNup ghc-6.8.2.orig/compiler/Makefile ghc-6.8.2/compiler/Makefile
    old new SRC_HC_OPTS += -package hpc -package bytestring 
    442442PKG_DEPENDS += hpc bytestring 
    443443endif 
    444444 
    445 ifeq "$(GhcWithInterpreter) $(bootstrapped)" "YES YES" 
     445ifeq "$(GhcWithInterpreter) $(bootstrapped) $(BootingFromHc)" "YES YES NO" 
    446446 
    447447# Yes, include the interepreter and Template Haskell extensions 
    448448SRC_HC_OPTS += -DGHCI -package template-haskell 
    primop-usage.hs-incl: prelude/primops.txt 
    723723#----------------------------------------------------------------------------- 
    724724#               Linking 
    725725 
    726 # Include libghccompat in stage1 only.  In stage2 onwards, all these 
    727 # libraries will be available from the main libraries. 
     726# Include libghccompat in stage1 only, and only if not bootstrapping 
     727# from HC files.  In stage2 onwards, all these libraries will be 
     728# available from the main libraries. 
    728729 
    729 ifeq "$(stage)" "1" 
     730ifeq "$(BootingFromHc)$(stage)" "NO1" 
    730731include $(GHC_COMPAT_DIR)/compat.mk 
    731732endif 
    732733 
    $(INPLACE_SRC): ghc-inplace.c 
    753754        $(SED) -e "s@GHC_PATH@$(GHC_PATH)@g" -e "s@TOP_ABS@$(FPTOOLS_TOP_ABS)@g" < $< > $@ 
    754755 
    755756$(INPLACE_PROG): $(INPLACE_SRC) 
     757ifneq "$(BootingFromHc)" "YES" 
    756758        $(HC) -cpp $(INPLACE_EXTRA_FLAGS) $< -o $@ 
     759else 
     760        $(CC) $(HC_BOOT_CC_OPTS) $(INPLACE_EXTRA_FLAGS) $< -o $@ 
     761endif 
    757762 
    758763all :: $(INPLACE_PROG) 
    759764 
    endif 
    775780# but put it together with the libraries. 
    776781# Also don't want any interface files installed 
    777782 
    778 DESTDIR = $(INSTALL_LIBRARY_DIR_GHC) 
    779783 
    780784ifneq "$(HOSTPLATFORM)" "i386-unknown-mingw32" 
    781785INSTALL_LIBEXECS += $(GHC_PROG) 
    $(odir)/utils/FastMutInt.$(way_)o : ../includes/MachD 
    10231027MKDEPENDHS_HC_OPTS = $(patsubst -i$(odir)/%, -i%, $(HC_OPTS)) 
    10241028 
    10251029MKDEPENDHS=$(HC) 
     1030 
     1031ifeq "$(BootingFromHc)" "YES" 
     1032include $(TOP)/libraries/Cabal/boot.mk 
     1033include $(TOP)/libraries/bytestring/boot.mk 
     1034include $(TOP)/libraries/haskell98/boot.mk 
     1035# XXX why is hpc needed? 
     1036include $(TOP)/libraries/hpc/boot.mk 
     1037HC_BOOT_CC_OPTS += $(foreach P,$(DEP_PKGS),-I$(TOP)/libraries/$P/include) 
     1038endif 
    10261039 
    10271040# Must do this *after* including target.mk, because $(HS_SRCS) isn't set yet. 
    10281041depend :: $(STAGE_PLATFORM_H) $(HS_SRCS) $(C_SRCS) 
  • libraries/Makefile

    
    Add a target to create some makefile fragments that will be included
    by a special makefile called Makefile.boot that'll be copied into
    all library directories when bootstrapping from HC files.
    
    diff -rNup ghc-6.8.2.orig/libraries/Makefile ghc-6.8.2/libraries/Makefile
    old new  
    2020#   [ -e foo/configure.ac ] && ( cd foo && autoreconf ) 
    2121#   make make.library.foo 
    2222 
    23 .PHONY: default_target show 
    24  
    25 default_target: all 
    26  
    27 show: 
    28         @echo '$(VALUE)="$($(VALUE))"' 
    29  
    3023# make doesn't give us an easy way to get the libraries built in 
    3124# dependency order the first time, but not rebuild base (for example) 
    3225# when we want to rebuild another library later. 
    show: 
    3831TOP=.. 
    3932include $(TOP)/mk/boilerplate.mk 
    4033 
     34ifneq "$(BootingFromHc)" "YES" 
     35 
     36.PHONY: default_target show 
     37 
     38default_target: all 
     39 
     40show: 
     41        @echo '$(VALUE)="$($(VALUE))"' 
     42 
     43 
    4144SUBDIRS  = base array packedstring containers bytestring 
    4245SUBDIRS += old-locale old-time filepath directory 
    4346ifeq "$(GhcLibsWithUnix)" "YES" 
    binary-dist.library.%: 
    402405html-no-chunks chm HxS fo dvi ps pdf: 
    403406        @: 
    404407 
     408# Build some simple Makefile fragments to get all transitive 
     409# dependencies and other information for bootstrapping from HC files 
     410 
     411.PHONY: bootmakefiles 
     412 
     413bootmakefiles: boot.mk \ 
     414                $(foreach SUBDIR,$(SUBDIRS),$(SUBDIR)/boot.mk) 
     415 
     416%/boot.mk: Makefile 
     417        echo ifndef $*-version > $@ 
     418        echo 'PACKAGE ?= $*' >> $@ 
     419        for f in version exposed-modules hidden-modules extra-libraries; do \ 
     420                $(TOP)/utils/ghc-pkg/ghc-pkg-inplace field $* $$f | \ 
     421                        sed -e "s/$$f:/$*-$$f =/" \ 
     422                                -e 's/$$/ \\/' \ 
     423                                -e '$$s/ \\$$//'; \ 
     424        done >> $@ 
     425        # Hack! This information isn't registered in the package.conf, 
     426        # so get it from the cabal-generated GNUmakefile. This should be 
     427        # really done with a small Haskell program using Cabal. 
     428        { cd $* && $(MAKE) --no-print-directory -s -f GNUmakefile \ 
     429                show VALUE=C_SRCS; } | sed 's/^/$*-/;s/"//g' >> $@ 
     430        $(TOP)/utils/ghc-pkg/ghc-pkg-inplace field $* depends | \ 
     431                tr ' ' '\n' | \ 
     432                sed -e 's/-[0-9][0-9.]*//g' -e 's/depends://' \ 
     433                        -e '/^rts$$/d' -e '/^$$/d' \ 
     434                        -e 's!^!include $$(TOP)/libraries/!' \ 
     435                        -e 's!$$!/boot.mk!' >> $@ 
     436        echo 'DEP_PKGS := $* $$(filter-out $*, $$(DEP_PKGS))' >> $@ 
     437        echo endif >> $@ 
     438 
     439boot.mk: 
     440        echo "SUBDIRS = $(SUBDIRS)" > $@ 
     441 
     442 
     443else 
     444 
     445# BootingFromHc 
     446include boot.mk 
     447 
     448boot:: $(foreach SUBDIR,$(SUBDIRS),$(SUBDIR)/Makefile) 
     449 
     450%/Makefile: Makefile.boot 
     451        $(CP) $^ $@ 
     452 
     453include $(TOP)/mk/target.mk 
     454endif 
  • libraries/Makefile.boot

    
    Makefile for building the libraries when bootstrapping from HC
    files.  It's the same for all libraries and gets the library-specific
    information from  the generated boot.mk files.
    
    diff -rNup ghc-6.8.2.orig/libraries/Makefile.boot ghc-6.8.2/libraries/Makefile.boot
    old new  
     1TOP=../.. 
     2include $(TOP)/mk/boilerplate.mk 
     3include boot.mk 
     4 
     5modules = $($(PACKAGE)-exposed-modules) $($(PACKAGE)-hidden-modules) 
     6 
     7ALL_DIRS = $(patsubst %/,%,$(sort $(dir $(subst .,/,$(modules))))) 
     8 
     9C_SRCS = $($(PACKAGE)-C_SRCS) 
     10 
     11HC_BOOT_CC_OPTS += $(addprefix -I../, $(addsuffix /include, $(DEP_PKGS))) 
     12 
     13# Ad hoc exclusion of sources that aren't used. 
     14base-EXCLUDED_SRCS = GHC/Prim.hs 
     15filepath-EXCLUDED_SRCS = System/FilePath/Internal.hs 
     16 
     17EXCLUDED_SRCS = $($(PACKAGE)-EXCLUDED_SRCS) 
     18EXCLUDED_SRCS += Setup.hs Setup.lhs DefaultSetup.lhs 
     19 
     20odir = dist/build 
     21 
     22STUB_SRCS = $(wildcard $(patsubst %, $(odir)/%/*_stub.c, $(ALL_DIRS))) 
     23STUB_OBJS += $(patsubst %.c, %.o, $(STUB_SRCS)) 
     24 
     25LIBOBJS = $(addprefix $(odir)/,$(OBJS)) $(STUB_OBJS) 
     26LIBRARY = $(odir)/libHS$(PACKAGE).a 
     27 
     28boot::  stamp-configure 
     29 
     30all::   $(LIBRARY) 
     31 
     32stamp-configure: 
     33        if [ -x configure ]; then \ 
     34                ./configure \ 
     35                           $(CONFIGURE_OPTS) \ 
     36                           --prefix=/NONEXISTANT \ 
     37                           --bindir=/NONEXISTANT \ 
     38                           --libdir=/NONEXISTANT \ 
     39                           --libexecdir=/NONEXISTANT \ 
     40                           --datadir=/NONEXISTANT \ 
     41                           --with-hc=../../compiler/stage1/ghc-inplace \ 
     42                           --with-hc-pkg=../../utils/ghc-pkg/ghc-pkg-inplace \ 
     43                           --with-hsc2hs=../../utils/hsc2hs/hsc2hs-inplace \ 
     44                           --with-ld=$(LD) \ 
     45                           $(CONFIGURE_ARGS) \ 
     46                           --with-cc=$(CC); \ 
     47        fi 
     48        touch $@ 
     49 
     50include $(TOP)/mk/target.mk 
  • libraries/ifBuildable.sh

    
    Replacement hack for ifBuildable. I don't remember wether this is
    really needed for bootstrapping from HC files.
    
    diff -rNup ghc-6.8.2.orig/libraries/ifBuildable.sh ghc-6.8.2/libraries/ifBuildable.sh
    old new  
     1#!/bin/sh 
     2# 
     3# Replacement of that strange ifBuildable.hs 
     4 
     5if [ $# != 1 ]; then 
     6        echo 'Syntax: ifBuildable <package>' >& 2 
     7        exit 1 
     8fi 
     9 
     10set -e 
     11 
     12cd "$1" 
     13 
     14if [ -f unbuildable ] && 
     15        { [ "$1" = readline ] || ! grep -qF "$1" ../boot-packages; } 
     16then 
     17        echo 'Warning: Package is unbuildable' >& 2 
     18        exit 1 
     19fi 
  • mk/bootstrap.mk

    
    Search GMP_LIB_DIRS when linking (not related to bootstrapping, and
    probably already fixed).
    Fix list of libraries linked into stage1 / HC-bootstrap.
    
    diff -rNup ghc-6.8.2.orig/mk/bootstrap.mk ghc-6.8.2/mk/bootstrap.mk
    old new endif 
    8383 
    8484ifeq "$(HaveLibGmp)" "NO" 
    8585DASH_L_GHC_RTS_GMP_DIR=-L$(FPTOOLS_TOP_ABS)/$(GHC_RTS_DIR_REL)/gmp 
     86else 
     87DASH_L_GHC_RTS_GMP_DIR=$(foreach D,$(GMP_LIB_DIRS),-L$D) 
    8688endif 
    8789 
    88 HC_BOOT_LD_OPTS =                               \ 
    89    -L$(FPTOOLS_TOP_ABS)/$(GHC_RTS_DIR_REL)      \ 
    90    $(DASH_L_GHC_RTS_GMP_DIR)                    \ 
    91    -L$(FPTOOLS_TOP_ABS)/libraries/base          \ 
    92    -L$(FPTOOLS_TOP_ABS)/libraries/base/cbits    \ 
    93    -L$(FPTOOLS_TOP_ABS)/libraries/haskell98     \ 
    94    -L$(FPTOOLS_TOP_ABS)/libraries/parsec        \ 
    95    -L$(FPTOOLS_TOP_ABS)/libraries/regex-base    \ 
    96    -L$(FPTOOLS_TOP_ABS)/libraries/regex-posix   \ 
    97    -L$(FPTOOLS_TOP_ABS)/libraries/regex-compat  \ 
    98    -L$(FPTOOLS_TOP_ABS)/libraries/Cabal 
     90# XXX DEP_PKGS stuff should probably moved to compiler/Makefile. 
     91HC_BOOT_LD_OPTS =                                       \ 
     92   -L$(FPTOOLS_TOP_ABS)/$(GHC_RTS_DIR_REL)              \ 
     93   $(DASH_L_GHC_RTS_GMP_DIR)                            \ 
     94   $(foreach P,$(DEP_PKGS),-L$(FPTOOLS_TOP_ABS)/libraries/$P/dist/build) 
    9995 
    100 ifeq "$(GhcWithInterpreter)" "YES" 
    10196HC_BOOT_LD_OPTS += \ 
    102    -L$(FPTOOLS_TOP_ABS)/libraries/template-haskell      \ 
    103    -L$(FPTOOLS_TOP_ABS)/libraries/readline      \ 
    104    -L$(FPTOOLS_TOP_ABS)/libraries/unix          \ 
    105    -L$(FPTOOLS_TOP_ABS)/libraries/unix/cbits 
    106 endif 
    107  
    108 HC_BOOT_LD_OPTS += \ 
    10997   -u "$(UNDERSCORE)base_GHCziBase_Izh_static_info" \ 
    11098   -u "$(UNDERSCORE)base_GHCziBase_Czh_static_info" \ 
    11199   -u "$(UNDERSCORE)base_GHCziFloat_Fzh_static_info" \ 
    HC_BOOT_LD_OPTS += \ 
    139127   -u "$(UNDERSCORE)__stginit_Prelude" 
    140128 
    141129 
    142 HC_BOOT_LIBS = 
     130HC_BOOT_LIBS =   $(addprefix -lHS, $(DEP_PKGS)) \ 
     131                 $(addprefix -l, $(foreach P, $(DEP_PKGS), \ 
     132                                        $($P-extra-libraries))) \ 
     133                 -lHSrts -lgmp -lm $(EXTRA_HC_BOOT_LIBS) 
    143134 
    144 ifeq "$(GhcWithInterpreter)" "YES" 
    145 HC_BOOT_LIBS += -lHSreadline -lHStemplate-haskell -lHSunix -lHSunix_cbits 
    146 endif 
    147  
    148 HC_BOOT_LIBS +=  -lHSregex-compat -lHSregex-posix -lHSregex-base -lHSCabal -lHShaskell98 -lHSbase -lHSbase_cbits -lHSparsec -lHSrts -lgmp -lm -lrt $(EXTRA_HC_BOOT_LIBS) 
    149135 
    150136ifeq "$(GhcLibsWithReadline)" "YES" 
    151137HC_BOOT_LIBS += $(patsubst %, -l%, $(LibsReadline)) 
  • mk/opts.mk

    
    GMP_INCLUDE_DIRS is required for bootstrapping from HC files, but
    it shouldn't hurt other builds, so add it here.
    
    diff -rNup ghc-6.8.2.orig/mk/opts.mk ghc-6.8.2/mk/opts.mk
    old new BLD_DLL_OPTS = $(SRC_BLD_DLL_OPTS) $(WAY$(_way)_ 
    7777CPP_OPTS           = $(SRC_CPP_OPTS) $(WAY$(_way)_CPP_OPTS) $(EXTRA_CPP_OPTS) 
    7878CTAGS_OPTS         = $(SRC_CTAGS_OPTS) $(WAY$(_way)_CTAGS_OPTS) $(EXTRA_CTAGS_OPTS) 
    7979CC_OPTS            = $(SRC_CC_OPTS) $(WAY$(_way)_CC_OPTS) $($*_CC_OPTS) $(EXTRA_CC_OPTS) 
     80ifneq "$(GMP_INCLUDE_DIRS)" "" 
     81CC_OPTS           += -I$(GMP_INCLUDE_DIRS) 
     82endif 
    8083FLEX_OPTS          = $(SRC_FLEX_OPTS) $(WAY$(_way)_FLEX_OPTS) $(EXTRA_FLEX_OPTS) 
    8184HADDOCK_OPTS       = $(SRC_HADDOCK_OPTS) $(WAY$(_way)_HADDOCK_OPTS) $($*_HADDOCK_OPTS) $(EXTRA_HADDOCK_OPTS) 
    8285HAPPY_OPTS         = $(SRC_HAPPY_OPTS) $($(HcFlavour)_HAPPY_OPTS) $(WAY$(_way)_HAPPY_OPTS) $($*_HAPPY_OPTS) $(EXTRA_HAPPY_OPTS) 
  • mk/suffix.mk

    
    Some tweaks needed for bootstrapping from HC files.
    
    diff -rNup ghc-6.8.2.orig/mk/suffix.mk ghc-6.8.2/mk/suffix.mk
    old new ifeq "$(BootingFromUnregisterisedHc)" "YES" 
    125125# without mangling 
    126126 
    127127$(odir_)%.o : %.hc 
    128         $(CC) -x c $< -o $@ -c -O $(HC_BOOT_CC_OPTS) -I.  `echo $(patsubst -monly-%-regs, -DSTOLEN_X86_REGS=%, $(filter -monly-%-regs, $($*_HC_OPTS))) | sed 's/^$$/-DSTOLEN_X86_REGS=4/'` 
     128        @mkdir -p $(dir $@) 
     129        $(CC) -x c $< -o $@ -c -O $(HC_BOOT_CC_OPTS) -I. -Iinclude \ 
     130                $(addprefix -I,$(odir)) \ 
     131                `echo $(patsubst -monly-%-regs, -DSTOLEN_X86_REGS=%, $(filter -monly-%-regs, $($*_HC_OPTS))) | sed 's/^$$/-DSTOLEN_X86_REGS=4/'` 
    129132 
     133$(odir_)%.o : $(odir_)%.hc 
     134        $(CC) -x c $< -o $@ -c -O $(HC_BOOT_CC_OPTS) -I. -Iinclude \ 
     135                $(addprefix -I,$(odir)) \ 
     136                `echo $(patsubst -monly-%-regs, -DSTOLEN_X86_REGS=%, $(filter -monly-%-regs, $($*_HC_OPTS))) | sed 's/^$$/-DSTOLEN_X86_REGS=4/'` 
     137 
    130138else 
    131139 
    132140# with mangling 
    133141 
    134142$(odir_)%.raw_s : %.hc 
    135         $(CC) -x c $< -o $@ -S -O $(HC_BOOT_CC_OPTS) -I.  `echo $(patsubst -monly-%-regs, -DSTOLEN_X86_REGS=%, $(filter -monly-%-regs, $($*_HC_OPTS))) | sed 's/^$$/-DSTOLEN_X86_REGS=4/'` 
     143        @mkdir -p $(dir $@) 
     144        $(CC) -x c $< -o $@ -S -O $(HC_BOOT_CC_OPTS) -I. -Iinclude \ 
     145                $(addprefix -I,$(odir)) \ 
     146                `echo $(patsubst -monly-%-regs, -DSTOLEN_X86_REGS=%, $(filter -monly-%-regs, $($*_HC_OPTS))) | sed 's/^$$/-DSTOLEN_X86_REGS=4/'` 
    136147 
     148$(odir_)%.raw_s : $(odir_)%.hc 
     149        $(CC) -x c $< -o $@ -S -O $(HC_BOOT_CC_OPTS) -I. -Iinclude \ 
     150                $(addprefix -I,$(odir)) \ 
     151                `echo $(patsubst -monly-%-regs, -DSTOLEN_X86_REGS=%, $(filter -monly-%-regs, $($*_HC_OPTS))) | sed 's/^$$/-DSTOLEN_X86_REGS=4/'` 
     152 
    137153$(odir_)%.s : $(odir_)%.raw_s 
    138154        $(MANGLER) $< $@ $(patsubst -monly-%-regs, %, $(filter -monly-%-regs, $($*_HC_OPTS))) 
    139155 
    else 
    208224 
    209225$(odir_)%.$(way_)o : %.c 
    210226        @$(RM) $@ 
    211         $(CC) $(CC_OPTS) -c $< -o $@ 
     227        @mkdir -p $(dir $@) 
     228        $(CC) $(CC_OPTS) -Iinclude -c $< -o $@ 
    212229 
    213230$(odir_)%.$(way_)o : %.$(way_)s 
    214231        @$(RM) $@ 
     232        @mkdir -p $(dir $@) 
    215233        $(AS) $(AS_OPTS) -o $@ $< 
    216234 
    217235$(odir_)%.$(way_)o : %.S 
    218236        @$(RM) $@ 
     237        @mkdir -p $(dir $@) 
    219238        $(CC) $(CC_OPTS) -c $< -o $@ 
    220239 
    221240$(odir_)%.$(way_)s : %.c 
    222241        @$(RM) $@ 
    223         $(CC) $(CC_OPTS) -S $< -o $@ 
     242        @mkdir -p $(dir $@) 
     243        $(CC) $(CC_OPTS) -Iinclude -S $< -o $@ 
    224244 
    225245endif 
    226246 
     247ifneq "$(BootingFromHc)" "YES" 
    227248# stubs are automatically generated and compiled by GHC 
    228249%_stub.$(way_)o: %.o 
    229250        @: 
     251else 
     252# have to compile the stubs from the HC file bundle 
     253$(odir_)%.o : $(odir_)%.c 
     254        @$(RM) $@ 
     255        @mkdir -p $(dir $@) 
     256        $(CC) $(CC_OPTS) -Iinclude -c $< -o $@ 
     257endif 
    230258 
    231259# ----------------------------------------------------------------------------- 
    232260# Flex/lex 
  • utils/Makefile

    
    Don't try to build unused tools.
    
    diff -rNup ghc-6.8.2.orig/utils/Makefile ghc-6.8.2/utils/Makefile
    old new ifeq "$(DOING_BIN_DIST)" "YES" 
    66SUBDIRS = mkdirhier ghc-pkg hasktags hp2ps hsc2hs parallel prof unlit runghc hpc pwd 
    77else 
    88ifeq "$(BootingFromHc)" "YES" 
    9 SUBDIRS = mkdependC mkdirhier runstdtest genapply genprimopcode ghc-pkg unlit 
     9SUBDIRS = mkdependC mkdirhier runstdtest unlit 
    1010else 
    1111SUBDIRS = mkdependC mkdirhier runstdtest ghc-pkg hasktags hp2ps hsc2hs \ 
    1212          parallel prof unlit genprimopcode genapply runghc hpc pwd