Пример makefile

# Makefile for project with 2 executable files written in Haskell

ifdef WINNT

GHC = ghc.exe

EXE = exe

else

GHC = ghc

EXE =

endif

# List of objects for first executable

COMP_OBJ = ALArch.o \

VLTree.o VLParser.o VLCompiler.o GenAsm.o\

compilerMain.o

# List of objects for second executable

INTRP_OBJ = ParsC.o \

ALArch.o ALAsm.o ALParser.o \

interpMain.o

# build all target

all: vlcomp.$(EXE) varun.$(EXE)

vlcomp.$(EXE): $(COMP_OBJ)

$(GHC) --make compilerMain -o $@

varun.$(EXE): $(INTRP_OBJ)

$(GHC) --make interpMain -o $@

# Rule how to build object file from source

%.o:%.hs

$(GHC) -c -o $@ $<

# clean intermediate results

clean:

rm -f *.hi *.o *.$(EXE)