Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
92 lines (76 loc) · 1.86 KB
/
Copy pathMakefile
File metadata and controls
92 lines (76 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
PREFIX?=$(CURDIR)/local
BUILD_MODE?=dev
PROCESSORS=0
HOST_UNAME=$(shell uname -s)
ifneq (,$(filter MINGW% CYGW%, $(HOST_UNAME)))
HOST_OS=windows
exeext=.exe
PATH_SEP=;
endif
ifneq (,$(filter Linux, $(HOST_UNAME)))
HOST_OS=linux
exeext=
PATH_SEP=:
endif
RM=rm -f
CP=cp -pf
MKDIR=mkdir -p
GPRBUILD=gprbuild
GPRINSTALL=gprinstall
ifdef INSTR
INSTR_GPR_FLAGS=--src-subdirs=gnatcov-instr --implicit-with=gnatcov_rts.gpr
endif
C_SUPPORT?=True
ifeq ($(C_SUPPORT), True)
include libclang_common.mk
LLVM_LINK_FLAGS = -largs $(LD_FLAGS)
else
CURRENT_DIR := $(dir $(abspath $(firstword $(MAKEFILE_LIST))))
GPR_PROJECT_PATH := $(CURRENT_DIR)/gpr_stubs$(PATH_SEP)$(GPR_PROJECT_PATH)
LLVM_LINK_FLAGS=
endif
all: build
build: instr build-static cli_build
instr:
ifdef INSTR
gnatcov instrument -Pstable_sloc_cli.gpr -cstmt $(GPRFLAGS)
endif
build-%:
$(GPRBUILD) -Pstable_sloc.gpr \
-XSTABLE_SLOC_BUILD_MODE=$(BUILD_MODE) \
-XLIBRARY_TYPE=$* \
-XC_SUPPORT=$(C_SUPPORT) \
-p -j$(PROCESSORS) \
$(INSTR_GPR_FLAGS) \
$(LLVM_LINK_FLAGS) \
$(GPRFLAGS)
cli_build:
$(GPRBUILD) -p -Pstable_sloc_cli.gpr \
-XSTABLE_SLOC_BUILD_MODE=$(BUILD_MODE) \
-XLIBRARY_TYPE=static -p -j$(PROCESSORS) \
-XC_SUPPORT=$(C_SUPPORT) \
$(INSTR_GPR_FLAGS) \
$(LLVM_LINK_FLAGS) \
$(GPRFLAGS)
install: install-static
$(MKDIR) $(PREFIX)/bin
$(CP) bin/stable_sloc_cli$(exeext) $(PREFIX)/bin
install-%:
$(GPRINSTALL) -f -p -Pstable_sloc.gpr \
-XSTABLE_SLOC_BUILD_MODE=$(BUILD_MODE) \
-XLIBRARY_TYPE=$* \
-XC_SUPPORT=$(C_SUPPORT) \
--prefix=$(PREFIX) \
--build-name=$* \
--build-var=LIBRARY_TYPE \
--build-var=STABLE_SLOC_LIBRARY_TYPE \
$(INSTR_GPR_FLAGS) \
$(GPRFLAGS)
clean: clean-static
clean-%:
gprclean -Pstable_sloc.gpr \
-XSTABLE_SLOC_BUILD_MODE=$(BUILD_MODE) \
-XLIBRARY_TYPE=$* \
-XC_SUPPORT=$(C_SUPPORT) \
$(INSTR_GPR_FLAGS) \
$(GPRFLAGS)