Dave's Brain

Browse - Programming Tips - How can I setup a Makefile for my mini Haskell programs?

Date: 2017oct6
Language: Haskell
Keywords: Haskel

Q.  How can I setup a Makefile for my mini Haskell programs?

A.  Assuming you have a folder with hello.hs, hello_getline.hs and factorial.hs

Put this in a file called "Makfile"

# Set the names of your programs here ALL = hello hello_getline factorial all: $(ALL) install: all install $(ALL) /usr/local/bin clean: rm $(ALL) % : %.hs ghc -Wno-tabs -o $@ $<
So you can do:
make - Which builds all make hello - Just compiles hello.hs make clean - Which removes all programs

Add a comment

Sign in to add a comment
Copyright © 2008-2017, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.