-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmake.modsw
150 lines (113 loc) · 5.18 KB
/
make.modsw
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
144
145
146
147
148
149
#***********************************************************************
#
# Copyright (c) 2010 Broadcom Corporation
# All Rights Reserved
#
#***********************************************************************/
#
# The modsw directories install a SUBDIR_HINT_FILE in the
# base build tree to tell the base build tree where the modsw dir is.
# Basically, the hint file is the modsw's location with all directory
# separators '/' replaced with '=' and prefixed with "hintfile"
#
modsw_location := $(patsubst /%,hintfile=%,$(shell pwd))
MODSW_SUBDIR_HINT_FILE := $(subst /,=,$(modsw_location))
#
# these are just a bunch of rules used by various modsw subdirs
# to install and clean hint files in the base build tree
#
generic_private_app_modsw_install:
mkdir -p $(BUILD_DIR)/userspace/private/apps/.modswdirs
touch $(BUILD_DIR)/userspace/private/apps/.modswdirs/$(MODSW_SUBDIR_HINT_FILE)
generic_private_app_modsw_clean:
rm -f $(BUILD_DIR)/userspace/private/apps/.modswdirs/$(MODSW_SUBDIR_HINT_FILE)
generic_hostTools_modsw_install:
mkdir -p $(BUILD_DIR)/hostTools/.modswdirs
touch $(BUILD_DIR)/hostTools/.modswdirs/$(MODSW_SUBDIR_HINT_FILE)
generic_hostTools_modsw_clean:
rm -f $(BUILD_DIR)/hostTools/.modswdirs/$(MODSW_SUBDIR_HINT_FILE)
generic_cmsutil_contrib_lib_modsw_install:
mkdir -p $(BUILD_DIR)/userspace/public/libs/cms_util/.modswdirs
touch $(BUILD_DIR)/userspace/public/libs/cms_util/.modswdirs/$(MODSW_SUBDIR_HINT_FILE)
generic_cmsutil_contrib_lib_modsw_clean:
rm -f $(BUILD_DIR)/userspace/public/libs/cms_util/.modswdirs/$(MODSW_SUBDIR_HINT_FILE)
generic_public_include_modsw_install:
mkdir -p $(BUILD_DIR)/userspace/public/include/.modswdirs
touch $(BUILD_DIR)/userspace/public/include/.modswdirs/$(MODSW_SUBDIR_HINT_FILE)
generic_public_include_modsw_clean:
rm -f $(BUILD_DIR)/userspace/public/include/.modswdirs/$(MODSW_SUBDIR_HINT_FILE)
generic_subdir_modsw_install:
for dir in $(SUBDIRS); do \
$(MAKE) -C $$dir modsw_install; \
done
generic_subdir_modsw_clean:
for dir in $(SUBDIRS); do \
$(MAKE) -C $$dir modsw_clean; \
done
# All this base and layer stuff is obsolete. Should delete.
# All userspace dirs are now listed in AUTODIRS.
#
# find auto-detect subdirs in the directory.
# Auto-detect subdirs are subdirs which are still in the build tree,
# but not listed in the upper level makefile. They are detected by the
# presence of a .autodetect or autodetect file in the sub-directory.
# Auto-detect subdirs are further divided into "base" and "layer1".
# All base subdirs are built before the layer1 subdirs.
# Layer1 subdirs are indicated by beginning a line with "Layer1".
# All other subdirs will be classified as a base subdir.
tmp_subdir_list := $(shell egrep -L ^Layer */.autodetect */autodetect 2> /dev/null)
AUTODETECT_SUBDIRS_BASE := $(subst /autodetect,,$(subst /.autodetect,,$(tmp_subdir_list)))
tmp_subdir_list := $(shell egrep -l ^Layer1 */.autodetect */autodetect 2> /dev/null)
AUTODETECT_SUBDIRS_LAYER1 := $(subst /autodetect,,$(subst /.autodetect,,$(tmp_subdir_list)))
# find modular sw directories.
# These are directories which live outside the base build tree but a hint
# file has been installed in the base build tree to let it know where to
# to to build the modsw dir
tmp_subdir_list := $(shell ls .modswdirs 2> /dev/null)
modsw_subdir_list := $(subst =,/,$(subst hintfile=,/,$(tmp_subdir_list)))
MODSW_SUBDIRS := $(modsw_subdir_list)
# find any libraries contributed by modsw to this library
MODSW_CONTRIB_LIBS_DIRS := $(modsw_subdir_list)
generic_modsw_contrib_libs_make:
for dir in $(MODSW_CONTRIB_LIBS_DIRS); do \
$(MAKE) -C $$dir; \
done
# must use delayed evaluation here so that the .a is made before
# we try to find it.
ifneq ($(strip $(MODSW_CONTRIB_LIBS_DIRS)),)
MODSW_CONTRIB_LIBS = $(shell find $(MODSW_CONTRIB_LIBS_DIRS) -name '*.a')
endif
# This rule is used by libraries to do a clean of any sub-libraries
# contributed by modsw
#
generic_modsw_contrib_libs_clean:
for dir in $(MODSW_CONTRIB_LIBS_DIRS); do \
$(MAKE) -C $$dir clean; \
done
# Remove any installation effects of modsw in the base dir
generic_modsw_base_clean:
rm -rf .modswdirs
# create a list of include paths to modular sw include dirs
incdir_list := $(shell ls $(BUILD_DIR)/userspace/public/include/.modswdirs 2> /dev/null)
ifneq ($(strip $(incdir_list)),)
MODSW_PUBLIC_INCLUDE := $(subst =,/,$(subst hintfile=,-I/,$(incdir_list)))
endif
# MULTIARCH_AUTODIRS is generated by create_autogen
AUTODIRS := $(patsubst %/,%,$(dir $(wildcard */*/*/autodetect) $(wildcard */*/*/.autodetect)))
makefile.modsw.autogen : $(BUILD_DIR)/.last_profile
@echo "AUTODIRS := $(AUTODIRS)" > m1 ;
$(BUILD_DIR)/hostTools/create_autogen.pl --ke $(KERNEL_ARCH) m1 makefile.modsw.autogen
$(BUILD_DIR)/hostTools/create_autogen.pl --ke $(KERNEL_ARCH) --mini m1 makefile.modsw.autogen.mini
rm m1
ifneq ($(MAKECMDGOALS),clean)
include makefile.modsw.autogen
endif
show_subdirs:
@echo HARDCODED_SUBDIRS=$(HARDCODED_SUBDIRS)
@echo AUTODETECT_SUBDIRS_BASE=$(AUTODETECT_SUBDIRS_BASE)
@echo AUTODETECT_SUBDIRS_LAYER1=$(AUTODETECT_SUBDIRS_LAYER1)
@echo SUBDIRS=$(SUBDIRS)
@echo AUTODIRS=$(AUTODIRS)
@echo MULTIARCH_AUTODIRS=$(MULTIARCH_AUTODIRS)
@echo PROFILE_ARCH=$(PROFILE_ARCH)
@echo KERNEL_ARCH=$(KERNEL_ARCH)