xuan bach | 28 Dec 07:03 2012
Picon

Makefile for a Haskell Project

Hi everyone,
I'm a newbie in Haskell.

I'm wondering that if there is any tool support
creating Makefile for Haskell project like Ocamlbuild
for Ocaml project?

Thank you,
Regards.

--
Le Dinh Xuan Bach

Tel: 01234711869 or +65 86967149
Email: pig28789 <at> gmail.com
School of Information and Communication,
Hanoi University of Science and Technology
---------------------------------------------------------------------
レ。ディン。スアン。バイック
電話番号:01234711869 or +65 86967149
メール:      pig28789 <at> gmail.com

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Scott Lawrence | 28 Dec 07:08 2012
Picon

Re: Makefile for a Haskell Project

On Fri, 28 Dec 2012, xuan bach wrote:

> Hi everyone,
> I'm a newbie in Haskell.
>
> I'm wondering that if there is any tool support
> creating Makefile for Haskell project like Ocamlbuild
> for Ocaml project?

Since ghc handles dependencies automatically, I usually just do,

 	all:
 		ghc --make myprog

And then make sure `myprog.hs` is your Main module.

>
> Thank you,
> Regards.
>
> -- 
> *Le Dinh Xuan Bach*
> *Tel: 01234711869 or +65 86967149
> *
> *Email: pig28789 <at> gmail.com
> School of Information and Communication,
> *
> *Hanoi University of Science and Technology
> ---------------------------------------------------------------------
> レ。ディン。スアン。バイック
> 電話番号:01234711869 or +65 86967149
> メール:      pig28789 <at> gmail.com
> *
>

--

-- 
Scott Lawrence
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
xuan bach | 28 Dec 07:21 2012
Picon

Re: Makefile for a Haskell Project

Hi Scott,

Thanks for your kind comment.

By the way, is it possible to use ghc --make for my
project including some external libraries and tools
such as happy, Parsec and haskell stub calling C
library?

I also tried out cabal to build my project but it seems
quite complicated to use.

Best Regards.

On Fri, Dec 28, 2012 at 2:08 PM, Scott Lawrence <bytbox <at> gmail.com> wrote:
On Fri, 28 Dec 2012, xuan bach wrote:

Hi everyone,
I'm a newbie in Haskell.

I'm wondering that if there is any tool support
creating Makefile for Haskell project like Ocamlbuild
for Ocaml project?

Since ghc handles dependencies automatically, I usually just do,

        all:
                ghc --make myprog

And then make sure `myprog.hs` is your Main module.


Thank you,
Regards.

--
*Le Dinh Xuan Bach*
*Tel: 01234711869 or +65 86967149
*
*Email: pig28789 <at> gmail.com

School of Information and Communication,
*
*Hanoi University of Science and Technology

---------------------------------------------------------------------
レ。ディン。スアン。バイック
電話番号:01234711869 or +65 86967149
メール:      pig28789 <at> gmail.com
*


--
Scott Lawrence



--
Le Dinh Xuan Bach
Tel: 01234711869 or +65 86967149
Email: pig28789 <at> gmail.com
School of Information and Communication,
Hanoi University of Science and Technology
---------------------------------------------------------------------
レ。ディン。スアン。バイック
電話番号:01234711869 or +65 86967149
メール:      pig28789 <at> gmail.com

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Scott Lawrence | 28 Dec 07:27 2012
Picon

Re: Makefile for a Haskell Project

On Fri, 28 Dec 2012, xuan bach wrote:

> Hi Scott,
>
> Thanks for your kind comment.
>
> By the way, is it possible to use ghc --make for my
> project including some external libraries and tools
> such as happy, Parsec and haskell stub calling C
> library?

