Skip to content

Commit ac37865

Browse files
Jugst3rRenjiSann
authored andcommitted
Adapt llvm_json trace_adapter Makefile
Make it similar to the trace32 trace_adapter.
1 parent a726da4 commit ac37865

File tree

3 files changed

+36
-17
lines changed

3 files changed

+36
-17
lines changed

tools/gnatcov/Makefile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ include architecture.mk
105105

106106
ifeq ($(HOST_OS), windows)
107107
ifeq ($(BITS_ARCH), 32)
108-
DEFAULT_ADAPTERS = trace32
108+
DEFAULT_ADAPTERS = trace32 llvm_json
109109
else
110110
DEFAULT_ADAPTERS =
111111
endif
@@ -115,11 +115,11 @@ ifeq ($(HOST_OS), linux)
115115
ifeq ($(BITS_ARCH), 32)
116116
DEFAULT_ADAPTERS =
117117
else
118-
DEFAULT_ADAPTERS = trace32
118+
DEFAULT_ADAPTERS = trace32 llvm_json
119119
endif
120120
endif
121121

122-
ADAPTERS_LIST=$(DEFAULT_ADAPTERS)
122+
ADAPTERS_LIST ?= $(DEFAULT_ADAPTERS)
123123

124124
PROCESSORS=0
125125
BUILD_MODE=dev
@@ -128,8 +128,9 @@ BUILD_MODE=dev
128128
# == Variables to pass down to sub-makefiles for trace adapters ==
129129
# ================================================================
130130

131-
# The Trace32 adapter use the same prefix as GNATcov
131+
# The trace adapters use the same prefix as GNATcov
132132
trace32_ADAPTER_INSTALL_VARS=PREFIX=$(PREFIX)
133+
llvm_json_ADAPTER_INSTALL_VARS=PREFIX=$(PREFIX)
133134

134135
.PHONY: default all adapters bin $(PGMPATH)
135136

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,50 @@
1+
PREFIX=install
2+
PARALLEL_BUILD=0
3+
include ../../host.mk
4+
15
LLVM_CXXFLAGS := $(shell llvm-config --cxxflags)
26
LLVM_LDFLAGS := $(shell llvm-config --ldflags)
37
LLVM_LIBS := $(shell llvm-config --libs --system-libs)
48

5-
# Set this to the right path for you.
9+
# Set this to the right path for you
610
LIBSTD_PATH := "$(dir $(shell which gnat))../lib64/"
711

12+
EXENAME=gnatcov_llvm_exporter
13+
DIRNAME=gnatcoverage
14+
815
GPRBUILD_FLAGS := \
9-
-cargs:c++ ${LLVM_CXXFLAGS} -g \
16+
-cargs:c++ $(LLVM_CXXFLAGS) -g \
1017
-largs \
1118
--verbose \
1219
-fuse-ld=lld \
13-
-L ${LIBSTD_PATH} \
14-
${LLVM_LDFLAGS} \
15-
${LLVM_LIBS}
20+
-L $(LIBSTD_PATH) \
21+
$(LLVM_LDFLAGS) \
22+
$(LLVM_LIBS)
23+
24+
.PHONY: force
1625

17-
gprbuild:
18-
@gprbuild -v ${GPRBUILD_FLAGS}
26+
bin: force
27+
gprbuild -j$(PARALLEL_BUILD) $(GPRBUILD_FLAGS)
1928

2029
cmake:
2130
mkdir -p build
2231
cmake \
2332
-B build \
2433
-DCMAKE_C_COMPILER=clang \
2534
-DCMAKE_CXX_COMPILER=clang++ \
26-
-DCMAKE_CXX_FLAGS="${LLVM_CXXFLAGS}" \
27-
-DCMAKE_EXE_LINKER_FLAGS="-L ${LIBSTD_PATH}"
35+
-DCMAKE_CXX_FLAGS="$(LLVM_CXXFLAGS)" \
36+
-DCMAKE_EXE_LINKER_FLAGS="-L $(LIBSTD_PATH)"
2837
cd build && make
2938

3039
.PHONY: clean
3140

3241
clean:
3342
gprclean
34-
${RM} -rf obj
35-
${RM} -rf build
43+
$(RM) -rf obj
44+
$(RM) -rf build
45+
46+
.PHONY: install
47+
48+
install:
49+
$(MKDIR) $(PREFIX)/libexec/$(DIRNAME)
50+
$(CP) $(EXENAME) $(PREFIX)/libexec/$(DIRNAME)
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
project GNATcov_LLVM_exporter is
22

33
for Languages use ("C++");
4-
54
for Source_Dirs use ("src");
65
for Main use ("main.cpp");
7-
86
for Object_Dir use "obj";
7+
for Exec_Dir use ".";
8+
9+
package Builder is
10+
for Executable ("main.cpp") use "gnatcov_llvm_exporter";
11+
end Builder;
912

1013
end GNATcov_LLVM_exporter;

0 commit comments

Comments
 (0)