-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathdefinitions.mak
59 lines (52 loc) · 2.57 KB
/
definitions.mak
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
# Copyright (C) 2010 Erik Rainey
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# List all files of type $(1) in a module subdirectory $(2) and its subdirectories
# The list returned is relative to the module source directory
ifeq ($(HOST_OS),Windows_NT)
# Always produce list using foward slashes
all-type-files-in-this-a = $(subst \,/,$(subst $(_SDIR),,$(shell cmd.exe /C dir /b $(_SDIR)$(2)$(PATH_SEP)$(1))))
all-type-files-in-this = $(foreach kern,$(call all-type-files-in-this-a,$(1),$(2)),$(2)/$(kern))
else
all-type-files-in-this = $(subst $(SDIR)/,,$(shell find $(SDIR)/$(2) -maxdepth 1 -name '$(1)'))
endif
# This finds files in a specific folder
all-type-files-in = $(notdir $(wildcard $(2)/$(1)))
# This finds all the files within and under a specific folder, producing relative paths to
# the $(SUBMAKEFILE)
all-type-files-under = $(subst $(RDIR)/,,$(call rwildcard,$(RDIR)/$(1),$(2)))
all-java-files-under = $(subst $(RDIR)/,,$(call rwildcard,$(RDIR)/$(1),*.java))
all-c-files-under = $(subst $(RDIR)/,,$(call rwildcard,$(RDIR)/$(1),*.c))
all-cpp-files-under = $(subst $(RDIR)/,,$(call rwildcard,$(RDIR)/$(1),*.cpp))
all-S-files-under = $(subst $(RDIR)/,,$(call rwildcard,$(RDIR)/$(1),*.S))
# This finds all the files within and under a folder of a specific type
all-type-files = $(subst $(RDIR)/,,$(call rwildcard,$(RDIR),$(1)))
all-java-files = $(call all-type-files,*.java)
all-c-files = $(call all-type-files,*.c)
all-cpp-files = $(call all-type-files,*.cpp)
all-h-files = $(call all-type-files,*.h)
all-S-files = $(call all-type-files,*.S)
all-java-files-in = $(call all-type-files-in,*.java,$(1))
all-c-files-in = $(call all-type-files-in,*.c,$(1))
all-cpp-files-in = $(call all-type-files-in,*.cpp,$(1))
all-h-files-in = $(call all-type-files-in,*.h,$(1))
all-S-files-in = $(call all-type-files-in,*.S,$(1))
ifeq ($(HOST_OS),Windows_NT)
strip-name-lib = $(basename $(notdir $1))
else
strip-name-lib = $(patsubst $(LIB_PRE)%,%,$(basename $(notdir $1)))
endif
dependent-static-libs = \
$(foreach lib,$($1_STATIC_LIBS),\
$($(call strip-name-lib,$(lib))_DEPENDENT_LIBS) \
)