forked from OpenVVC/OpenVVC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.in
143 lines (104 loc) · 4.33 KB
/
Makefile.in
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
include config.mak
VPATH=$(SRC_PATH)
# Set defaults
VERBOSITY?=0
SRC_FOLDER:=libovvc/
# Compiler Verbosity Control
USER_CC := $(CC)
CC_0 = @echo "$(USER_CC) $@"; $(USER_CC)
CC_1 = $(USER_CC)
CC = $(CC_$(VERBOSITY))
USER_AR := $(AR)
AR_0 = @echo "$(USER_AR) $@"; $(USER_AR)
AR_1 = $(USER_AR)
AR = $(AR_$(VERBOSITY))
AT_0 = @
AT_1 =
AT = $(AT_$(VERBOSITY))
# Quick hack to avoid missing / in builddir
BUILDDIR:=$(BUILDDIR)/
# Find Sources
include $(VPATH)$(SRC_FOLDER)/libobj.mak
LIB_SRC:=$(addprefix $(SRC_FOLDER),$(LIB_SRC))
LIB_HEADER:=$(addprefix $(SRC_FOLDER),$(LIB_HEADER))
LIB_OBJ:=$(addprefix $(BUILDDIR),$(LIB_SRC:%.c=%.o))
LIB_FILE:=$(LIB_HEADER) $(LIB_SRC)
include $(VPATH)$(SRC_FOLDER)/$(ARCH)/$(ARCH)obj.mak
$(ARCH)_LIB_SRC:=$(addprefix $($(ARCH)_SRC_FOLDER),$($(ARCH)_LIB_SRC))
$(ARCH)_LIB_OBJ:=$(addprefix $(BUILDDIR),$($(ARCH)_LIB_SRC:%.c=%.o))
BUILDDIR_TYPE_ARCH:=$(addprefix $(BUILDDIR), $($(ARCH)_SRC_FOLDER))
LIB_NAME:= libovvc
PROG=examples/dectest
ALL_OBJS=$(LIB_OBJ) $(addprefix $(BUILDDIR),$(addsuffix .o, $(PROG))) $($(ARCH)_LIB_OBJ)
.PHONY: all test version libs examples profiling
all: libs examples
test:
$(AT)$(VPATH)/CI/checkMD5.sh $(TESTSTREAMSDIR) $(BUILDDIR)$(PROG) $(STREAMURL)
profiling:
$(AT)$(VPATH)/CI/profiling.sh $(TESTSTREAMSDIR) $(BUILDDIR)$(PROG)
version:
$(AT)$(VPATH)/version.sh $(VPATH)VERSION $(LIB_VERSION_HEADER) $(BUILDDIR)
libs: version $(BUILDDIR)$(LIB_NAME)$(STATIC_LIBSUFF) $(BUILDDIR)$(LIB_NAME)$(SHARED_LIBSUFF)
examples: $(BUILDDIR)$(PROG) $(BUILDDIR)$(PROG)_stat
$(LIB_VERSION_HEADER): $(VPATH)VERSION
$(AT)$(VPATH)/version.sh $< $@ $(BUILDDIR)
$(BUILDDIR)$(PROG): $(BUILDDIR)$(PROG).o $(BUILDDIR)$(LIB_NAME)$(SHARED_LIBSUFF)
$(CC) $^ -o $@ $(LD_FLAGS) $(EXTRA_LD_FLAGS)
$(BUILDDIR)$(PROG)_stat: $(BUILDDIR)$(PROG).o $(BUILDDIR)$(LIB_NAME)$(STATIC_LIBSUFF)
$(CC) $^ -o $@ $(LD_FLAGS) $(EXTRA_LD_FLAGS)
$(BUILDDIR)$(LIB_NAME)$(STATIC_LIBSUFF): $(LIB_OBJ) $($(ARCH)_LIB_OBJ)
$(AT)$(VPATH)/version.sh $(VPATH)VERSION $(LIB_VERSION_HEADER) $(BUILDDIR)
$(AR) rc $@ $^
$(RANLIB) $@
$(BUILDDIR)$(LIB_NAME)$(SHARED_LIBSUFF): $(LIB_OBJ) $($(ARCH)_LIB_OBJ)
$(AT)$(VPATH)/version.sh $(VPATH)VERSION $(LIB_VERSION_HEADER) $(BUILDDIR)
$(CC) -shared $^ -o $@ $(LD_FLAGS) $(EXTRA_LD_FLAGS)
$(BUILDDIR_TYPE_ARCH)%_sse.o: $($(ARCH)_SRC_FOLDER)%_sse.c
$(AT)[ -d $(@D) ] || mkdir -p $(@D)
$(CC) -c $< -o $@ -MMD -MF $(@:.o=.d) -MT $@ $(CFLAGS) $(SSE_CFLAGS) -I$(VPATH)$(SRC_FOLDER) -I$(BUILDDIR)
$(BUILDDIR_TYPE_ARCH)%_neon.o: $($(ARCH)_SRC_FOLDER)%_neon.c
$(AT)[ -d $(@D) ] || mkdir -p $(@D)
$(CC) -c $< -o $@ -MMD -MF $(@:.o=.d) -MT $@ $(CFLAGS) $(NEON_CFLAGS) -I$(VPATH)$(SRC_FOLDER) -I$(BUILDDIR)
$(BUILDDIR)%.o: %.c
$(AT)[ -d $(@D) ] || mkdir -p $(@D)
$(CC) -c $< -o $@ -MMD -MF $(@:.o=.d) -MT $@ $(CFLAGS) -I$(VPATH)$(SRC_FOLDER) -I$(BUILDDIR) $(EXTRA_CFLAGS)
$(BUILDDIR)%.o: %.S
$(AT)[ -d $(@D) ] || mkdir -p $(@D)
$(CC) -c $< -o $@ -MMD -MF $(@:.o=.d) -MT $@ $(CFLAGS) -I$(VPATH)$(SRC_FOLDER) -I$(BUILDDIR)
.PHONY: install install-shared install-headers install-pkgconfig
install-shared: $(BUILDDIR)$(LIB_NAME)$(SHARED_LIBSUFF)
$(AT)mkdir -p $(INSTALL_LIB)
cp $< $(INSTALL_LIB)/$(<F)
install-headers: $(LIB_HEADER) $(BUILDDIR)ovversion.h
$(AT)mkdir -p $(INSTALL_INCLUDE)
cp $^ $(INSTALL_INCLUDE)/
install: install-shared install-headers install-pkgconfig
install-pkgconfig: version
$(AT)mkdir -p $(INSTALL_PKGCONFIG)
cp libopenvvc.pc $(INSTALL_PKGCONFIG)/libopenvvc.pc
.PHONY: style check-style tidy version
FILE_TO_STYLE:=$(shell find . -type f -name "*.[ch]")
style:
$(AT)for src in $(FILE_TO_STYLE) ; do \
echo "Formatting $$src..." ; \
clang-format -i "$$src" ; \
done
$(AT)echo "Done"
check-style:
$(AT)for src in $(FILE_TO_STYLE) ; do \
var=`clang-format "$$src" | diff "$$src" - | wc -l` ; \
if [ $$var -ne 0 ] ; then \
echo "$$src does not respect the coding style (diff: $$var lines)" ; \
exit 1 ; \
fi ; \
done
$(AT)echo "Style check passed"
.PHONY: clean mrproper
# Force .o files to depend on the content of their associated .d file
# if it already exists which will ensure the .o is rebuild when one of
# its previous dependencies are modified
$(ALL_OBJS):
include $(wildcard $(ALL_OBJS:.o=.d))
clean:
$(AT)rm -f $(LIB_VERSION_HEADER)
$(AT)rm -f $(ALL_OBJS) $(ALL_OBJS:.o=.d) $(addprefix $(BUILDDIR),$(PROG)*) $(BUILDDIR)$(LIB_NAME)$(STATIC_LIBSUFF) $(BUILDDIR)$(LIB_NAME)$(SHARED_LIBSUFF)