minor makefile tweaks
[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 RELEASE:=Kamikaze
11 #VERSION:=2.0 # uncomment for final release
12
13 #--------------------------------------------------------------
14 # Just run 'make menuconfig', configure stuff, then run 'make'.
15 # You shouldn't need to mess with anything beyond this point...
16 #--------------------------------------------------------------
17 export TOPDIR=${shell pwd}
18 include $(TOPDIR)/include/verbose.mk
19
20 OPENWRTVERSION:=$(RELEASE)
21 ifneq ($(VERSION),)
22 OPENWRTVERSION:=$(VERSION) ($(OPENWRTVERSION))
23 else
24 REV:=$(shell LANG=C svn info | awk '/^Revision:/ { print$$2 }' )
25 ifneq ($(REV),)
26 OPENWRTVERSION:=$(OPENWRTVERSION)/r$(REV)
27 endif
28 endif
29 export OPENWRTVERSION
30
31 all: world
32
33 ifneq ($(shell ./scripts/timestamp.pl -p .pkginfo package Makefile),.pkginfo)
34 .pkginfo: FORCE
35 .config: FORCE
36 endif
37
38 .pkginfo:
39 @echo Collecting package info...
40 @-for dir in package/*/; do \
41 echo Source-Makefile: $${dir}Makefile; \
42 $(NO_TRACE_MAKE) --no-print-dir DUMP=1 -C $$dir 2>&- || echo "ERROR: please fix package/$${dir}/Makefile" >&2; \
43 done > $@
44
45 .config.in: .pkginfo
46 @./scripts/gen_menuconfig.pl < $< > $@ || rm -f $@
47
48 pkginfo-clean: FORCE
49 -rm -f .pkginfo .config.in
50
51 ./scripts/config/mconf: .config.in
52 @$(MAKE) -C scripts/config all
53
54 ./scripts/config/conf: .config.in
55 @$(MAKE) -C scripts/config conf
56
57 config: ./scripts/config/conf FORCE
58 $< Config.in
59
60 defconfig: ./scripts/config/conf FORCE
61 touch .config
62 $< -D .config Config.in
63
64 oldconfig: ./scripts/config/conf FORCE
65 $< -o Config.in
66
67 menuconfig: ./scripts/config/mconf FORCE
68 $< Config.in
69
70 config-clean: FORCE
71 $(NO_TRACE_MAKE) -C scripts/config clean
72
73 package/%: .pkginfo FORCE
74 $(MAKE) -C package $(patsubst package/%,%,$@)
75
76 target/%: .pkginfo FORCE
77 $(MAKE) -C target $(patsubst target/%,%,$@)
78
79 toolchain/%: FORCE
80 $(MAKE) -C toolchain $(patsubst toolchain/%,%,$@)
81
82 .config: ./scripts/config/conf
83 @[ -f .config ] || $(NO_TRACE_MAKE) menuconfig
84 @$< -D .config Config.in &> /dev/null
85
86 .prereq-build: $(TOPDIR)/include/prereq-build.mk
87 @$(NO_TRACE_MAKE) -s -f $(TOPDIR)/include/prereq-build.mk prereq 2>/dev/null || { \
88 echo "Prerequisite check failed. Use FORCE=1 to override."; \
89 false; \
90 }
91 @touch $@
92
93 .prereq-packages: $(TOPDIR)/include/prereq.mk .pkginfo .config
94 @$(NO_TRACE_MAKE) -s -C package prereq 2>/dev/null || { \
95 echo "Prerequisite check failed. Use FORCE=1 to override."; \
96 false; \
97 }
98 @touch $@
99
100 prereq: .prereq-build .prereq-packages FORCE
101
102 download: .config FORCE
103 $(MAKE) toolchain/download
104 $(MAKE) package/download
105 $(MAKE) target/download
106
107 ifeq ($(FORCE),)
108 .config ./scripts/config/conf ./scripts/config/mconf: .prereq-build
109 world: .prereq-packages
110 endif
111
112 world: .config FORCE
113 $(MAKE) toolchain/install
114 $(MAKE) target/compile
115 $(MAKE) package/compile
116 $(MAKE) package/install
117 $(MAKE) target/install
118 $(MAKE) package/index
119
120 clean: FORCE
121 rm -rf build_* bin
122
123 dirclean: clean
124 rm -rf staging_dir_* toolchain_build_*
125
126 distclean: dirclean config-clean
127 rm -rf dl .*config* .pkg* .prereq
128
129
130 .SILENT: clean dirclean distclean config-clean download world
131 FORCE: ;
132 .PHONY: FORCE
133 %: ;
This page took 0.048711 seconds and 5 git commands to generate.