aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Makefile
diff options
authorChristopher Li <sparse@chrisli.org>2012-01-02 13:47:21 -0800
committerChristopher Li <sparse@chrisli.org>2012-01-02 14:01:37 -0800
commite68f464686c2fcec987d76ecc3da061db7f784e9 (patch)
treec162ff53496e76db7e39820db3f4dbb3fd1bf5ca /Makefile
parent65a4e2fc656aa6e99604358056d8599a1823a8bc (diff)
parent65be24b8ddf54164ff25febfd3d5f9c26ae3877d (diff)
downloadsparse-dev-e68f464686c2fcec987d76ecc3da061db7f784e9.tar.gz
Merge branch 'sparse-llvm' of git://github.com/penberg/sparse-llvm.git
'master' branch of git://github.com/penberg/sparse-llvm.git Revert "sparse: Bump up sizeof(_Bool) to 8 bits" sparse, llvm: Add test case for <stdbool.h> type sparse, llvm: Use LLVMInt1Type() in sym_basetype_type() sparse, llvm: Don't fail the build if LLVM is too old Merge pull request #6 from jgarzik/hacks sparse, llvm: add loop testcase sparse, llvm: Fix loops, by properly handling OP_PHI forward references sparse, llvm: FP comparison op code generation sparse, llvm: Simplify comparison op code generation sparse, llvm: More comparison ops code generation sparse, llvm: OP_SET_B and OP_SET_A code generation sparse, llvm: Pointer cast code generation sparse, llvm: Make llc output to stdout in sparsec sparse, llvm: Fix 'extern' symbol code generation sparse, llvm: Fix symbol initializer code generation sparse, llvm: Function pointer code generation sparse, llvm: Make 'sparsec' error handling more robust sparse, llvm: Add support for union types sparse, llvm: Add support for array types sparse, llvm: Fix symbol_type() for bitfields and enums sparse, llvm: Fix struct code generation sparse, llvm: Use new LLVM type system API for structs sparse, llvm: Fix 'void *' pointer code generation sparse, llvm: Add support for logical ops sparse: Bump up sizeof(_Bool) to 8 bits sparse, llvm: Add support for symbol initializers sparse, llvm: Add support for struct types sparse, llvm: Fix code generation for 'long double' data type Merge pull request #4 from jgarzik/hacks sparse, llvm: support OP_STORE sparse, llvm: move OP_COPY support to separate function. Add FP support. sparse, llvm: store module-local functions on function reference list llvm, sparse: Fix symbol_is_fp_type() goof Merge branch 'master' of github.com:penberg/sparse-llvm Merge pull request #3 from jgarzik/hacks sparse, llvm: Fix pseudo_type() for PSEUDO_ARG sparse, llvm: create helper for obtaining instruction's type sparse, llvm: Fix code generation for casts Revert "sparse, llvm: Don't redefine module local functions" sparse, llvm: Don't redefine module local functions sparse, llvm: Fix PSEUDO_OP code generation sparse, llvm: Improve sparsec front-end sparse, llvm: Fix OP_CAST to use zero-extend sparse, llvm: Cleanup output_data() sparse, llvm: Code generation for string constants sparse, llvm: Warn the user when we fall back to GCC Limit usage of g++ to llvm related programs. Merge pull request #2 from jgarzik/hacks sparse, llvm: move OP_CAST code to separate func. support FP casts. cse: update PHI users when throwing away an instruction cse: treat PHI-nodes as other instructions Merge pull request #1 from jgarzik/hacks sparse, llvm: move OP_PHI code from switch statement to separate function sparse, llvm: implement OP_CALL sparse, llvm: replace FIXME comment with assert(), following existing style sparse-llvm OP_PHISOURCE: replace copy with target=src pointer operation sparse, llvm: Kill debugging code sparse, llvm: Kill ifdef'd unssa() call sparse, llvm: Bitwise not operator codegen sparse, llvm: Reorganize code generation tests sparse, llvm: Floating point support for binops sparse-llvm: OP_LOAD sparse-llvm: OP_SWITCH sparse-llvm: OP_SEL sparse, llvm: if-else code generation sparse, llvm: Implement OP_CAST sparse, llvm: Move binop tests to validation/backend sparse, llvm: Implement some binary comparison ops sparse, llvm: Add support for more binary ops sparse, llvm: Implement OP_ADD sparse, llvm: Add output_op_binary() stub sparse, llvm: Introduce 'struct function' to clean up code sparse, llvm: Add support for OP_RET/PSEUDO_ARG sparse, llvm: OP_RET/PSEUDO_VAL code generation sparse, llvm: Add switch statement to output_insn() llvm, sparse: Separate entry and exit basic blocks sparse, llvm: Fix 'sparsec' when it's not in PATH sparse, llvm: Fix global variable initialization sparse, llvm: Fix assert() in sparse code sparse, llvm: Initial commit
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile26
1 files changed, 25 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 79cadb09..84e5df24 100644
--- a/Makefile
+++ b/Makefile
@@ -7,6 +7,7 @@ CC = gcc
CFLAGS = -O2 -finline-functions -fno-strict-aliasing -g
CFLAGS += -Wall -Wwrite-strings
LDFLAGS += -g
+LD = gcc
AR = ar
ALL_CFLAGS = $(CFLAGS) $(BASIC_CFLAGS)
@@ -21,6 +22,9 @@ HAVE_GCC_DEP:=$(shell touch .gcc-test.c && \
$(CC) -c -Wp,-MD,.gcc-test.d .gcc-test.c 2>/dev/null && \
echo 'yes'; rm -f .gcc-test.d .gcc-test.o .gcc-test.c)
HAVE_GTK2:=$(shell pkg-config --exists gtk+-2.0 2>/dev/null && echo 'yes')
+HAVE_LLVM:=$(shell llvm-config --version >/dev/null 2>&1 && echo 'yes')
+HAVE_LLVM_VERSION:=$(shell llvm-config --version | grep "^[3-9].*" >/dev/null 2>&1 && echo yes)
+LLVM_VERSION=$(shell llvm-config --version)
GCC_BASE = $(shell $(CC) --print-file-name=)
BASIC_CFLAGS = -DGCC_BASE=\"$(GCC_BASE)\"
@@ -63,6 +67,26 @@ else
$(warning Your system does not have libgtk2, disabling test-inspect)
endif
+ifneq ($(HAVE_LLVM),yes)
+$(warning Your system does not have llvm, disabling sparse-llvm)
+else
+ifneq ($(HAVE_LLVM_VERSION),yes)
+$(warning LLVM 3.0 or later required. Your system has version $(LLVM_VERSION) installed.)
+HAVE_LLVM=no
+else
+LLVM_PROGS := sparse-llvm
+$(LLVM_PROGS): LD := g++
+LDFLAGS += $(shell llvm-config --ldflags)
+LLVM_CFLAGS := $(shell llvm-config --cflags | sed -e "s/-DNDEBUG//g")
+LLVM_LIBS := $(shell llvm-config --libs)
+PROGRAMS += $(LLVM_PROGS)
+INST_PROGRAMS += sparse-llvm sparsec
+sparse-llvm_EXTRA_DEPS := sparse-llvm.o
+sparse-llvm.o $(sparse-llvm_EXTRA_DEPS): BASIC_CFLAGS += $(LLVM_CFLAGS)
+sparse-llvm_EXTRA_OBJS := $(LLVM_LIBS)
+endif
+endif
+
LIB_H= token.h parse.h lib.h symbol.h scope.h expression.h target.h \
linearize.h bitmap.h ident-list.h compat.h flow.h allocate.h \
storage.h ptrlist.h dissect.h
@@ -141,7 +165,7 @@ compile_EXTRA_DEPS = compile-i386.o
$(foreach p,$(PROGRAMS),$(eval $(p): $($(p)_EXTRA_DEPS) $(LIBS)))
$(PROGRAMS): % : %.o
- $(QUIET_LINK)$(CC) $(LDFLAGS) -o $@ $^ $($@_EXTRA_OBJS)
+ $(QUIET_LINK)$(LD) $(LDFLAGS) -o $@ $^ $($@_EXTRA_OBJS)
$(LIB_FILE): $(LIB_OBJS)
$(QUIET_AR)$(AR) rcs $@ $(LIB_OBJS)