sunxi: fix mmc support on sun4i
[openwrt/openwrt.git] / Makefile
1 # Makefile for OpenWrt
2 #
3 # Copyright (C) 2007 OpenWrt.org
4 #
5 # This is free software, licensed under the GNU General Public License v2.
6 # See /LICENSE for more information.
7 #
8
9 TOPDIR:=${CURDIR}
10 LC_ALL:=C
11 LANG:=C
12 export TOPDIR LC_ALL LANG
13
14 empty:=
15 space:= $(empty) $(empty)
16 $(if $(findstring $(space),$(TOPDIR)),$(error ERROR: The path to the OpenWrt directory must not include any spaces))
17
18 world:
19
20 include $(TOPDIR)/include/host.mk
21
22 ifneq ($(OPENWRT_BUILD),1)
23 # XXX: these three lines are normally defined by rules.mk
24 # but we can't include that file in this context
25 empty:=
26 space:= $(empty) $(empty)
27 _SINGLE=export MAKEFLAGS=$(space);
28
29 override OPENWRT_BUILD=1
30 export OPENWRT_BUILD
31 GREP_OPTIONS=
32 export GREP_OPTIONS
33 include $(TOPDIR)/include/debug.mk
34 include $(TOPDIR)/include/depends.mk
35 include $(TOPDIR)/include/toplevel.mk
36 else
37 include rules.mk
38 include $(INCLUDE_DIR)/depends.mk
39 include $(INCLUDE_DIR)/subdir.mk
40 include target/Makefile
41 include package/Makefile
42 include tools/Makefile
43 include toolchain/Makefile
44
45 $(toolchain/stamp-install): $(tools/stamp-install)
46 $(target/stamp-compile): $(toolchain/stamp-install) $(tools/stamp-install) $(BUILD_DIR)/.prepared
47 $(package/stamp-compile): $(target/stamp-compile) $(package/stamp-cleanup)
48 $(package/stamp-install): $(package/stamp-compile)
49 $(target/stamp-install): $(package/stamp-compile) $(package/stamp-install)
50
51 printdb:
52 @true
53
54 prepare: $(target/stamp-compile)
55
56 clean: FORCE
57 rm -rf $(BUILD_DIR) $(BIN_DIR) $(BUILD_LOG_DIR)
58
59 dirclean: clean
60 rm -rf $(STAGING_DIR) $(STAGING_DIR_HOST) $(STAGING_DIR_TOOLCHAIN) $(TOOLCHAIN_DIR) $(BUILD_DIR_HOST) $(BUILD_DIR_TOOLCHAIN)
61 rm -rf $(TMP_DIR)
62
63 ifndef DUMP_TARGET_DB
64 $(BUILD_DIR)/.prepared: Makefile
65 @mkdir -p $$(dirname $@)
66 @touch $@
67
68 tmp/.prereq_packages: .config
69 unset ERROR; \
70 for package in $(sort $(prereq-y) $(prereq-m)); do \
71 $(_SINGLE)$(NO_TRACE_MAKE) -s -r -C package/$$package prereq || ERROR=1; \
72 done; \
73 if [ -n "$$ERROR" ]; then \
74 echo "Package prerequisite check failed."; \
75 false; \
76 fi
77 touch $@
78 endif
79
80 # check prerequisites before starting to build
81 prereq: $(target/stamp-prereq) tmp/.prereq_packages
82 @if [ ! -f "$(INCLUDE_DIR)/site/$(REAL_GNU_TARGET_NAME)" ]; then \
83 echo 'ERROR: Missing site config for target "$(REAL_GNU_TARGET_NAME)" !'; \
84 echo ' The missing file will cause configure scripts to fail during compilation.'; \
85 echo ' Please provide a "$(INCLUDE_DIR)/site/$(REAL_GNU_TARGET_NAME)" file and restart the build.'; \
86 exit 1; \
87 fi
88
89 prepare: .config $(tools/stamp-install) $(toolchain/stamp-install)
90 world: prepare $(target/stamp-compile) $(package/stamp-compile) $(package/stamp-install) $(target/stamp-install) FORCE
91 $(_SINGLE)$(SUBMAKE) -r package/index
92
93 # update all feeds, re-create index files, install symlinks
94 package/symlinks:
95 $(SCRIPT_DIR)/feeds update -a
96 $(SCRIPT_DIR)/feeds install -a
97
98 # re-create index files, install symlinks
99 package/symlinks-install:
100 $(SCRIPT_DIR)/feeds update -i
101 $(SCRIPT_DIR)/feeds install -a
102
103 # remove all symlinks, don't touch ./feeds
104 package/symlinks-clean:
105 $(SCRIPT_DIR)/feeds uninstall -a
106
107 .PHONY: clean dirclean prereq prepare world package/symlinks package/symlinks-install package/symlinks-clean
108
109 endif