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 rm -rf
$(BUILD_DIR
) $(BIN_DIR
) $(BUILD_LOG_DIR
)
60 rm -rf
$(STAGING_DIR
) $(STAGING_DIR_HOST
) $(STAGING_DIR_TOOLCHAIN
) $(TOOLCHAIN_DIR
) $(BUILD_DIR_HOST
) $(BUILD_DIR_TOOLCHAIN
)
64 $(BUILD_DIR
)/.prepared
: Makefile
65 @mkdir
-p
$$(dirname
$@
)
68 tmp
/.prereq_packages
: .config
70 for package in
$(sort $(prereq-y
) $(prereq-m
)); do \
71 $(_SINGLE
)$(NO_TRACE_MAKE
) -s
-r
-C package
/$$package prereq || ERROR
=1; \
73 if
[ -n
"$$ERROR" ]; then \
74 echo
"Package prerequisite check failed."; \
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.'; \
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
93 # update all feeds, re-create index files, install symlinks
95 $(SCRIPT_DIR
)/feeds update
-a
96 $(SCRIPT_DIR
)/feeds
install -a
98 # re-create index files, install symlinks
99 package
/symlinks-install
:
100 $(SCRIPT_DIR
)/feeds update
-i
101 $(SCRIPT_DIR
)/feeds
install -a
103 # remove all symlinks, don't touch ./feeds
104 package
/symlinks-clean
:
105 $(SCRIPT_DIR
)/feeds
uninstall -a
107 .PHONY
: clean dirclean prereq prepare world package
/symlinks package
/symlinks-install package
/symlinks-clean