forked from xuejian1354/openwrt_cc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
170 lines (149 loc) · 7.17 KB
/
Makefile
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# Makefile for OpenWrt
#
# Copyright (C) 2007 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
TOPDIR:=${CURDIR}
LC_ALL:=C
LANG:=C
export TOPDIR LC_ALL LANG
empty:=
space:= $(empty) $(empty)
$(if $(findstring $(space),$(TOPDIR)),$(error ERROR: The path to the OpenWrt directory must not include any spaces))
rootfs:
include $(TOPDIR)/include/host.mk
ifneq ($(OPENWRT_BUILD),1)
_SINGLE=export MAKEFLAGS=$(space);
override OPENWRT_BUILD=1
export OPENWRT_BUILD
GREP_OPTIONS=
export GREP_OPTIONS
include $(TOPDIR)/include/debug.mk
include $(TOPDIR)/include/depends.mk
include $(TOPDIR)/include/toplevel.mk
else
include rules.mk
include $(INCLUDE_DIR)/depends.mk
include $(INCLUDE_DIR)/subdir.mk
# include target/Makefile
include package/Makefile
include tools/Makefile
include toolchain/Makefile
$(toolchain/stamp-install): $(tools/stamp-install)
$(target/stamp-compile): $(toolchain/stamp-install) $(tools/stamp-install) $(BUILD_DIR)/.prepared
$(package/stamp-compile): $(target/stamp-compile) $(package/stamp-cleanup)
$(package/stamp-install): $(package/stamp-compile)
$(target/stamp-install): $(package/stamp-compile) $(package/stamp-install)
printdb:
@true
prepare: $(target/stamp-compile)
clean: FORCE
rm -rf $(BUILD_DIR) $(STAGING_DIR) $(BIN_DIR) $(BUILD_LOG_DIR)
dirclean: clean
rm -rf $(STAGING_DIR_HOST) $(TOOLCHAIN_DIR) $(BUILD_DIR_HOST) $(BUILD_DIR_TOOLCHAIN)
rm -rf $(TMP_DIR)
ifndef DUMP_TARGET_DB
$(BUILD_DIR)/.prepared: Makefile
@mkdir -p $$(dirname $@)
@touch $@
tmp/.prereq_packages: .config
unset ERROR; \
for package in $(sort $(prereq-y) $(prereq-m)); do \
$(_SINGLE)$(NO_TRACE_MAKE) -s -r -C package/$$package prereq || ERROR=1; \
done; \
if [ -n "$$ERROR" ]; then \
echo "Package prerequisite check failed."; \
false; \
fi
touch $@
endif
# check prerequisites before starting to build
prereq: $(target/stamp-prereq) tmp/.prereq_packages
@if [ ! -f "$(INCLUDE_DIR)/site/$(ARCH)" ]; then \
echo 'ERROR: Missing site config for architecture "$(ARCH)" !'; \
echo ' The missing file will cause configure scripts to fail during compilation.'; \
echo ' Please provide a "$(INCLUDE_DIR)/site/$(ARCH)" file and restart the build.'; \
exit 1; \
fi
prepare: .config $(tools/stamp-install) $(toolchain/stamp-install)
world: prepare $(package/stamp-compile) $(package/stamp-install) FORCE
$(_SINGLE)$(SUBMAKE) -r package/index
CHIPTYPE:=$(shell echo $(BOARD) | tr a-z A-Z)
VENDORNAME:=$(shell echo $(CONFIG_VERSION_MANUFACTURER) | tr a-z A-Z)
IMG_PREFIX:=FRAMEWORK$(if $(VENDORNAME),_$(VENDORNAME))_$(CHIPTYPE)
rootfs: world
ifneq ($(or $(CONFIG_TARGET_REALTEK),$(CONFIG_TARGET_BRCM),$(CONFIG_TARGET_RTL960XC)),)
# ld-uClibc-0.9.33.so -> ld.so.1
# ld-uClibc-0.9.33.so -> ld-uClibc.so.0 -> ld-uClibc.so
cp $(CONFIG_TOOLCHAIN_ROOT)/lib/libuClibc-0.9.33.2.so $(TARGET_DIR)/lib
cd $(TARGET_DIR)/lib; ln -sf ld-uClibc-0.9.33.2.so ld.so.1; ln -sf ld-uClibc.so.0 ld-uClibc.so; ln -sf ld-uClibc-0.9.33.2.so ld-uClibc.so.0;
cd $(TARGET_DIR)/lib; ln -sf libgcc_s.so.1 libgcc.so; ln -sf libgcc_s.so.1 libgcc_s.so
endif
ifneq ($(CONFIG_TARGET_BRCM6848),)
cp $(CONFIG_TOOLCHAIN_ROOT)/lib/libuClibc-1.0.12.so $(TARGET_DIR)/lib
cd $(TARGET_DIR)/lib;ln -sf libuClibc-1.0.12.so libc.so.1; ln -sf ld-uClibc-1.0.12.so ld-uClibc.so.1; ln -sf ld-uClibc.so.1 ld-uClibc.so.0;
endif
ifneq ($(or $(CONFIG_TARGET_BRCM6858),$(CONFIG_TARGET_BRCM6846)),)
cp $(CONFIG_TOOLCHAIN_ROOT)/usr/arm-buildroot-linux-gnueabi/sysroot/lib/libc-2.24.so $(TARGET_DIR)/lib
cd $(TARGET_DIR)/lib;ln -sf libc-2.24.so libc.so.0; ln -sf ld-2.24.so ld.so.1; ln -sf ld-2.24.so ld.so.0; ln -sf ld.so.0 ld.so;
endif
ifneq ($(CONFIG_TARGET_BRCM6856),)
cp $(CONFIG_TOOLCHAIN_ROOT)/usr/arm-buildroot-linux-gnueabi/sysroot/lib/libc-2.26.so $(TARGET_DIR)/lib
cd $(TARGET_DIR)/lib;ln -sf libc-2.26.so libc.so.0; ln -sf ld-2.26.so ld.so.1; ln -sf ld-2.26.so ld.so.0; ln -sf ld.so.0 ld.so;
endif
ifneq ($(or $(CONFIG_TARGET_ZTE),$(CONFIG_TARGET_ZXIC),$(CONFIG_TARGET_ZXIC2791)),)
cp $(CONFIG_TOOLCHAIN_ROOT)/arm-linux-uclibcgnueabi/lib/libuClibc-0.9.33.2.so $(TARGET_DIR)/lib
cd $(TARGET_DIR)/lib;ln -sf libuClibc-0.9.33.2.so libc.so.0; ln -sf ld-uClibc-0.9.33.2.so ld.so.1; ln -sf ld-uClibc-0.9.33.2.so ld-uClibc.so.0; ln -sf ld-uClibc.so.0 ld-uClibc.so;
endif
ifneq ($(CONFIG_TARGET_ZXIC2791V1),)
cp $(CONFIG_TOOLCHAIN_ROOT)/arm-buildroot-linux-gnueabi/sysroot/lib/libc-2.22.so $(TARGET_DIR)/lib
cd $(TARGET_DIR)/lib;ln -sf libc-2.22.so libc.so.6; ln -sf ld-2.22.so ld-linux.so.3;
endif
ifneq ($(CONFIG_TARGET_ZTE279121),)
cp $(CONFIG_TOOLCHAIN_ROOT)/arm-buildroot-linux-uclibcgnueabi/sysroot/lib/libuClibc-0.9.33.2.so $(TARGET_DIR)/lib
cd $(TARGET_DIR)/lib;ln -sf libuClibc-0.9.33.2.so libc.so.0; ln -sf ld-uClibc-0.9.33.2.so ld.so.1; ln -sf ld-uClibc-0.9.33.2.so ld-uClibc.so.0; ln -sf ld-uClibc.so.0 ld-uClibc.so;
endif
ifneq ($(CONFIG_TARGET_ZTE279131),)
cp $(CONFIG_TOOLCHAIN_ROOT)/arm-sanechips-linux-gnueabihf/sysroot/lib/libc-2.26.so $(TARGET_DIR)/lib
cd $(TARGET_DIR)/lib;ln -sf libc-2.26.so libc.so.6;
endif
ifneq ($(CONFIG_TARGET_CA8277),)
cp $(CONFIG_TOOLCHAIN_ROOT)/lib/libc-2.23.so $(TARGET_DIR)/lib
cd $(TARGET_DIR)/lib;ln -sf libc-2.23.so libc.so.6;
endif
ifneq ($(CONFIG_TARGET_HUAWEI),)
cp $(CONFIG_TOOLCHAIN_ROOT)/sdk/lib/libuClibc-0.9.34-git.so $(TARGET_DIR)/lib
cd $(TARGET_DIR)/lib;ln -sf libuClibc-0.9.34-git.so libc.so.0; ln -sf ld-uClibc-0.9.34-git.so ld.so.1; ln -sf ld-uClibc-0.9.34-git.so ld-uClibc.so.0; ln -sf ld-uClibc.so.0 ld-uClibc.so;
endif
ifneq ($(CONFIG_TARGET_hi5681),)
cp $(CONFIG_TOOLCHAIN_ROOT)/lib/libuClibc-0.9.33.2.so $(TARGET_DIR)/lib
cd $(TARGET_DIR)/lib;ln -sf libuClibc-0.9.33.2.so libc.so.0; ln -sf ld-uClibc-0.9.33.2.so ld.so.1; ln -sf ld-uClibc-0.9.33.2.so ld-uClibc.so.0; ln -sf ld-uClibc.so.0 ld-uClibc.so;
endif
ifneq ($(CONFIG_TARGET_hi5662),)
cp $(CONFIG_TOOLCHAIN_ROOT)/lib/libc-2.22.so $(TARGET_DIR)/lib
cd $(TARGET_DIR)/lib;ln -sf libc-2.22.so libc.so.6;
endif
ifneq ($(CONFIG_TARGET_MTK),)
cp $(CONFIG_TOOLCHAIN_ROOT)/mips-buildroot-linux-uclibc/sysroot/lib/libuClibc-0.9.33.2.so $(TARGET_DIR)/lib
cd $(TARGET_DIR)/lib;ln -sf libuClibc-0.9.33.2.so libc.so.0; ln -sf ld-uClibc-0.9.33.2.so ld.so.1; ln -sf ld-uClibc-0.9.33.2.so ld-uClibc.so.0; ln -sf ld-uClibc.so.0 ld-uClibc.so;
endif
ifneq ($(CONFIG_TARGET_MT7580),)
cp $(CONFIG_TOOLCHAIN_ROOT)/mipsel-buildroot-linux-uclibc/sysroot/lib/libuClibc-0.9.33.2.so $(TARGET_DIR)/lib
cd $(TARGET_DIR)/lib;ln -sf libuClibc-0.9.33.2.so libc.so.0; ln -sf ld-uClibc-0.9.33.2.so ld.so.1; ln -sf ld-uClibc-0.9.33.2.so ld-uClibc.so.0; ln -sf ld-uClibc.so.0 ld-uClibc.so;
endif
#fixme
chmod +x $(TARGET_DIR)/etc/profile
chmod a+w $(TARGET_DIR)/usr/lib/opkg -R
chmod a+w $(TARGET_DIR)/etc/config
$(TAR) -czpf $(BIN_DIR)/$(IMG_PREFIX)_rootfs.tar.gz --same-owner -C $(TARGET_DIR)/ .
SQUASHFSOPT := -b $(CONFIG_TARGET_SQUASHFS_BLOCK_SIZE)k
#LZMA_XZ_OPTIONS := -Xpreset 9 -Xe -Xlc 0 -Xlp 2 -Xpb 2
UBIFS_OPTS = -c 2560 -m 512 -e 15360 -U
FRAMEWORK_DIR = $(BIN_DIR)/framework.dir
SAF_PATH = $(FRAMEWORK_DIR)/saf
SAF_ROOTFS_PATH = $(SAF_PATH)/rootfs
SAF_DEV_PATH = $(SAF_ROOTFS_PATH)/dev
.PHONY: clean dirclean prereq prepare world package/symlinks package/symlinks-install package/symlinks-clean
endif