a5e03d1cb3c48fc09ecc3ff3b43da4bf345f5fb9
[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 IS_TTY:=${shell tty -s && echo 1 || echo 0}
13 export TOPDIR LC_ALL LANG IS_TTY
14
15 world:
16
17 include $(TOPDIR)/include/host.mk
18
19 ifneq ($(OPENWRT_BUILD),1)
20   override OPENWRT_BUILD=1
21   export OPENWRT_BUILD
22   include $(TOPDIR)/include/debug.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-compile): $(tools/stamp-compile)
34 $(target/stamp-compile): $(toolchain/stamp-install) $(tools/stamp-install) $(BUILD_DIR)/.prepared
35 $(package/stamp-compile): $(target/stamp-compile)
36 $(target/stamp-install): $(package/stamp-compile) $(package/stamp-install)
37
38 $(BUILD_DIR)/.prepared: Makefile
39         @mkdir -p $$(dirname $@)
40         @touch $@
41
42 clean: FORCE
43         rm -rf $(BUILD_DIR) $(BIN_DIR)
44         $(MAKE) target/linux/clean
45         rm -rf $(TMP_DIR)
46
47 dirclean: clean
48         rm -rf $(STAGING_DIR) $(STAGING_DIR_HOST) $(STAGING_DIR_TOOLCHAIN) $(BUILD_DIR_TOOLCHAIN) $(BUILD_DIR_HOST)
49
50 # check prerequisites before starting to build
51 prereq: $(package/stamp-prereq) $(target/stamp-prereq) ;
52
53 world: .config $(tools/stamp-install) $(toolchain/stamp-install) $(target/stamp-compile) $(package/stamp-cleanup) $(package/stamp-compile) $(package/stamp-install) $(package/stamp-rootfs-prepare) $(target/stamp-install) FORCE
54         $(MAKE) package/index
55
56 package/symlinks:
57         $(SCRIPT_DIR)/feeds.sh $(CONFIG_SOURCE_FEEDS) $(CONFIG_SOURCE_FEEDS_REV)        
58
59 endif