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.
13 export TOPDIR LC_ALL LANG TZ
16 space
:= $(empty
) $(empty
)
17 $(if
$(findstring $(space
),$(TOPDIR
)),$(error ERROR
: The path to the OpenWrt directory must not
include any spaces
))
21 DISTRO_PKG_CONFIG
:=$(shell which
-a pkg-config | grep
-E
'\/usr' | head
-n
1)
22 export PATH
:=$(TOPDIR
)/staging_dir
/host
/bin
:$(PATH
)
24 ifneq ($(OPENWRT_BUILD
),1)
25 _SINGLE
=export MAKEFLAGS
=$(space
);
27 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-compile
): $(tools
/stamp-compile
)
46 $(target
/stamp-compile
): $(toolchain
/stamp-compile
) $(tools
/stamp-compile
) $(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 check: $(tools
/stamp-check
) $(toolchain
/stamp-check
) $(package
/stamp-check
)
55 prepare
: $(target
/stamp-compile
)
58 rm -rf
$(BUILD_DIR
) $(STAGING_DIR
) $(BIN_DIR
) $(OUTPUT_DIR
)/packages
/$(ARCH_PACKAGES
) $(BUILD_LOG_DIR
) $(TOPDIR
)/staging_dir
/packages
61 rm -rf
$(STAGING_DIR_HOST
) $(STAGING_DIR_HOSTPKG
) $(TOOLCHAIN_DIR
) $(BUILD_DIR_BASE
)/host
$(BUILD_DIR_BASE
)/hostpkg
$(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/$(ARCH)" ]; then \
84 echo
'ERROR: Missing site config for architecture "$(ARCH)" !'; \
85 echo
' The missing file will cause configure scripts to fail during compilation.'; \
86 echo
' Please provide a "$(INCLUDE_DIR)/site/$(ARCH)" file and restart the build.'; \
91 $(call sha256sums
,$(BIN_DIR
),$(CONFIG_BUILDBOT
))
94 $(SCRIPT_DIR
)/getver.sh
> $(BIN_DIR
)/version.buildinfo
97 $(SCRIPT_DIR
)/feeds list
-fs
> $(BIN_DIR
)/feeds.buildinfo
101 $(SCRIPT_DIR
)/diffconfig.sh
> $(BIN_DIR
)/config.buildinfo
104 $(_SINGLE
)$(SUBMAKE
) -r diffconfig buildversion feedsversion
106 prepare
: .config
$(tools
/stamp-compile
) $(toolchain
/stamp-compile
)
107 $(_SINGLE
)$(SUBMAKE
) -r buildinfo
109 world
: prepare
$(target
/stamp-compile
) $(package
/stamp-compile
) $(package
/stamp-install
) $(target
/stamp-install
) FORCE
110 $(_SINGLE
)$(SUBMAKE
) -r package
/index
111 $(_SINGLE
)$(SUBMAKE
) -r checksum
113 .PHONY
: clean dirclean prereq prepare world package
/symlinks package
/symlinks-install package
/symlinks-clean