Add BFtoLLVM example front end
[oota-llvm.git] / examples / BFtoLLVM / tests / Makefile
1 ##===- examples/BFtoLLVM/tests/Makefile --------------------*- Makefile -*-===##
2 #
3 #                     The LLVM Compiler Infrastructure
4 #
5 # This file was developed by the LLVM research group and is distributed under
6 # the University of Illinois Open Source License. See LICENSE.TXT for details.
7 #
8 ##===----------------------------------------------------------------------===##
9
10 # Makefile for bf2llvm tests.
11
12 LEVEL = ../../..
13 BFTOLLVM = $(LLVMTOOLCURRENT)/BFtoLLVM
14
15 include $(LEVEL)/Makefile.common
16
17 all:: check
18
19 clean::
20         rm -rf Output
21
22 .SUFFIXES: .ll .gccas.bc .llvm .cbe.c .cbe
23
24 Output/%.ll: %.b $(BFTOLLVM) Output/.dir
25         $(BFTOLLVM) $< $@
26
27 Output/%.gccas.bc: Output/%.ll Output/.dir
28         $(LGCCAS) $< -o $@
29
30 Output/%.llvm Output/%.llvm.bc: Output/%.gccas.bc Output/.dir
31         $(LGCCLD) $< -lc -lcrtend -o Output/$*.llvm
32
33 Output/%.cbe.c: Output/%.llvm.bc Output/.dir
34         $(LLC) -march=c -f -o=$@ $<
35
36 Output/%.cbe: Output/%.cbe.c Output/.dir
37         $(CC) -O2 $< -o $@
38
39 check: Output/hello.cbe hello.expected-out
40         @echo "Running test"
41         Output/hello.cbe > Output/hello.out-cbe
42         @echo "Checking result"
43         diff Output/hello.out-cbe hello.expected-out
44         @echo "Test passed"
45