Commit b802bbad authored by Simon Marlow's avatar Simon Marlow
Browse files

Use setup makefile + make by default to build libraries

The advantages of this are
  (a) it's a step closer to getting -j working again (make -j works in
      an individual library, but not in libraries/ yet).
  (b) it's easier to hack on libraries: make dist/build/Foo.o
  (c) it's a step closer to getting HC bootstrapping again

The build system creates <lib>/GNUmakefile as part of 'make boot'.
This was chosen so as not to interfere with existing Makefiles, but
it's a bit of a hack.  (previously I used CabalMakefile, but that
means adding -f CabalMakefile each time you run make, and that's a
parent c1548918
......@@ -8,7 +8,7 @@
# To rebuild a particular library <package>:
# make clean.library.<package>
# make build.library.<package>
# make make.library.<package>
# or the following is equivalent:
......@@ -18,7 +18,7 @@
# darcs get
# [ -e foo/ ] && ( cd foo && autoreconf )
# make
# make
.PHONY: default_target
......@@ -117,6 +117,7 @@ subdirs:
boot: $(BOOTSTRAP_STAMPS) ifBuildable/ifBuildable \
$(foreach SUBDIR,$(SUBDIRS),$(SUBDIR)/setup/Setup) \
$(foreach SUBDIR,$(SUBDIRS),$(SUBDIR)/GNUmakefile) \
# We build the Setup program in a setup subdirectory to stop it trying
......@@ -165,15 +166,16 @@ endif
.PHONY: rebuild.library.%
$(foreach SUBDIR,$(SUBDIRS),rebuild.library.$(SUBDIR)):\
rebuild.library.%: clean.library.% build.library.%
rebuild.library.%: clean.library.% make.library.%
build: $(foreach SUBDIR,$(SUBDIRS),build.library.$(SUBDIR))
build: $(foreach SUBDIR,$(SUBDIRS),make.library.$(SUBDIR))
build: installPackage/installPackage
configure: $(foreach SUBDIR,$(SUBDIRS), \
.PHONY: build.library.%
.PHONY: make.library.%
# We should depend on %/%.cabal here (and in other rules), but make
# makes that difficult.
......@@ -216,19 +218,27 @@ stamp/$(CONFIGURE_STAMP_EXTRAS).%: %/setup/Setup
# This is particularly important for corelibs, where failure means the
# build dies!
# Build the library using 'make'
$(foreach SUBDIR,$(SUBDIRS),make.library.$(SUBDIR)):\
make.library.%: stamp/$(CONFIGURE_STAMP_EXTRAS).% \
%/GNUmakefile \
%/setup/Setup ifBuildable/ifBuildable
ifBuildable/ifBuildable $* $(MAKE)
ifBuildable/ifBuildable $* setup/Setup register --inplace
# Build the library using 'setup build' (not the default)
$(foreach SUBDIR,$(SUBDIRS),build.library.$(SUBDIR)):\
build.library.%: stamp/$(CONFIGURE_STAMP_EXTRAS).% \
%/setup/Setup ifBuildable/ifBuildable
ifBuildable/ifBuildable $* setup/Setup build \
$(addprefix --ghc-option=,$(GhcLibHcOpts))
ifBuildable/ifBuildable $* setup/Setup register --inplace
$(foreach SUBDIR,$(SUBDIRS),$(SUBDIR)/CabalMakefile):\
%/CabalMakefile: stamp/$(CONFIGURE_STAMP_EXTRAS).% \
$(foreach SUBDIR,$(SUBDIRS),$(SUBDIR)/GNUmakefile):\
%/GNUmakefile: stamp/$(CONFIGURE_STAMP_EXTRAS).% \
%/setup/Setup ifBuildable/ifBuildable
$(RM) $*/CabalMakefile
ifBuildable/ifBuildable $* setup/Setup makefile -f CabalMakefile \
$(addprefix --ghc-option=,$(GhcLibHcOpts))
$(RM) $*/GNUmakefile
cp Makefile.local $*
ifBuildable/ifBuildable $* setup/Setup makefile -f GNUmakefile
.PHONY: doc
# Local GHC-build-tree customization for Cabal makefiles. We want to build
# libraries using flags that the user has put in
# Careful here: including breaks things, because and
# overrides some of the variable settings in the Cabal Makefile, so
# we just include and
SAVE_AR := $(AR)
SAVE_LD := $(LD)
include $(TOP)/mk/
include $(TOP)/mk/
AR := $(SAVE_AR)
LD := $(SAVE_LD)
# Now add flags from the GHC build system to the Cabal build:
GHC_OPTS += $(GhcLibHcOpts)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment