ar7: drop 3.14 support
[openwrt/svn-archive/archive.git] / target / sdk / Makefile
1 #
2 # Copyright (C) 2006-2014 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9 include $(INCLUDE_DIR)/kernel.mk
10 include $(INCLUDE_DIR)/host.mk
11 include $(INCLUDE_DIR)/version.mk
12
13 override MAKEFLAGS=
14
15 SDK_NAME:=OpenWrt-SDK-$(if $(CONFIG_VERSION_FILENAMES),$(VERSION_NUMBER)-)$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))_gcc-$(GCCV)$(DIR_SUFFIX).$(HOST_OS)-$(HOST_ARCH)
16 SDK_BUILD_DIR:=$(BUILD_DIR)/$(SDK_NAME)
17
18 STAGING_SUBDIR_HOST := staging_dir/host
19 STAGING_SUBDIR_TARGET := staging_dir/target-$(ARCH)$(ARCH_SUFFIX)_$(LIBC)-$(LIBCV)$(if $(CONFIG_arm),_eabi)
20 STAGING_SUBDIR_TOOLCHAIN := staging_dir/toolchain-$(ARCH)$(ARCH_SUFFIX)_gcc-$(GCCV)_$(LIBC)-$(LIBCV)$(if $(CONFIG_arm),_eabi)
21
22 EXCLUDE_DIRS:=*/ccache \
23 */stamp \
24 */stampfiles \
25 */man \
26 */info \
27 */root-* \
28 initial \
29 *.install.clean \
30 *.install.flags \
31 *.install \
32 */doc
33
34 SDK_DIRS = \
35 $(STAGING_SUBDIR_HOST) \
36 $(STAGING_SUBDIR_TARGET) \
37 $(STAGING_SUBDIR_TOOLCHAIN)
38
39 BASE_FEED:=$(shell git config --get remote.origin.url 2>/dev/null | sed -ne 's/^/src-git base /p')
40 BASE_FEED:=$(if $(BASE_FEED),$(BASE_FEED),$(shell cd $(TOPDIR); LC_ALL=C git svn info 2>/dev/null | sed -ne 's/^URL: /src-gitsvn base /p'))
41 BASE_FEED:=$(if $(BASE_FEED),$(BASE_FEED),$(shell cd $(TOPDIR); LC_ALL=C svn info 2>/dev/null | sed -ne 's/^URL: /src-svn base /p'))
42
43 KDIR_BASE = $(patsubst $(TOPDIR)/%,%,$(LINUX_DIR))
44
45 KERNEL_FILES_ARCH = \
46 Makefile* \
47 module.lds \
48 Kbuild.platforms \
49 */Platform \
50 include \
51 */include \
52 scripts \
53 kernel/asm-offsets.s
54
55 KERNEL_FILES_BASE := \
56 .config \
57 Makefile \
58 scripts \
59 include \
60 Module.symvers \
61 $(addprefix arch/$(LINUX_KARCH)/,$(KERNEL_FILES_ARCH))
62
63 KERNEL_FILES := $(patsubst $(TOPDIR)/%,%,$(wildcard $(addprefix $(LINUX_DIR)/,$(KERNEL_FILES_BASE))))
64
65 all: compile
66
67 $(BIN_DIR)/$(SDK_NAME).tar.bz2: clean
68 mkdir -p $(SDK_BUILD_DIR)/dl $(SDK_BUILD_DIR)/package
69 $(CP) $(INCLUDE_DIR) $(SCRIPT_DIR) $(TOPDIR)/docs $(SDK_BUILD_DIR)/
70 $(TAR) -cf - -C $(TOPDIR) \
71 $(foreach exclude,$(EXCLUDE_DIRS),--exclude="$(exclude)") \
72 $(SDK_DIRS) $(KERNEL_FILES) | \
73 $(TAR) -xf - -C $(SDK_BUILD_DIR)
74
75 @-( \
76 find \
77 $(SDK_BUILD_DIR)/$(STAGING_SUBDIR_HOST)/bin \
78 $(SDK_BUILD_DIR)/$(STAGING_SUBDIR_HOST)/usr/bin \
79 $(SDK_BUILD_DIR)/$(STAGING_SUBDIR_TOOLCHAIN)/bin \
80 $(SDK_BUILD_DIR)/$(STAGING_SUBDIR_TOOLCHAIN)/*/bin \
81 $(SDK_BUILD_DIR)/$(STAGING_SUBDIR_TOOLCHAIN)/libexec \
82 -type f; \
83 find \
84 $(SDK_BUILD_DIR)/$(STAGING_SUBDIR_HOST)/lib \
85 $(SDK_BUILD_DIR)/$(STAGING_SUBDIR_HOST)/usr/lib \
86 -type f -name \*.so\* -or -name \*.a; \
87 ) | xargs strip 2>/dev/null >/dev/null
88
89 mkdir -p $(SDK_BUILD_DIR)/target/linux
90 $(CP) $(GENERIC_PLATFORM_DIR) $(PLATFORM_DIR) $(SDK_BUILD_DIR)/target/linux/
91 rm -rf \
92 $(SDK_BUILD_DIR)/target/linux/*/files* \
93 $(SDK_BUILD_DIR)/target/linux/*/patches*
94 ./convert-config.pl $(TOPDIR)/.config > $(SDK_BUILD_DIR)/Config-build.in
95 $(CP) -L \
96 $(TOPDIR)/LICENSE \
97 $(TOPDIR)/rules.mk \
98 $(TOPDIR)/.config \
99 ./files/Config.in \
100 ./files/Makefile \
101 ./files/include/prepare.mk \
102 ./files/README.SDK \
103 $(SDK_BUILD_DIR)/
104 $(CP) \
105 $(TOPDIR)/package/Makefile \
106 $(SDK_BUILD_DIR)/package/
107
108 -rm -f $(SDK_BUILD_DIR)/feeds.conf.default
109 $(if $(BASE_FEED),echo "$(BASE_FEED)" > $(SDK_BUILD_DIR)/feeds.conf.default)
110 if [ -f $(TOPDIR)/feeds.conf ]; then \
111 cat $(TOPDIR)/feeds.conf >> $(SDK_BUILD_DIR)/feeds.conf.default; \
112 else \
113 cat $(TOPDIR)/feeds.conf.default >> $(SDK_BUILD_DIR)/feeds.conf.default; \
114 fi
115 $(SED) 's,^# REVISION:=.*,REVISION:=$(REVISION),g' $(SDK_BUILD_DIR)/include/version.mk
116 $(SED) '/LINUX_VERMAGIC:=/ { s,unknown,$(LINUX_VERMAGIC),g }' $(SDK_BUILD_DIR)/include/kernel.mk
117 find $(SDK_BUILD_DIR) -name .git | $(XARGS) rm -rf
118 find $(SDK_BUILD_DIR) -name .svn | $(XARGS) rm -rf
119 find $(SDK_BUILD_DIR) -name CVS | $(XARGS) rm -rf
120 (cd $(BUILD_DIR); \
121 tar cfj $@ $(SDK_NAME); \
122 )
123
124 download:
125 prepare:
126 compile: $(BIN_DIR)/$(SDK_NAME).tar.bz2
127 install: compile
128
129 clean:
130 rm -rf $(SDK_BUILD_DIR) $(BIN_DIR)/$(SDK_NAME).tar.bz2