8b0ef0d57d53e972995ce513ee67e39d0dbbfbb6
[openwrt-10.03/.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 world:
15
16 include $(TOPDIR)/include/host.mk
17
18 ifneq ($(OPENWRT_BUILD),1)
19   override OPENWRT_BUILD=1
20   export OPENWRT_BUILD
21   include $(TOPDIR)/include/debug.mk
22   include $(TOPDIR)/include/depends.mk
23   include $(TOPDIR)/include/toplevel.mk
24 else
25   include rules.mk
26   include $(INCLUDE_DIR)/depends.mk
27   include $(INCLUDE_DIR)/subdir.mk
28   include target/Makefile
29   include package/Makefile
30   include tools/Makefile
31   include toolchain/Makefile
32
33 $(toolchain/stamp-install): $(tools/stamp-install)
34 $(target/stamp-compile): $(toolchain/stamp-install) $(tools/stamp-install) $(BUILD_DIR)/.prepared
35 $(package/stamp-cleanup): $(target/stamp-compile)
36 $(package/stamp-compile): $(target/stamp-compile) $(package/stamp-cleanup)
37 $(package/stamp-install): $(package/stamp-compile)
38 $(package/stamp-rootfs-prepare): $(package/stamp-install)
39 $(target/stamp-install): $(package/stamp-compile) $(package/stamp-install) $(package/stamp-rootfs-prepare)
40
41 $(BUILD_DIR)/.prepared: Makefile
42         @mkdir -p $$(dirname $@)
43         @touch $@
44
45 clean: FORCE
46         rm -rf $(BUILD_DIR) $(BIN_DIR)
47         $(MAKE) target/linux/clean
48
49 dirclean: clean
50         rm -rf $(STAGING_DIR) $(STAGING_DIR_HOST) $(STAGING_DIR_TOOLCHAIN) $(TOOLCHAIN_DIR) $(BUILD_DIR_HOST)
51         rm -rf $(TMP_DIR)
52
53 # check prerequisites before starting to build
54 prereq: $(package/stamp-prereq) $(target/stamp-prereq) ;
55
56 prepare: .config $(tools/stamp-install) $(toolchain/stamp-install)
57 world: prepare $(target/stamp-compile) $(package/stamp-cleanup) $(package/stamp-compile) $(package/stamp-install) $(package/stamp-rootfs-prepare) $(target/stamp-install) FORCE
58         $(MAKE) package/index
59
60 # update all feeds, re-create index files, install symlinks
61 package/symlinks:
62         $(SCRIPT_DIR)/feeds update -a
63         $(SCRIPT_DIR)/feeds install -a
64
65 # re-create index files, install symlinks
66 package/symlinks-install:
67         $(SCRIPT_DIR)/feeds update -i
68         $(SCRIPT_DIR)/feeds install -a
69
70 # remove all symlinks, don't touch ./feeds
71 package/symlinks-clean:
72         $(SCRIPT_DIR)/feeds uninstall -a
73
74 .PHONY: clean dirclean prereq prepare world package/symlinks package/symlinks-install package/symlinks-clean
75
76 endif