summaryrefslogtreecommitdiff
path: root/tiger-compiler/src/llvmtranslate/local.am
blob: d5a752b68586a446e816fd0153b5fd65e95fcd99 (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
# Compile the LLVM Tiger runtime
EXTRA_DIST += %D%/tiger-runtime.c
CLEANFILES += %D%/runtime.ll
%D%/runtime.ll: %D%/tiger-runtime.c
	$(AM_V_CC)$(CLANG) -c -m32 -std=c99 -emit-llvm -S -o $@ $^

LLVM_RUNTIME_GENERATION = %D%/generate-runtime.sh
EXTRA_DIST += $(LLVM_RUNTIME_GENERATION)
CLEANFILES += %D%/runtime.cc
%D%/runtime.cc: %D%/runtime.ll
	$(AM_V_GEN)$(srcdir)/$(LLVM_RUNTIME_GENERATION) $< $@

## llvmtranslate module.
src_libtc_la_SOURCES +=                                                        \
  %D%/escapes-collector.cc %D%/escapes-collector.hh                            \
  %D%/translator.hh %D%/translator.hxx %D%/translator.cc                       \
  %D%/libllvmtranslate.cc %D%/libllvmtranslate.hh                              \
  %D%/llvm-type-visitor.cc %D%/llvm-type-visitor.hh                            \
  %D%/fwd.hh

nodist_src_libtc_la_SOURCES += %D%/runtime.cc

## FIXME: Add SWIG support for this module

## LLVM flags are found using `llvm-config`.

if STATIC_LLVM
EXTRA_LLVM_CONFIG_FLAGS = --link-static
else
EXTRA_LLVM_CONFIG_FLAGS =
endif

AM_CXXFLAGS += `$(LLVM_CONFIG) $(EXTRA_LLVM_CONFIG_FLAGS) --cppflags`
src_libtc_la_LDFLAGS +=                                                        \
  `$(LLVM_CONFIG) $(EXTRA_LLVM_CONFIG_FLAGS) --ldflags`                        \
  `$(LLVM_CONFIG) $(EXTRA_LLVM_CONFIG_FLAGS) --libs core linker asmparser irprinter` \
  `$(LLVM_CONFIG) $(EXTRA_LLVM_CONFIG_FLAGS) --system-libs`

TASKS += %D%/tasks.hh %D%/tasks.cc