build system fixes, more cleanup
[openwrt.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 all: world
10
11 TOPDIR:=${CURDIR}
12 LC_ALL:=C
13 LANG:=C
14 IS_TTY:=${shell tty -s && echo 1 || echo 0}
15 export TOPDIR LC_ALL LANG IS_TTY
16
17 ifneq ($(OPENWRT_BUILD),1)
18   export OPENWRT_BUILD:=1
19   include $(TOPDIR)/include/toplevel.mk
20 else
21   include rules.mk
22   include $(INCLUDE_DIR)/depends.mk
23   include $(INCLUDE_DIR)/subdir.mk
24   include tools/Makefile
25   include toolchain/Makefile
26
27 clean: FORCE
28         rm -rf build_* bin tmp
29
30 dirclean: clean
31         rm -rf staging_dir_* toolchain_build_* tool_build
32
33 distclean: dirclean config-clean symlinkclean docs/clean
34         rm -rf dl
35
36 toolchain/% package/% target/%: FORCE
37         $(MAKE) -C $(patsubst %/$*,%,$@) $*
38
39 world: .config $(tools/stamp) $(toolchain/stamp) FORCE
40         $(MAKE) target/compile
41         $(MAKE) package/compile
42         $(MAKE) package/install
43         $(MAKE) target/install
44         $(MAKE) package/index
45
46 endif