| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
default: all |
| 10 |
|
| 11 |
MAKEFILE/ :=$(dir $(firstword $(MAKEFILE_LIST))) |
| 12 |
|
| 13 |
ifneq ($(shell ls -d ${MAKEFILE/}/Make.compilers 2> /dev/null), ${MAKEFILE/}/Make.compilers) |
| 14 |
MAKECOMPILERSNOTHING := $(shell ${MAKEFILE/}configure.sh) |
| 15 |
endif |
| 16 |
|
| 17 |
include ${MAKEFILE/}Make.compilers |
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
// := |
| 23 |
|
| 24 |
/ := |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
//-RECURSIVE := |
| 29 |
define MakeRecursive |
| 30 |
//-RECURSIVE :=$$/. |
| 31 |
endef |
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
define Include |
| 43 |
$(foreach x,$(strip ${1}),$(call Include_File,$x)) |
| 44 |
endef |
| 45 |
|
| 46 |
define Include_File |
| 47 |
ifeq ($(filter ${1}.,${WITHOUT_}),) |
| 48 |
ifeq ($(wildcard ${1}Make.include),${1}Make.include) |
| 49 |
$/.SUBS +=${1}. |
| 50 |
// +=${1}. |
| 51 |
${1}.SUBS := |
| 52 |
/ :=${1} |
| 53 |
include ${1}Make.include |
| 54 |
/ :=$/ |
| 55 |
endif |
| 56 |
endif |
| 57 |
|
| 58 |
endef |
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
ifndef WITHOUT |
| 66 |
WITHOUT:= |
| 67 |
endif |
| 68 |
WITHOUT_:=$(patsubst %,%.,$(strip ${WITHOUT})) |
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
$(eval $(call Include_File,$/)) |
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
// :=$(filter-out ${//-RECURSIVE},${//}) |
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
__SUBGOALS__= |
| 86 |
__DEPGOALS__= |
| 87 |
|
| 88 |
-include ${MAKEFILE/}Make.rules |
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
$(eval DEPENDS:=$(foreach x,${//},$(call __DEPGOALS__,$x))) |
| 93 |
ifneq ($(strip ${DEPENDS}),) |
| 94 |
|
| 95 |
ifeq ($(filter %-clean,${MAKECMDGOALS}),) |
| 96 |
-include ${DEPENDS} |
| 97 |
endif |
| 98 |
endif |
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
clean: ${//-RECURSIVE:.=.clean} $/.clean |
| 111 |
define .RULE-clean |
| 112 |
${1:.=.clean}: $${${1:.=.SUBS}:.=.clean} |
| 113 |
${RM} $${${1:.=.CLEAN}} ${__SUBGOALS__} |
| 114 |
ifneq ($(strip ${C_TMP_COMPILE} ${CXX_TMP_COMPILE}),) |
| 115 |
(cd $1 && ${RM} -r ${C_TMP_COMPILE} ${CXX_TMP_COMPILE}) |
| 116 |
endif |
| 117 |
|
| 118 |
endef |
| 119 |
$(eval $(foreach x,${//},$(call .RULE-clean,$x))) |
| 120 |
|
| 121 |
|
| 122 |
depends-clean: $/.depends-clean |
| 123 |
${//-RECURSIVE:.=.depends-clean}: |
| 124 |
define .RULE-depends-clean |
| 125 |
${1:.=.depends-clean}: $${${1:.=.SUBS}:.=.depends-clean} |
| 126 |
${RM} ${1:.=Make.depends} ${__DEPGOALS__} |
| 127 |
|
| 128 |
endef |
| 129 |
$(eval $(foreach x,${//},$(call .RULE-depends-clean,$x))) |
| 130 |
|
| 131 |
real-clean: ${//-RECURSIVE:.=.real-clean} $/.real-clean |
| 132 |
define .RULE-real-clean |
| 133 |
${1:.=.real-clean}: $${${1:.=.SUBS}:.=.real-clean} |
| 134 |
${RM} $${${1:.=.CLEAN}} ${__SUBGOALS__} ${1:.=Make.depends} ${__DEPGOALS__} $${${1:.=.REAL-CLEAN}} |
| 135 |
#ifneq ($(strip ${INSTALL/}),) |
| 136 |
# ${RM} -r ${INSTALL/} |
| 137 |
#endif |
| 138 |
ifneq ($(strip ${C_TMP_COMPILE} ${CXX_TMP_COMPILE}),) |
| 139 |
(cd $1 && ${RM} -r ${C_TMP_COMPILE} ${CXX_TMP_COMPILE}) |
| 140 |
endif |
| 141 |
|
| 142 |
endef |
| 143 |
$(eval $(foreach x,${//},$(call .RULE-real-clean,$x))) |
| 144 |
|
| 145 |
all: ${//-RECURSIVE:.=.all} $/.all |
| 146 |
define .RULE-all |
| 147 |
${1:.=.all}: $${${1:.=.SUBS}:.=.all} ${__SUBGOALS__} |
| 148 |
|
| 149 |
endef |
| 150 |
$(eval $(foreach x,${//},$(call .RULE-all,$x))) |
| 151 |
|
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
|
| 157 |
${//-RECURSIVE:.=.install-copy}: |
| 158 |
install-copy: ${//-RECURSIVE:.=.install-copy} $/.install-copy |
| 159 |
define .RULE-install-copy |
| 160 |
${1:.=.install-copy}: $${${1:.=.SUBS}:.=.install-copy} |
| 161 |
|
| 162 |
endef |
| 163 |
$(eval $(foreach x,${//},$(call .RULE-install-copy,$x))) |
| 164 |
|
| 165 |
|
| 166 |
|
| 167 |
|
| 168 |
install: ${//-RECURSIVE:.=.install} $/.install |
| 169 |
define .RULE-install |
| 170 |
${1:.=.install}: ${1:.=.all} ${1:.=.install-copy} |
| 171 |
|
| 172 |
endef |
| 173 |
$(eval $(foreach x,${//},$(call .RULE-install,$x))) |
| 174 |
|
| 175 |
|
| 176 |
|
| 177 |
|
| 178 |
|
| 179 |
LSOPTS:=-l |
| 180 |
ls: $/.ls |
| 181 |
${//-RECURSIVE:.=.ls}: |
| 182 |
define .RULE-ls |
| 183 |
${1:.=.ls}: $${${1:.=.SUBS}:.=.ls} |
| 184 |
@ files='$$(strip ${__SUBGOALS__})'; \ |
| 185 |
if [ -n "$$$${files}" ] ; then \ |
| 186 |
ls ${LSOPTS} $$$${files} ; \ |
| 187 |
fi ; exit 0; |
| 188 |
|
| 189 |
endef |
| 190 |
$(eval $(foreach x,${//},$(call .RULE-ls,$x))) |
| 191 |
|
| 192 |
|
| 193 |
|
| 194 |
|