source: trunk/include/toplevel.mk @ 22518

Last change on this file since 22518 was 22518, checked in by lars, 6 years ago

Add kernel_nconfig make target

File size: 4.7 KB
Line 
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
9RELEASE:=Kamikaze
10SHELL:=/usr/bin/env bash
11PREP_MK= OPENWRT_BUILD= QUIET=0
12
13include $(TOPDIR)/include/verbose.mk
14
15ifeq ($(SDK),1)
16  include $(TOPDIR)/include/version.mk
17else
18  REVISION:=$(shell $(TOPDIR)/scripts/getver.sh)
19endif
20
21OPENWRTVERSION:=$(RELEASE)$(if $(REVISION), ($(REVISION)))
22export RELEASE
23export REVISION
24export OPENWRTVERSION
25export IS_TTY=$(shell tty -s && echo 1 || echo 0)
26export LD_LIBRARY_PATH:=$(if $(LD_LIBRARY_PATH),$(LD_LIBRARY_PATH):)$(STAGING_DIR_HOST)/lib
27export DYLD_LIBRARY_PATH:=$(if $(DYLD_LIBRARY_PATH),$(DYLD_LIBRARY_PATH):)$(STAGING_DIR_HOST)/lib
28
29# prevent perforce from messing with the patch utility
30unexport P4PORT P4USER P4CONFIG P4CLIENT
31
32# prevent user defaults for quilt from interfering
33unexport QUILT_PATCHES QUILT_PATCH_OPTS
34
35# make sure that a predefined CFLAGS variable does not disturb packages
36export CFLAGS=
37
38ifeq ($(FORCE),)
39  .config scripts/config/conf scripts/config/mconf: tmp/.prereq-build
40endif
41
42SCAN_COOKIE?=$(shell echo $$$$)
43export SCAN_COOKIE
44
45prepare-mk: FORCE ;
46
47prepare-tmpinfo: FORCE
48        mkdir -p tmp/info
49        $(_SINGLE)$(NO_TRACE_MAKE) -j1 -r -s -f include/scan.mk SCAN_TARGET="packageinfo" SCAN_DIR="package" SCAN_NAME="package" SCAN_DEPS="$(TOPDIR)/include/package*.mk $(TOPDIR)/overlay/*/*.mk" SCAN_DEPTH=5 SCAN_EXTRA=""
50        $(_SINGLE)$(NO_TRACE_MAKE) -j1 -r -s -f include/scan.mk SCAN_TARGET="targetinfo" SCAN_DIR="target/linux" SCAN_NAME="target" SCAN_DEPS="profiles/*.mk $(TOPDIR)/include/kernel*.mk $(TOPDIR)/include/target.mk" SCAN_DEPTH=2 SCAN_EXTRA="" SCAN_MAKEOPTS="TARGET_BUILD=1"
51        for type in package target; do \
52                f=tmp/.$${type}info; t=tmp/.config-$${type}.in; \
53                [ "$$t" -nt "$$f" ] || ./scripts/metadata.pl $${type}_config "$$f" > "$$t" || { rm -f "$$t"; echo "Failed to build $$t"; false; break; }; \
54        done
55        ./scripts/metadata.pl package_mk tmp/.packageinfo > tmp/.packagedeps || { rm -f tmp/.packagedeps; false; }
56        touch $(TOPDIR)/tmp/.build
57
58.config: ./scripts/config/conf $(if $(CONFIG_HAVE_DOT_CONFIG),,prepare-tmpinfo)
59        @+if [ \! -e .config ] || ! grep CONFIG_HAVE_DOT_CONFIG .config >/dev/null; then \
60                [ -e $(HOME)/.openwrt/defconfig ] && cp $(HOME)/.openwrt/defconfig .config; \
61                $(_SINGLE)$(NO_TRACE_MAKE) menuconfig $(PREP_MK); \
62        fi
63
64scripts/config/mconf:
65        @$(_SINGLE)$(SUBMAKE) -s -C scripts/config all
66
67$(eval $(call rdep,scripts/config,scripts/config/mconf))
68
69scripts/config/conf:
70        @$(_SINGLE)$(SUBMAKE) -s -C scripts/config conf
71
72config: scripts/config/conf prepare-tmpinfo FORCE
73        $< Config.in
74
75config-clean: FORCE
76        $(_SINGLE)$(NO_TRACE_MAKE) -C scripts/config clean
77
78defconfig: scripts/config/conf prepare-tmpinfo FORCE
79        touch .config
80        $< -D .config Config.in
81
82oldconfig: scripts/config/conf prepare-tmpinfo FORCE
83        $< -$(if $(CONFDEFAULT),$(CONFDEFAULT),o) Config.in
84
85menuconfig: scripts/config/mconf prepare-tmpinfo FORCE
86        if [ \! -e .config -a -e $(HOME)/.openwrt/defconfig ]; then \
87                cp $(HOME)/.openwrt/defconfig .config; \
88        fi
89        $< Config.in
90
91prepare_kernel_conf: .config FORCE
92
93ifeq ($(wildcard staging_dir/host/bin/sed),)
94  prepare_kernel_conf:
95        @+$(SUBMAKE) -r tools/sed/install
96else
97  prepare_kernel_conf: ;
98endif
99
100kernel_oldconfig: prepare_kernel_conf
101        $(_SINGLE)$(NO_TRACE_MAKE) -C target/linux oldconfig
102
103kernel_menuconfig: prepare_kernel_conf
104        $(_SINGLE)$(NO_TRACE_MAKE) -C target/linux menuconfig
105
106kernel_nconfig: prepare_kernel_conf
107        $(_SINGLE)$(NO_TRACE_MAKE) -C target/linux nconfig
108
109tmp/.prereq-build: include/prereq-build.mk
110        mkdir -p tmp
111        rm -f tmp/.host.mk
112        @$(_SINGLE)$(NO_TRACE_MAKE) -j1 -r -s -f $(TOPDIR)/include/prereq-build.mk prereq 2>/dev/null || { \
113                echo "Prerequisite check failed. Use FORCE=1 to override."; \
114                false; \
115        }
116        touch $@
117
118download: .config FORCE
119        @+$(SUBMAKE) tools/download
120        @+$(SUBMAKE) toolchain/download
121        @+$(SUBMAKE) package/download
122        @+$(SUBMAKE) target/download
123
124clean dirclean: .config
125        @+$(SUBMAKE) -r $@ 
126
127prereq:: prepare-tmpinfo .config
128        @+$(MAKE) -r -s tmp/.prereq-build $(PREP_MK)
129        @+$(NO_TRACE_MAKE) -r -s $@
130
131%::
132        @+$(PREP_MK) $(NO_TRACE_MAKE) -r -s prereq
133        @+$(SUBMAKE) -r $@
134
135help:
136        cat README
137
138docs docs/compile: FORCE
139        @$(_SINGLE)$(SUBMAKE) -C docs compile
140
141docs/clean: FORCE
142        @$(_SINGLE)$(SUBMAKE) -C docs clean
143
144distclean:
145        rm -rf tmp build_dir staging_dir dl .config* feeds package/feeds package/openwrt-packages bin
146        @$(_SINGLE)$(SUBMAKE) -C scripts/config clean
147
148ifeq ($(findstring v,$(DEBUG)),)
149  .SILENT: symlinkclean clean dirclean distclean config-clean download help tmpinfo-clean .config scripts/config/mconf scripts/config/conf menuconfig tmp/.prereq-build tmp/.prereq-package prepare-tmpinfo
150endif
151.PHONY: help FORCE
152.NOTPARALLEL:
153
Note: See TracBrowser for help on using the repository browser.