From 0d430efb42fffda741b59bf6399da55e1399ad0e Mon Sep 17 00:00:00 2001 From: Josh Berdine Date: Mon, 28 Jun 2021 03:34:29 -0700 Subject: [PATCH] [sledge] Query llvm-config for compilation flags for tests Summary: At least when installation of the conf-llvm package uses a non-system llvm, additional compilation flags are needed. These can be queries by asking opam for the location of the llvm-config binary, and asking that for the compilation flags. Reviewed By: ngorogiannis Differential Revision: D28907810 fbshipit-source-id: 6806c78a8 --- sledge/test/Makefile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sledge/test/Makefile b/sledge/test/Makefile index 603419504..78f77cefe 100644 --- a/sledge/test/Makefile +++ b/sledge/test/Makefile @@ -36,6 +36,10 @@ diff?=patdiff # select llvm and clang used by opam export PATH := $(shell $$(opam config var conf-llvm:config) --bindir):$(PATH) +# query llvm-config for compilation flags +C_FLAGS = $(shell $$(opam config var conf-llvm:config) --cflags) +CXX_FLAGS = $(shell $$(opam config var conf-llvm:config) --cxxflags) + # configure sort export LANG := C @@ -43,11 +47,11 @@ default: test # compile c to llvm bitcode %.bc : %.c $(CURDIR)/../model/llair_intrinsics.h - (cd $(@D) && clang -g -c -emit-llvm -include $(CURDIR)/../model/llair_intrinsics.h -Wno-main-return-type $(CLANG_ARGS) -o $(@F) $(