more build system cleanup
[openwrt/openwrt.git] / Makefile
1 # Makefile for OpenWrt
2 #
3 # Copyright (C) 2006 OpenWrt.org
4 # Copyright (C) 2006 by Felix Fietkau <openwrt@nbd.name>
5 #
6 # This is free software, licensed under the GNU General Public License v2.
7 # See /LICENSE for more information.
8 #
9
10 all: world
11
12
13 TOPDIR:=${CURDIR}
14 LC_ALL:=C
15 LANG:=C
16 IS_TTY:=${shell tty -s && echo 1 || echo 0}
17 export TOPDIR LC_ALL LANG IS_TTY
18
19 include rules.mk
20
21 ifneq ($(OPENWRT_BUILD),1)
22 export OPENWRT_BUILD:=1
23 include $(INCLUDE_DIR)/toplevel.mk
24 else
25 include $(INCLUDE_DIR)/depends.mk
26 include $(INCLUDE_DIR)/subdir.mk
27 include tools/Makefile
28
29 clean: FORCE
30 rm -rf build_* bin tmp
31
32 dirclean: clean
33 rm -rf staging_dir_* toolchain_build_* tool_build
34
35 distclean: dirclean config-clean symlinkclean docs/clean
36 rm -rf dl
37
38 toolchain/% package/% target/%: FORCE
39 $(MAKE) -C $(patsubst %/$*,%,$@) $*
40
41 world: .config $(tools/stamp) FORCE
42 $(MAKE) toolchain/install
43 $(MAKE) target/compile
44 $(MAKE) package/compile
45 $(MAKE) package/install
46 $(MAKE) target/install
47 $(MAKE) package/index
48
49 endif