3 # Copyright (C) 2007 OpenWrt.org
5 # This is free software, licensed under the GNU General Public License v2.
6 # See /LICENSE for more information.
12 export TOPDIR LC_ALL LANG
15 space
:= $(empty
) $(empty
)
16 $(if
$(findstring $(space
),$(TOPDIR
)),$(error ERROR
: The path to the OpenWrt directory must not
include any spaces
))
20 include $(TOPDIR
)/include/host.mk
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
26 space
:= $(empty
) $(empty
)
27 _SINGLE
=export MAKEFLAGS
=$(space
);
29 override OPENWRT_BUILD
=1
33 include $(TOPDIR
)/include/debug.mk
34 include $(TOPDIR
)/include/depends.mk
35 include $(TOPDIR
)/include/toplevel.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
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
)
54 prepare
: $(target
/stamp-compile
)
57 $(_SINGLE
)$(SUBMAKE
) target
/linux
/clean
58 rm -rf
$(BUILD_DIR
) $(BIN_DIR
) $(BUILD_LOG_DIR
)
61 rm -rf
$(STAGING_DIR
) $(STAGING_DIR_HOST
) $(STAGING_DIR_TOOLCHAIN
) $(TOOLCHAIN_DIR
) $(BUILD_DIR_HOST
) $(BUILD_DIR_TOOLCHAIN
)
65 $(BUILD_DIR
)/.prepared
: Makefile
66 @mkdir
-p
$$(dirname
$@
)
69 tmp
/.prereq_packages
: .config
71 for package in
$(sort $(prereq-y
) $(prereq-m
)); do \
72 $(_SINGLE
)$(NO_TRACE_MAKE
) -s
-r
-C package
/$$package prereq || ERROR
=1; \
74 if
[ -n
"$$ERROR" ]; then \
75 echo
"Package prerequisite check failed."; \
81 # check prerequisites before starting to build
82 prereq
: $(target
/stamp-prereq
) tmp
/.prereq_packages
83 @if
[ ! -f
"$(INCLUDE_DIR)/site/$(REAL_GNU_TARGET_NAME)" ]; then \
84 echo
'ERROR: Missing site config for target "$(REAL_GNU_TARGET_NAME)" !'; \
85 echo
' The missing file will cause configure scripts to fail during compilation.'; \
86 echo
' Please provide a "$(INCLUDE_DIR)/site/$(REAL_GNU_TARGET_NAME)" file and restart the build.'; \
90 prepare
: .config
$(tools
/stamp-install
) $(toolchain
/stamp-install
)
91 world
: prepare
$(target
/stamp-compile
) $(package
/stamp-compile
) $(package
/stamp-install
) $(target
/stamp-install
) FORCE
92 $(_SINGLE
)$(SUBMAKE
) -r package
/index
94 # update all feeds, re-create index files, install symlinks
96 $(SCRIPT_DIR
)/feeds update
-a
97 $(SCRIPT_DIR
)/feeds
install -a
99 # re-create index files, install symlinks
100 package
/symlinks-install
:
101 $(SCRIPT_DIR
)/feeds update
-i
102 $(SCRIPT_DIR
)/feeds
install -a
104 # remove all symlinks, don't touch ./feeds
105 package
/symlinks-clean
:
106 $(SCRIPT_DIR
)/feeds
uninstall -a
108 .PHONY
: clean dirclean prereq prepare world package
/symlinks package
/symlinks-install package
/symlinks-clean