From 767a3858a772dbb3ba26c9625848c39b465fcc5c Mon Sep 17 00:00:00 2001 From: Malte Mues Date: Thu, 12 Jul 2018 20:12:16 -0400 Subject: [PATCH] Add Makefiles enabeling memory-analyzer and tests --- CMakeLists.txt | 2 ++ regression/memory-analyzer/Makefile | 21 ++++++++++++ src/CMakeLists.txt | 1 + src/Makefile | 4 +++ src/memory-analyzer/CMakeLists.txt | 19 +++++++++++ src/memory-analyzer/Makefile | 37 +++++++++++++++++++++ src/memory-analyzer/module_dependencies.txt | 1 + unit/CMakeLists.txt | 11 ++++++ 8 files changed, 96 insertions(+) create mode 100644 regression/memory-analyzer/Makefile create mode 100644 src/memory-analyzer/CMakeLists.txt create mode 100644 src/memory-analyzer/Makefile diff --git a/CMakeLists.txt b/CMakeLists.txt index e043a28bbe..edcd555d84 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -139,6 +139,8 @@ set_target_properties( json-symtab-language langapi linking + memory-analyzer + memory-analyzer-lib pointer-analysis solvers symtab2gb diff --git a/regression/memory-analyzer/Makefile b/regression/memory-analyzer/Makefile new file mode 100644 index 0000000000..e6ccfe714c --- /dev/null +++ b/regression/memory-analyzer/Makefile @@ -0,0 +1,21 @@ +default: clean tests.log + +clean: + find -name '*.exe' -execdir $(RM) '{}' \; + find -name '*.out' -execdir $(RM) '{}' \; + $(RM) tests.log + +test: + -@ln -s goto-cc ../../src/goto-cc/goto-gcc + @../test.pl -p -c ../compile_example.sh + +tests.log: ../test.pl + -@ln -s goto-cc ../../src/goto-cc/goto-gcc + @../test.pl -p -c ../compile_example.sh + +show: + @for dir in *; do \ + if [ -d "$$dir" ]; then \ + vim -o "$$dir/*.c" "$$dir/*.out"; \ + fi; \ + done; diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d2c3dc2fdd..f240dbde4e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -104,4 +104,5 @@ add_subdirectory(goto-instrument) add_subdirectory(goto-analyzer) add_subdirectory(goto-diff) add_subdirectory(goto-harness) +add_subdirectory(memory-analyzer) add_subdirectory(symtab2gb) diff --git a/src/Makefile b/src/Makefile index b2f49d510f..433ea125b9 100644 --- a/src/Makefile +++ b/src/Makefile @@ -17,6 +17,7 @@ DIRS = analyses \ json-symtab-language \ langapi \ linking \ + memory-analyzer \ pointer-analysis \ solvers \ symtab2gb \ @@ -30,6 +31,7 @@ all: cbmc.dir \ goto-diff.dir \ goto-instrument.dir \ goto-harness.dir \ + memory-analyzer.dir \ symtab2gb.dir \ # Empty last line @@ -72,6 +74,8 @@ goto-diff.dir: languages goto-programs.dir pointer-analysis.dir \ goto-cc.dir: languages goto-programs.dir linking.dir +memory-analyzer.dir: util.dir goto-programs.dir ansi-c.dir + symtab2gb.dir: util.dir goto-programs.dir json-symtab-language.dir # building for a particular directory diff --git a/src/memory-analyzer/CMakeLists.txt b/src/memory-analyzer/CMakeLists.txt new file mode 100644 index 0000000000..7ab5015d76 --- /dev/null +++ b/src/memory-analyzer/CMakeLists.txt @@ -0,0 +1,19 @@ +# Library +file(GLOB_RECURSE sources "*.cpp" "*.h") +list(REMOVE_ITEM sources + ${CMAKE_CURRENT_SOURCE_DIR}/memory-analyzer_main.cpp +) +add_library(memory-analyzer-lib ${sources}) + +generic_includes(memory-analyzer-lib) + +target_link_libraries(memory-analyzer-lib + ansi-c + goto-programs + util +) + + +# Executable +add_executable(memory-analyzer memory_analyzer_main.cpp) +target_link_libraries(memory-analyzer memory-analyzer-lib) diff --git a/src/memory-analyzer/Makefile b/src/memory-analyzer/Makefile new file mode 100644 index 0000000000..a5f514d63c --- /dev/null +++ b/src/memory-analyzer/Makefile @@ -0,0 +1,37 @@ +SRC = analyze_symbol.cpp\ + gdb_api.cpp \ + memory_analyzer_main.cpp \ + memory_analyzer_parse_options.cpp + # Empty last line + +INCLUDES= -I .. + +LIBS = \ + ../ansi-c/ansi-c$(LIBEXT) \ + ../goto-programs/goto-programs$(LIBEXT) \ + ../linking/linking$(LIBEXT) \ + ../util/util$(LIBEXT) \ + ../big-int/big-int$(LIBEXT) \ + ../langapi/langapi$(LIBEXT) + + + +CLEANFILES = memory-analyzer$(EXEEXT) + +include ../config.inc +include ../common + +all: memory-analyzer$(EXEEXT) + + + +############################################################################### + +memory-analyzer$(EXEEXT): $(OBJ) + $(LINKBIN) + + +.PHONY: memory-analyser-mac-signed + +memory-analyser-mac-signed: memory-analyzer$(EXEEXT) + codesign -v -s $(OSX_IDENTITY) memory-analyzer$(EXEEXT) diff --git a/src/memory-analyzer/module_dependencies.txt b/src/memory-analyzer/module_dependencies.txt index 5e3f81fdcc..2ab9225dad 100644 --- a/src/memory-analyzer/module_dependencies.txt +++ b/src/memory-analyzer/module_dependencies.txt @@ -1,3 +1,4 @@ +ansi-c goto-programs util sys diff --git a/unit/CMakeLists.txt b/unit/CMakeLists.txt index d4e91415bf..30c035e9b5 100644 --- a/unit/CMakeLists.txt +++ b/unit/CMakeLists.txt @@ -1,3 +1,14 @@ +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR + "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang" OR + "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" +) + # private is overwritten in the gdb_api test cases + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-keyword-macro") +elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + # This would be the place to enable warnings for Windows builds, although + # config.inc doesn't seem to do that currently +endif() + file(GLOB_RECURSE sources "*.cpp" "*.h") file(GLOB_RECURSE testing_utils "testing-utils/*.cpp" "testing-utils/*.h")