I'm not sure about happy and foreign interfaces - as long as parsec is 
installed (via cabal or your distribution's packages), GHC will use it 
correctly.

> I also tried out cabal to build my project but it seems
> quite complicated to use.

It's worth it if you want a more elaborate build process than ghc itself can 
accomodate, or if you intend to distribute your software on hackage. Running 
"cabal init" will guide you through creating a stub cabal file, so it's not 
too bad.

>
> Best Regards.
>
> On Fri, Dec 28, 2012 at 2:08 PM, Scott Lawrence <bytbox <at> gmail.com> wrote:
>
>> On Fri, 28 Dec 2012, xuan bach wrote:
>>
>>  Hi everyone,
>>> I'm a newbie in Haskell.
>>>
>>> I'm wondering that if there is any tool support
>>> creating Makefile for Haskell project like Ocamlbuild
>>> for Ocaml project?
>>>
>>
>> Since ghc handles dependencies automatically, I usually just do,
>>
>>         all:
>>                 ghc --make myprog
>>
>> And then make sure `myprog.hs` is your Main module.
>>
>>
>>> Thank you,
>>> Regards.
>>>
>>> --
>>> *Le Dinh Xuan Bach*
>>> *Tel: 01234711869 or +65 86967149
>>> *
>>> *Email: pig28789 <at> gmail.com
>>>
>>> School of Information and Communication,
>>> *
>>> *Hanoi University of Science and Technology
>>>
>>> ------------------------------**------------------------------**---------
>>> レ。ディン。スアン。バイック
>>> 電話番号:01234711869 or +65 86967149
>>> メール:      pig28789 <at> gmail.com
>>> *
>>>
>>>
>> --
>> Scott Lawrence
>
>
>
>
> -- 
> *Le Dinh Xuan Bach*
> *Tel: 01234711869 or +65 86967149
> *
> *Email: pig28789 <at> gmail.com
> School of Information and Communication,
> *
> *Hanoi University of Science and Technology
> ---------------------------------------------------------------------
> レ。ディン。スアン。バイック
> 電話番号:01234711869 or +65 86967149
> メール:      pig28789 <at> gmail.com
> *
>

--

-- 
Scott Lawrence
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
jims | 28 Dec 10:20 2012

Re: Makefile for a Haskell Project

Quoting xuan bach <pig28789 <at> gmail.com>:

> Hi everyone,
> I'm a newbie in Haskell.
>
> I'm wondering that if there is any tool support
> creating Makefile for Haskell project like Ocamlbuild
> for Ocaml project?

I'v just started learning how to use Neil Mitchell's Shake described at:

http://neilmitchell.blogspot.co.uk/2012/02/shake-better-make.html

Its available on hackage.

Hth
> Thank you,
> Regards.
>
> --
> *Le Dinh Xuan Bach*
> *Tel: 01234711869 or +65 86967149
> *
> *Email: pig28789 <at> gmail.com
> School of Information and Communication,
> *
> *Hanoi University of Science and Technology
> ---------------------------------------------------------------------
> ??????????????
> ?????01234711869 or +65 86967149
> ????      pig28789 <at> gmail.com
> *
>
xuan bach | 2 Jan 07:01 2013
Picon

Re: Makefile for a Haskell Project

Dear all,

Thank you for your kind replies.

I tried to used ghc --make as Mr. Scott suggested.
It is fine if in the C stub I do not call to a non-standard library of C language.
The problem is that if I call to a non-standard C library installed (omega) in my system,
I cannot compile it. Here is my make file using ghc make:

=========================
BASEDIR=/usr/local
INCS= -I$(BASEDIR)/include/omega -I.
LIBS= -L$(BASEDIR)/lib
LIB= -lcode_gen -lomega -lm

GHC=ghc

#----------------------------------------------------
CFILES=$(CURDIR)/cfile
HSFILES=$(CURDIR)/hsfile
COBJFILES=$(CFILES)/termops.o $(CFILES)/termops2.o
ALLCFILES=$(CFILES)/termops.c $(CFILES)/termops2.c
#----------------------------------------------------

GHC_FLAGS= -O2 -fglasgow-exts -fallow-overlapping-instances

_ffi_ex: $(COBJFILES)
    ghc $(GHC_FLAGS)  -lstdc++ --make -main-is  FfiEx -o ffi_ex FfiEx.hs $(HSFILES)/*.hs $(LIBS) $(LIB) $(COBJFILES)
=========================
=>  fatal error: omega.h: No such file or directory

Could you please give me suggestions to solve this?

Thank you.
Best Regards.
Bach.

On Fri, Dec 28, 2012 at 5:20 PM, <jims <at> stuttard.org> wrote:
Quoting xuan bach <pig28789 <at> gmail.com>:

Hi everyone,
I'm a newbie in Haskell.

I'm wondering that if there is any tool support
creating Makefile for Haskell project like Ocamlbuild
for Ocaml project?

I'v just started learning how to use Neil Mitchell's Shake described at:

http://neilmitchell.blogspot.co.uk/2012/02/shake-better-make.html

Its available on hackage.

Hth
Thank you,
Regards.

--
*Le Dinh Xuan Bach*
*Tel: 01234711869 or +65 86967149
*
*Email: pig28789 <at> gmail.com

School of Information and Communication,
*
*Hanoi University of Science and Technology
---------------------------------------------------------------------
??????????????
?????01234711869 or +65 86967149
????      pig28789 <at> gmail.com
*







--
Le Dinh Xuan Bach
Tel: 01234711869 or +65 86967149
Email: pig28789 <at> gmail.com
School of Information and Communication,
Hanoi University of Science and Technology
---------------------------------------------------------------------
レ。ディン。スアン。バイック
電話番号:01234711869 or +65 86967149
メール:      pig28789 <at> gmail.com

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Albert Y. C. Lai | 4 Jan 20:34 2013
Picon

Re: Makefile for a Haskell Project

On 13-01-02 01:01 AM, xuan bach wrote:
> =========================
> BASEDIR=/usr/local
> INCS= -I$(BASEDIR)/include/omega -I.
> LIBS= -L$(BASEDIR)/lib
> LIB= -lcode_gen -lomega -lm
>
> GHC=ghc
>
> #----------------------------------------------------
> CFILES=$(CURDIR)/cfile
> HSFILES=$(CURDIR)/hsfile
> COBJFILES=$(CFILES)/termops.o $(CFILES)/termops2.o
> ALLCFILES=$(CFILES)/termops.c $(CFILES)/termops2.c
> #----------------------------------------------------
>
> GHC_FLAGS= -O2 -fglasgow-exts -fallow-overlapping-instances
>
> _ffi_ex: $(COBJFILES)
>      ghc $(GHC_FLAGS)  -lstdc++ --make -main-is  FfiEx -o ffi_ex
> FfiEx.hs $(HSFILES)/*.hs $(LIBS) $(LIB) $(COBJFILES)
> =========================
> => *fatal error: omega.h: No such file or directory

An implicit rule is triggered to compile *.c to *.o. The rule goes like

$(CC) -c $(CPPFLAGS) $(CFLAGS)

Therefore, your -I$(BASEDIR)/include/omega -I. is ignored.

To solve, put -I$(BASEDIR)/include/omega -I. in CFLAGS, or write your 
own rule for compiling *.c to *.o.
John D. Ramsdell | 15 Jan 21:00 2013
Picon

Re: Makefile for a Haskell Project

This is the Makefile used by CPSA.  It requires GNU make.

John

# Haskell/Cabal Makefile
# Requires GNU Make
# The all target creates a default configuration if need be.

PACKAGE := $(wildcard *.cabal)
CONFIG	= dist/setup-config
SETUP	= runhaskell Setup.hs

all:	$(CONFIG)
	$(SETUP) build

Makefile:
	 <at> echo make $ <at> 

$(PACKAGE):
	 <at> echo make $ <at> 

$(CONFIG):	$(PACKAGE)
	$(SETUP) configure $(CABALFLAGS) --ghc --user --prefix="${HOME}"

%:	force
	$(SETUP) $ <at> 

.PHONY:	all force

Gmane