summaryrefslogtreecommitdiff
path: root/examples/BFtoLLVM/tests/Makefile
blob: ff3d01a2e2e6a19689feee0476262da7b518a3f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
##===- examples/BFtoLLVM/tests/Makefile --------------------*- Makefile -*-===##
#
#                     The LLVM Compiler Infrastructure
#
# This file was developed by the LLVM research group and is distributed under
# the University of Illinois Open Source License. See LICENSE.TXT for details.
#
##===----------------------------------------------------------------------===##

# Makefile for bf2llvm tests.

LEVEL = ../../..
BFTOLLVM = $(LLVMTOOLCURRENT)/BFtoLLVM

include $(LEVEL)/Makefile.common

all:: check

clean::
	rm -rf Output

.SUFFIXES: .ll .gccas.bc .llvm .cbe.c .cbe

Output/%.ll: %.b $(BFTOLLVM) Output/.dir
	$(BFTOLLVM) $< $@

Output/%.gccas.bc: Output/%.ll Output/.dir
	$(LGCCAS) $< -o $@

Output/%.llvm Output/%.llvm.bc: Output/%.gccas.bc Output/.dir
	$(LGCCLD) $< -lc -lcrtend -o Output/$*.llvm

Output/%.cbe.c: Output/%.llvm.bc Output/.dir
	$(LLC) -march=c -f -o=$@ $<

Output/%.cbe: Output/%.cbe.c Output/.dir
	$(CC) -O2 $< -o $@

check: Output/hello.cbe hello.expected-out
	@echo "Running test"
	Output/hello.cbe > Output/hello.out-cbe
	@echo "Checking result"
	diff Output/hello.out-cbe hello.expected-out
	@echo "Test passed"