Original patch by Talin.
[oota-llvm.git] / unittests / Makefile.unittest
1 ##===- unittests/Makefile.unittest -------------------------*- Makefile -*-===##
2 #
3 #                     The LLVM Compiler Infrastructure
4 #
5 # This file is distributed under the University of Illinois Open Source
6 # License. See LICENSE.TXT for details.
7 #
8 ##===----------------------------------------------------------------------===##
9 #
10 # This file is included by all of the unit test makefiles.
11 #
12 ##===----------------------------------------------------------------------===##
13
14 # Set up variables for building a unit test.
15 ifdef TESTNAME
16
17 LLVMUnitTestDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/unittests
18 LLVMUnitTestExe := $(LLVMUnitTestDir)/$(TESTNAME)Tests$(EXEEXT)
19
20 include $(LEVEL)/Makefile.common
21
22 CPP.Flags += -I$(LLVM_SRC_ROOT)/utils/unittest/googletest/include/
23 CPP.Flags += -Wno-variadic-macros
24 LD.Flags += -lGoogleTest -lUnitTestMain
25
26 $(LLVMUnitTestExe): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
27         $(Echo) Linking $(BuildMode) unit test $(TESTNAME) $(StripWarnMsg)
28         $(Verb) $(LTLink) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
29         $(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB) $(LIBS)
30         $(Echo) ======= Finished Linking $(BuildMode) Unit test $(TESTNAME) \
31           $(StripWarnMsg)
32
33 all:: $(LLVMUnitTestExe)
34         $(LLVMUnitTestExe)
35
36 endif