Skip to content

Commit c19aa7b

Browse files
petr-bauchdanpoe
authored andcommitted
Address comments about makefiles and cmdl options
Cleans up the whitespaces and explicates the symbols option. Also force building memory-analyzer on Linux and test it there by default (unless explicitly unset). Behaviour on other platforms should be preserved.
1 parent 1235949 commit c19aa7b

File tree

6 files changed

+61
-15
lines changed

6 files changed

+61
-15
lines changed

CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,15 @@ endfunction()
121121
option(WITH_MEMORY_ANALYZER OFF
122122
"build the memory analyzer")
123123

124+
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
125+
set(WITH_MEMORY_ANALYZER_DEFAULT ON)
126+
else()
127+
set(WITH_MEMORY_ANALYZER_DEFAULT OFF)
128+
endif()
129+
130+
option(WITH_MEMORY_ANALYZER ${WITH_MEMORY_ANALYZER_DEFAULT}
131+
"build the memory analyzer")
132+
124133
add_subdirectory(src)
125134
add_subdirectory(regression)
126135
add_subdirectory(unit)

regression/Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,19 @@ DIRS = cbmc \
3030
symtab2gb \
3131
# Empty last line
3232

33+
ifeq ($(OS),Windows_NT)
34+
detected_OS := Windows
35+
else
36+
detected_OS := $(shell sh -c 'uname 2>/dev/null || echo Unknown')
37+
endif
38+
39+
ifeq ($(detected_OS),Linux)
40+
ifneq ($(WITH_MEMORY_ANALYZER),0)
41+
# only set if it wasn't explicitly unset
42+
WITH_MEMORY_ANALYZER=1
43+
endif
44+
endif
45+
3346
ifeq ($(WITH_MEMORY_ANALYZER),1)
3447
DIRS += memory-analyzer
3548
endif

src/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,6 @@ add_subdirectory(goto-diff)
106106
add_subdirectory(goto-harness)
107107
add_subdirectory(symtab2gb)
108108

109-
if(WITH_MEMORY_ANALYZER)
109+
if(UNIX OR WITH_MEMORY_ANALYZER)
110110
add_subdirectory(memory-analyzer)
111111
endif()

src/Makefile

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,21 @@ all: cbmc.dir \
3131
goto-diff.dir \
3232
goto-instrument.dir \
3333
goto-harness.dir \
34-
memory-analyzer.dir \
3534
symtab2gb.dir \
3635
# Empty last line
3736

37+
ifeq ($(OS),Windows_NT)
38+
detected_OS := Windows
39+
else
40+
detected_OS := $(shell sh -c 'uname 2>/dev/null || echo Unknown')
41+
endif
42+
43+
ifeq ($(detected_OS),Linux)
44+
all: memory-analyzer.dir
45+
else ifeq ($(WITH_MEMORY_ANALYZER),1)
46+
all: memory-analyzer.dir
47+
endif
48+
3849
###############################################################################
3950

4051
util.dir: big-int.dir

src/memory-analyzer/Makefile

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
SRC = analyze_symbol.cpp\
2-
gdb_api.cpp \
3-
memory_analyzer_main.cpp \
4-
memory_analyzer_parse_options.cpp
5-
# Empty last line
1+
SRC = \
2+
analyze_symbol.cpp \
3+
gdb_api.cpp \
4+
memory_analyzer_main.cpp \
5+
memory_analyzer_parse_options.cpp
6+
# Empty last line
67

78
INCLUDES= -I ..
89

910
LIBS = \
10-
../ansi-c/ansi-c$(LIBEXT) \
11-
../goto-programs/goto-programs$(LIBEXT) \
12-
../linking/linking$(LIBEXT) \
13-
../util/util$(LIBEXT) \
14-
../big-int/big-int$(LIBEXT) \
15-
../langapi/langapi$(LIBEXT)
11+
../ansi-c/ansi-c$(LIBEXT) \
12+
../goto-programs/goto-programs$(LIBEXT) \
13+
../linking/linking$(LIBEXT) \
14+
../util/util$(LIBEXT) \
15+
../big-int/big-int$(LIBEXT) \
16+
../langapi/langapi$(LIBEXT)
1617

17-
1818

19-
CLEANFILES = memory-analyzer$(EXEEXT)
19+
CLEANFILES = memory-analyzer$(EXEEXT)
2020

2121
include ../config.inc
2222
include ../common

unit/Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,19 @@ SRC += analyses/ai/ai.cpp \
8484
util/unicode.cpp \
8585
# Empty last line
8686

87+
ifeq ($(OS),Windows_NT)
88+
detected_OS := Windows
89+
else
90+
detected_OS := $(shell sh -c 'uname 2>/dev/null || echo Unknown')
91+
endif
92+
93+
ifeq ($(detected_OS),Linux)
94+
ifneq ($(WITH_MEMORY_ANALYZER),0)
95+
# only set if it wasn't explicitly unset
96+
WITH_MEMORY_ANALYZER=1
97+
endif
98+
endif
99+
87100
ifeq ($(WITH_MEMORY_ANALYZER),1)
88101
SRC += memory-analyzer/gdb_api.cpp
89102
endif

0 commit comments

Comments
 (0)