
Simon Marlow
This means we still get to use 'make', we still get to use the .cabal files as metadata, but the build system is more private to GHC, more extensible, and hopefully more understandable and modifiable.
This is essentially the same approach that nhc98 currently takes to building libraries. The Cabal file holds all the metadata, but the build system is Makefile-driven. There is a small separate tool (CabalParse) that extracts metadata from the cabal file. The Cabal *library* could be used to implement that extraction tool, but currently ours is hand-rolled. (One of the benefits of open specifications of file formats is that you can have multiple implementations for different purposes.) Here is an example of how it works: CABALFILE = $(shell ls *.cabal | head -n 1 ) READ = $(CABALPARSE) $(CABALFILE) -quiet MAP = $(LOCAL)map THISPKG = $(shell $(READ) name | cut -c2- ) VERSION = $(shell $(READ) version) SEARCH = $(shell $(READ) build-depends | $(MAP) "echo -package" ) \ $(shell $(READ) include-dirs | $(MAP) "echo -i" | cut -c1,2,4-) \ $(shell $(READ) hs-source-dir | $(MAP) "echo -I" | cut -c1,2,4-) \ $(shell $(READ) hs-source-dirs | $(MAP) "echo -I" | cut -c1,2,4-) CINCLUDES = $(shell $(READ) include-dirs | $(MAP) "echo -I" | cut -c1,2,4-) SRCS = $(shell $(READ) -slash exposed-modules) EXTRA_SRCS = $(shell $(READ) -slash other-modules) SRCS_C = $(shell $(READ) c-sources) DIRS = $(shell $(READ) -slash exposed-modules other-modules \ | $(MAP) dirname | sort | uniq ) EXTRA_C_FLAGS = $(shell $(READ) cc-options) EXTRA_H_FLAGS = $(shell $(READ) nhc98-options) Regards, Malcolm