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

Archive Download this file



interactive