From 6b083af4f392a118285913d6f2c45b124b522609 Mon Sep 17 00:00:00 2001 From: Andrzej Kotulski Date: Tue, 15 Nov 2016 04:26:22 -0800 Subject: [PATCH] [tests] small refactor of frontend makefiles Reviewed By: jvillard Differential Revision: D4166862 fbshipit-source-id: 9e3c706 --- .../Makefile.frontend => clang-frontend.make} | 6 ++--- infer/tests/codetoanalyze/c/frontend/Makefile | 16 ++++++----- .../tests/codetoanalyze/cpp/frontend/Makefile | 15 ++++++----- .../codetoanalyze/objc/frontend/Makefile | 27 +++++++++---------- .../codetoanalyze/objcpp/frontend/Makefile | 18 ++++++------- 5 files changed, 42 insertions(+), 40 deletions(-) rename infer/tests/{codetoanalyze/Makefile.frontend => clang-frontend.make} (86%) diff --git a/infer/tests/codetoanalyze/Makefile.frontend b/infer/tests/clang-frontend.make similarity index 86% rename from infer/tests/codetoanalyze/Makefile.frontend rename to infer/tests/clang-frontend.make index 5fc416554..4407f256f 100644 --- a/infer/tests/codetoanalyze/Makefile.frontend +++ b/infer/tests/clang-frontend.make @@ -5,20 +5,20 @@ # LICENSE file in the root directory of this source tree. An additional grant # of patent rights can be found in the PATENTS file in the same directory. -ROOT_DIR = ../../../../.. +ROOT_DIR = $(TESTS_DIR)/../.. include $(ROOT_DIR)/Makefile.config default: compile test: capture set -e; \ - for file in $(FILES) ; do \ + for file in $(SOURCES) ; do \ diff -u $$file.dot $$file.test.dot ; \ done $(MAKE) clean replace: capture - for file in $(FILES) ; do \ + for file in $(SOURCES) ; do \ mv $$file.test.dot $$file.dot ; \ done $(MAKE) clean diff --git a/infer/tests/codetoanalyze/c/frontend/Makefile b/infer/tests/codetoanalyze/c/frontend/Makefile index 19ecf3270..63a73033a 100644 --- a/infer/tests/codetoanalyze/c/frontend/Makefile +++ b/infer/tests/codetoanalyze/c/frontend/Makefile @@ -5,16 +5,18 @@ # LICENSE file in the root directory of this source tree. An additional grant # of patent rights can be found in the PATENTS file in the same directory. -include ../../Makefile.frontend +TESTS_DIR=../../.. -OPTIONS = -c +CLANG_OPTIONS = -c -FILES = \ - */*.c \ - */*.cpp \ +SOURCES = \ + $(wildcard */*.c) \ + $(wildcard */*.cpp) \ + +include $(TESTS_DIR)/clang-frontend.make compile: - clang $(OPTIONS) $(FILES) + clang $(CLANG_OPTIONS) $(SOURCES) capture: - $(INFER_BIN) -a capture --frontend-tests --cxx -- clang $(OPTIONS) $(FILES) + $(INFER_BIN) -a capture --frontend-tests --cxx -- clang $(CLANG_OPTIONS) $(SOURCES) diff --git a/infer/tests/codetoanalyze/cpp/frontend/Makefile b/infer/tests/codetoanalyze/cpp/frontend/Makefile index 908a21e1e..75929bc65 100644 --- a/infer/tests/codetoanalyze/cpp/frontend/Makefile +++ b/infer/tests/codetoanalyze/cpp/frontend/Makefile @@ -5,16 +5,19 @@ # LICENSE file in the root directory of this source tree. An additional grant # of patent rights can be found in the PATENTS file in the same directory. -include ../../Makefile.frontend +TESTS_DIR=../../.. # see explanations in cpp/errors/Makefile for the custom isystem -OPTIONS = -x c++ -std=c++11 -nostdinc++ -isystem$(ROOT_DIR) -isystem$(CLANG_INCLUDES)/c++/v1/ -c +CLANG_OPTIONS = -x c++ -std=c++11 -nostdinc++ -isystem$(ROOT_DIR) -isystem$(CLANG_INCLUDES)/c++/v1/ -c -FILES = \ - */*.cpp shared/*/*.cpp \ +SOURCES = \ + $(wildcard */*.cpp) \ + $(wildcard shared/*/*.cpp) \ + +include $(TESTS_DIR)/clang-frontend.make compile: - clang $(OPTIONS) $(FILES) + clang $(CLANG_OPTIONS) $(SOURCES) capture: - $(INFER_BIN) -a capture --frontend-tests --cxx --headers -- clang $(OPTIONS) $(FILES) + $(INFER_BIN) -a capture --frontend-tests --cxx --headers -- clang $(CLANG_OPTIONS) $(SOURCES) diff --git a/infer/tests/codetoanalyze/objc/frontend/Makefile b/infer/tests/codetoanalyze/objc/frontend/Makefile index f3830fbda..1f5a1412b 100644 --- a/infer/tests/codetoanalyze/objc/frontend/Makefile +++ b/infer/tests/codetoanalyze/objc/frontend/Makefile @@ -5,17 +5,17 @@ # LICENSE file in the root directory of this source tree. An additional grant # of patent rights can be found in the PATENTS file in the same directory. -include ../../Makefile.frontend +TESTS_DIR=../../.. IPHONESIMULATOR_ISYSROOT_SUFFIX = /Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk XCODEROOT = $(shell xcode-select -p) -OPTIONS = -x objective-c \ +CLANG_OPTIONS = -x objective-c \ -isysroot $(XCODEROOT)$(IPHONESIMULATOR_ISYSROOT_SUFFIX) \ -mios-simulator-version-min=8.2 --target=x86_64-apple-darwin14 -c \ -FILES_NOARC = \ +SOURCES_NOARC = \ block/retain_cycle.m \ block/static.m \ boxing/Boxing.m \ @@ -66,7 +66,7 @@ FILES_NOARC = \ vardecl/aclass_2.m \ vardecl/last_af.m \ -FILES_ARC = \ +SOURCES_ARC = \ predefined_expr/PredefinedExprExample.m \ types/attributes.m \ types/void_call.m \ @@ -77,17 +77,16 @@ FILES_ARC = \ shared/memory_leaks_benchmark/arc_methods.m \ shared/npe/Nonnull_attribute_example.m \ -FILES = \ - $(FILES_NOARC) \ - $(FILES_ARC) \ +SOURCES = \ + $(SOURCES_NOARC) \ + $(SOURCES_ARC) \ + +include $(TESTS_DIR)/clang-frontend.make compile: - clang $(OPTIONS) $(FILES_NOARC) - clang $(OPTIONS) -fobjc-arc $(FILES_ARC) + clang $(CLANG_OPTIONS) $(SOURCES_NOARC) + clang $(CLANG_OPTIONS) -fobjc-arc $(SOURCES_ARC) capture: - $(INFER_BIN) -a capture --cxx --frontend-tests --continue --reactive -- clang $(OPTIONS) $(FILES_NOARC) - $(INFER_BIN) -a capture --cxx --frontend-tests -- clang $(OPTIONS) -fobjc-arc $(FILES_ARC) - - - + $(INFER_BIN) -a capture --cxx --frontend-tests --continue --reactive -- clang $(CLANG_OPTIONS) $(SOURCES_NOARC) + $(INFER_BIN) -a capture --cxx --frontend-tests -- clang $(CLANG_OPTIONS) -fobjc-arc $(SOURCES_ARC) diff --git a/infer/tests/codetoanalyze/objcpp/frontend/Makefile b/infer/tests/codetoanalyze/objcpp/frontend/Makefile index 2c795f7b3..6df1d97fc 100644 --- a/infer/tests/codetoanalyze/objcpp/frontend/Makefile +++ b/infer/tests/codetoanalyze/objcpp/frontend/Makefile @@ -5,25 +5,23 @@ # LICENSE file in the root directory of this source tree. An additional grant # of patent rights can be found in the PATENTS file in the same directory. -include ../../Makefile.frontend +TESTS_DIR=../../.. IPHONESIMULATOR_ISYSROOT_SUFFIX = /Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk XCODEROOT = $(shell xcode-select -p) -OPTIONS = -x objective-c++ -std=c++11 \ +CLANG_OPTIONS = -x objective-c++ -std=c++11 \ -isysroot $(XCODEROOT)$(IPHONESIMULATOR_ISYSROOT_SUFFIX) \ -mios-simulator-version-min=8.2 --target=x86_64-apple-darwin14 -c \ -FILES = \ - funcoverloading/af_test.mm \ - global_const/global_const.mm \ +SOURCES = \ + $(wildcard */*.mm) \ + +include $(TESTS_DIR)/clang-frontend.make compile: - clang $(OPTIONS) $(FILES) + clang $(CLANG_OPTIONS) $(SOURCES) capture: - $(INFER_BIN) -a capture --cxx --frontend-tests --continue --reactive -- clang $(OPTIONS) $(FILES) - - - + $(INFER_BIN) -a capture --cxx --frontend-tests --continue --reactive -- clang $(CLANG_OPTIONS) $(SOURCES)