Changes to make fptools insfrastructure usable for standalone libraries

Alastair Reid alastair at reid-consulting-uk.ltd.uk
Tue May 27 10:45:52 EDT 2003


Hi Simon,

I've been playing with how to add Hugs support to the fptools infrastructure.  
I didn't get as far as I'd hoped but thought I'd run what I had past you for 
comments.

Full diffs are attached but the basic idea is to use the --with-hc option to 
set a variable 'ForSystem' to one of HUGS, GHC, NHC or UNKNOWN.

*** configure.in        27 May 2003 14:02:04 -0000      1.194
--- configure.in        27 May 2003 14:34:16 -0000
***************
*** 414,419 ****
--- 414,428 ----
  )
  AC_SUBST(WithHc)

+ case ${WithHc} in
+   (*ghc*)  ForSystem=GHC ;;
+   (*hugs*) ForSystem=HUGS ;;
+   (*nhc*)  ForSystem=NHC ;;
+   (*)      ForSystem=UNKNOWN
+            echo "Unable to identify system from value of '${WithHc}'"
+ esac
+ AC_SUBST(ForSystem)
+

Then we (very liberally) sprinkle 

+ ifeq "$(ForSystem)" "GHC"
+
...
+ endif # $(ForSystem) == GHC
+

around  to remove GHC-specific rules.  (There are a lot of GHC (or, at least, 
non-Hugs) rules!)

Then we add in a few Hugs-specific rules like this greencard rule:

 ifeq "${ForSystem}" "HUGS"
+
+ %.so : %.hs %_stub_ffi.c %_stub_ffi.h
+       ffihugs +G ${EXTRA_FFI_OPTS} $*.hs +L"$*_stub_ffi.c" $(addprefix +L, 
$(CC_OPTS)) $(addprefix +L, $(LD_OPTS))
+
+
+ endif # $(ForSystem) == HUGS
+

There's other ways to go about this which might be better:

1) Instead of replacing existing make targets, we could add new targets with 
names like:

   hugs-all
   ghc-all
   hugs-install
   ghc-install

2) We could use Ross's conversion scripts

   It might be that this would make the makefile infrastructure
   almost irrelevant (we'd use it for documentation targets and
   the like but not for hugs builds or installs).  In that case, we could
   make do with a tiny hugs-specific makefile called

      Makefile.hugs

   which uses fptools/mk/config.mk (to get $libdir etc) and provides targets
   install, uninstall, all and clean.  

Any thoughts or preferences?

--
Alastair
-------------- next part --------------
A non-text attachment was scrubbed...
Name: diffs
Type: text/x-diff
Size: 6034 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/glasgow-haskell-bugs/attachments/20030527/ffed5913/diffs.bin


More information about the Glasgow-haskell-bugs mailing list