-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.common
85 lines (66 loc) · 2.39 KB
/
Makefile.common
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
#
# Copyright 2024 (C) Alexey Dynda
# This file is part of uProfiler.
#
# GNU General Public License Usage
# Protocol Library is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# Protocol Library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with Protocol Library. If not, see <http://www.gnu.org/licenses/>.
# Commercial License Usage
# Licensees holding valid commercial uProfiler licenses may use this file in
# accordance with the commercial license agreement provided in accordance with
# the terms contained in a written agreement between you and Alexey Dynda.
# For further information contact via email on github account.
#
default: all
DESTDIR ?= .
BLD ?= build
VERSION=0.1.0
CPPFLAGS += -I./src
CFLAGS += -std=gnu99
CPPFLAGS += -Os -Wall -Werror -ffunction-sections -fdata-sections $(EXTRA_CPPFLAGS)
# Uncomment for performance profiling
# CPPFLAGS += -pg
CXXFLAGS += -std=c++11
.PHONY: prep clean library all install docs release
####################### Compiling library #########################
TARGET_LIB ?= libuprofiler.a
OBJ_LIB += \
src/uprofiler.o \
prep:
ifdef CONFIG_FOR_WINDOWS_BUILD
if not exist $(BLD) mkdir $(BLD)
else
mkdir -p $(BLD)
endif
library: prep $(OBJ_LIB)
$(AR) rcs $(BLD)/$(TARGET_LIB) $(OBJ_LIB)
install:
ifdef CONFIG_FOR_WINDOWS_BUILD
if not exist $(DESTDIR)\include mkdir $(DESTDIR)\include &\
xcopy src $(DESTDIR)\include /y /s &\
for /R $(DESTDIR)\include %%G in (*) do ( if not %%~xG==.h del /F/Q/S %%G )
else
mkdir -p $(DESTDIR)/include $(DESTDIR)/lib
cp -r $(BLD)/$(TARGET_LIB) $(DESTDIR)/lib/
DST=`realpath $(DESTDIR)` && cd src && find ./ -name \*.h -exec cp --parents {} $${DST}/include/ \; && cd ..
endif
docs:
doxygen doxygen.cfg
all: library
clean:
ifdef CONFIG_FOR_WINDOWS_BUILD
if exist $(BLD) rd $(BLD) /q /s &\
for /R .\src\ %%G in (*.o) do ( del /F/Q/S %%G )
else
rm -rf $(BLD)
rm -rf $(OBJ_LIB) $(OBJ_LIB:.o=.gcno) $(OBJ_LIB:.o=.gcda) $(OBJ_LIB:.o=.gcov)
rm -rf gmon.out
endif