Makefile (0ecfebd2b52404ae0c54a878c872bb93363ada36) Makefile (d6fc9fcbaa655cff2d2be05e16867d1918f78b85)
1# SPDX-License-Identifier: GPL-2.0
2VERSION = 5
3PATCHLEVEL = 2
4SUBLEVEL = 0
1# SPDX-License-Identifier: GPL-2.0
2VERSION = 5
3PATCHLEVEL = 2
4SUBLEVEL = 0
5EXTRAVERSION =
6NAME = Bobtail Squid
5EXTRAVERSION = -rc4
6NAME = Golden Lions
7
8# *DOCUMENTATION*
9# To see a list of typical targets execute "make help"
10# More info can be located in ./README
11# Comments in this file are targeted only to the developer, do not
12# expect to learn how to build the kernel reading this file.
13
14# That's our default target when none is given on the command line

--- 192 unchanged lines hidden (view full) ---

207endif
208
209# Use make M=dir to specify directory of external module to build
210# Old syntax make ... SUBDIRS=$PWD is still supported
211# Setting the environment variable KBUILD_EXTMOD take precedence
212ifdef SUBDIRS
213 $(warning ================= WARNING ================)
214 $(warning 'SUBDIRS' will be removed after Linux 5.3)
7
8# *DOCUMENTATION*
9# To see a list of typical targets execute "make help"
10# More info can be located in ./README
11# Comments in this file are targeted only to the developer, do not
12# expect to learn how to build the kernel reading this file.
13
14# That's our default target when none is given on the command line

--- 192 unchanged lines hidden (view full) ---

207endif
208
209# Use make M=dir to specify directory of external module to build
210# Old syntax make ... SUBDIRS=$PWD is still supported
211# Setting the environment variable KBUILD_EXTMOD take precedence
212ifdef SUBDIRS
213 $(warning ================= WARNING ================)
214 $(warning 'SUBDIRS' will be removed after Linux 5.3)
215 $(warning )
216 $(warning If you are building an individual subdirectory)
217 $(warning in the kernel tree, you can do like this:)
218 $(warning $$ make path/to/dir/you/want/to/build/)
219 $(warning (Do not forget the trailing slash))
220 $(warning )
221 $(warning If you are building an external module,)
215 $(warning Please use 'M=' or 'KBUILD_EXTMOD' instead)
216 $(warning ==========================================)
217 KBUILD_EXTMOD ?= $(SUBDIRS)
218endif
219
220ifeq ("$(origin M)", "command line")
221 KBUILD_EXTMOD := $(M)
222endif

--- 34 unchanged lines hidden (view full) ---

257# of make so .config is not included in this case either (for *config).
258
259version_h := include/generated/uapi/linux/version.h
260old_version_h := include/linux/version.h
261
262clean-targets := %clean mrproper cleandocs
263no-dot-config-targets := $(clean-targets) \
264 cscope gtags TAGS tags help% %docs check% coccicheck \
222 $(warning Please use 'M=' or 'KBUILD_EXTMOD' instead)
223 $(warning ==========================================)
224 KBUILD_EXTMOD ?= $(SUBDIRS)
225endif
226
227ifeq ("$(origin M)", "command line")
228 KBUILD_EXTMOD := $(M)
229endif

--- 34 unchanged lines hidden (view full) ---

264# of make so .config is not included in this case either (for *config).
265
266version_h := include/generated/uapi/linux/version.h
267old_version_h := include/linux/version.h
268
269clean-targets := %clean mrproper cleandocs
270no-dot-config-targets := $(clean-targets) \
271 cscope gtags TAGS tags help% %docs check% coccicheck \
265 $(version_h) headers_% archheaders archscripts \
272 $(version_h) headers headers_% archheaders archscripts \
266 %asm-generic kernelversion %src-pkg
267no-sync-config-targets := $(no-dot-config-targets) install %install \
268 kernelrelease
269
270config-targets := 0
271mixed-targets := 0
272dot-config := 1
273may-sync-config := 1

--- 248 unchanged lines hidden (view full) ---

522CLANG_FLAGS := --target=$(notdir $(CROSS_COMPILE:%-=%))
523GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)elfedit))
524CLANG_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR)
525GCC_TOOLCHAIN := $(realpath $(GCC_TOOLCHAIN_DIR)/..)
526endif
527ifneq ($(GCC_TOOLCHAIN),)
528CLANG_FLAGS += --gcc-toolchain=$(GCC_TOOLCHAIN)
529endif
273 %asm-generic kernelversion %src-pkg
274no-sync-config-targets := $(no-dot-config-targets) install %install \
275 kernelrelease
276
277config-targets := 0
278mixed-targets := 0
279dot-config := 1
280may-sync-config := 1

--- 248 unchanged lines hidden (view full) ---

529CLANG_FLAGS := --target=$(notdir $(CROSS_COMPILE:%-=%))
530GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)elfedit))
531CLANG_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR)
532GCC_TOOLCHAIN := $(realpath $(GCC_TOOLCHAIN_DIR)/..)
533endif
534ifneq ($(GCC_TOOLCHAIN),)
535CLANG_FLAGS += --gcc-toolchain=$(GCC_TOOLCHAIN)
536endif
537ifeq ($(shell $(AS) --version 2>&1 | head -n 1 | grep clang),)
530CLANG_FLAGS += -no-integrated-as
538CLANG_FLAGS += -no-integrated-as
539endif
540CLANG_FLAGS += -Werror=unknown-warning-option
531KBUILD_CFLAGS += $(CLANG_FLAGS)
532KBUILD_AFLAGS += $(CLANG_FLAGS)
533export CLANG_FLAGS
534endif
535
536# The expansion should be delayed until arch/$(SRCARCH)/Makefile is included.
537# Some architectures define CROSS_COMPILE in arch/$(SRCARCH)/Makefile.
538# CC_VERSION_TEXT is referenced from Kconfig (so it needs export),

--- 509 unchanged lines hidden (view full) ---

1048 $(CONFIG_SHELL) $< $(LD) $(KBUILD_LDFLAGS) $(LDFLAGS_vmlinux) ; \
1049 $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true)
1050
1051vmlinux: scripts/link-vmlinux.sh autoksyms_recursive $(vmlinux-deps) FORCE
1052 +$(call if_changed,link-vmlinux)
1053
1054targets := vmlinux
1055
541KBUILD_CFLAGS += $(CLANG_FLAGS)
542KBUILD_AFLAGS += $(CLANG_FLAGS)
543export CLANG_FLAGS
544endif
545
546# The expansion should be delayed until arch/$(SRCARCH)/Makefile is included.
547# Some architectures define CROSS_COMPILE in arch/$(SRCARCH)/Makefile.
548# CC_VERSION_TEXT is referenced from Kconfig (so it needs export),

--- 509 unchanged lines hidden (view full) ---

1058 $(CONFIG_SHELL) $< $(LD) $(KBUILD_LDFLAGS) $(LDFLAGS_vmlinux) ; \
1059 $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true)
1060
1061vmlinux: scripts/link-vmlinux.sh autoksyms_recursive $(vmlinux-deps) FORCE
1062 +$(call if_changed,link-vmlinux)
1063
1064targets := vmlinux
1065
1056# Some samples need headers_install.
1057samples: headers_install
1058
1059# The actual objects are generated when descending,
1060# make sure no implicit rule kicks in
1061$(sort $(vmlinux-deps)): $(vmlinux-dirs) ;
1062
1063# Handle descending into subdirectories listed in $(vmlinux-dirs)
1064# Preset locale variables to speed up the build process. Limit locale
1065# tweaks to this spot to avoid wrong language settings when running
1066# make menuconfig etc.

--- 109 unchanged lines hidden (view full) ---

1176 $(srctree)/scripts/headerdep.pl -I$(srctree)/include
1177
1178# ---------------------------------------------------------------------------
1179# Kernel headers
1180
1181#Default location for installed headers
1182export INSTALL_HDR_PATH = $(objtree)/usr
1183
1066# The actual objects are generated when descending,
1067# make sure no implicit rule kicks in
1068$(sort $(vmlinux-deps)): $(vmlinux-dirs) ;
1069
1070# Handle descending into subdirectories listed in $(vmlinux-dirs)
1071# Preset locale variables to speed up the build process. Limit locale
1072# tweaks to this spot to avoid wrong language settings when running
1073# make menuconfig etc.

--- 109 unchanged lines hidden (view full) ---

1183 $(srctree)/scripts/headerdep.pl -I$(srctree)/include
1184
1185# ---------------------------------------------------------------------------
1186# Kernel headers
1187
1188#Default location for installed headers
1189export INSTALL_HDR_PATH = $(objtree)/usr
1190
1184# If we do an all arch process set dst to include/arch-$(SRCARCH)
1185hdr-dst = $(if $(KBUILD_HEADERS), dst=include/arch-$(SRCARCH), dst=include)
1191quiet_cmd_headers_install = INSTALL $(INSTALL_HDR_PATH)/include
1192 cmd_headers_install = \
1193 mkdir -p $(INSTALL_HDR_PATH); \
1194 rsync -mrl --include='*/' --include='*\.h' --exclude='*' \
1195 usr/include $(INSTALL_HDR_PATH)
1186
1196
1197PHONY += headers_install
1198headers_install: headers
1199 $(call cmd,headers_install)
1200
1187PHONY += archheaders archscripts
1188
1201PHONY += archheaders archscripts
1202
1189PHONY += __headers
1190__headers: $(version_h) scripts_basic uapi-asm-generic archheaders archscripts
1191 $(Q)$(MAKE) $(build)=scripts build_unifdef
1203hdr-inst := -f $(srctree)/scripts/Makefile.headersinst obj
1192
1204
1193PHONY += headers_install_all
1194headers_install_all:
1195 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/headers.sh install
1196
1197PHONY += headers_install
1198headers_install: __headers
1205PHONY += headers
1206headers: $(version_h) scripts_unifdef uapi-asm-generic archheaders archscripts
1199 $(if $(wildcard $(srctree)/arch/$(SRCARCH)/include/uapi/asm/Kbuild),, \
1200 $(error Headers not exportable for the $(SRCARCH) architecture))
1207 $(if $(wildcard $(srctree)/arch/$(SRCARCH)/include/uapi/asm/Kbuild),, \
1208 $(error Headers not exportable for the $(SRCARCH) architecture))
1201 $(Q)$(MAKE) $(hdr-inst)=include/uapi dst=include
1202 $(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapi $(hdr-dst)
1209 $(Q)$(MAKE) $(hdr-inst)=include/uapi
1210 $(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapi
1203
1211
1204PHONY += headers_check_all
1205headers_check_all: headers_install_all
1206 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/headers.sh check
1207
1208PHONY += headers_check
1212PHONY += headers_check
1209headers_check: headers_install
1210 $(Q)$(MAKE) $(hdr-inst)=include/uapi dst=include HDRCHECK=1
1211 $(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapi $(hdr-dst) HDRCHECK=1
1213headers_check: headers
1214 $(Q)$(MAKE) $(hdr-inst)=include/uapi HDRCHECK=1
1215 $(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapi HDRCHECK=1
1212
1216
1217ifdef CONFIG_HEADERS_INSTALL
1218prepare: headers
1219endif
1220
1213ifdef CONFIG_HEADERS_CHECK
1214all: headers_check
1215endif
1216
1221ifdef CONFIG_HEADERS_CHECK
1222all: headers_check
1223endif
1224
1225PHONY += scripts_unifdef
1226scripts_unifdef: scripts_basic
1227 $(Q)$(MAKE) $(build)=scripts scripts/unifdef
1228
1217# ---------------------------------------------------------------------------
1218# Kernel selftest
1219
1220PHONY += kselftest
1221kselftest:
1222 $(Q)$(MAKE) -C $(srctree)/tools/testing/selftests run_tests
1223
1224PHONY += kselftest-clean

--- 53 unchanged lines hidden (view full) ---

1278
1279# Build modules
1280#
1281# A module can be listed more than once in obj-m resulting in
1282# duplicate lines in modules.order files. Those are removed
1283# using awk while concatenating to the final file.
1284
1285PHONY += modules
1229# ---------------------------------------------------------------------------
1230# Kernel selftest
1231
1232PHONY += kselftest
1233kselftest:
1234 $(Q)$(MAKE) -C $(srctree)/tools/testing/selftests run_tests
1235
1236PHONY += kselftest-clean

--- 53 unchanged lines hidden (view full) ---

1290
1291# Build modules
1292#
1293# A module can be listed more than once in obj-m resulting in
1294# duplicate lines in modules.order files. Those are removed
1295# using awk while concatenating to the final file.
1296
1297PHONY += modules
1286modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) modules.builtin
1287 $(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.order) > $(objtree)/modules.order
1298modules: $(if $(KBUILD_BUILTIN),vmlinux) modules.order modules.builtin
1288 @$(kecho) ' Building modules, stage 2.';
1289 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
1290 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/modules-check.sh
1291
1299 @$(kecho) ' Building modules, stage 2.';
1300 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
1301 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/modules-check.sh
1302
1292modules.builtin: $(vmlinux-dirs:%=%/modules.builtin)
1293 $(Q)$(AWK) '!x[$$0]++' $^ > $(objtree)/modules.builtin
1303modules.order: $(vmlinux-dirs)
1304 $(Q)$(AWK) '!x[$$0]++' $(addsuffix /$@, $(vmlinux-dirs)) > $@
1294
1305
1295%/modules.builtin: include/config/auto.conf include/config/tristate.conf
1296 $(Q)$(MAKE) $(modbuiltin)=$*
1306modbuiltin-dirs := $(addprefix _modbuiltin_, $(vmlinux-dirs))
1297
1307
1308modules.builtin: $(modbuiltin-dirs)
1309 $(Q)$(AWK) '!x[$$0]++' $(addsuffix /$@, $(vmlinux-dirs)) > $@
1298
1310
1311PHONY += $(modbuiltin-dirs)
1312# tristate.conf is not included from this Makefile. Add it as a prerequisite
1313# here to make it self-healing in case somebody accidentally removes it.
1314$(modbuiltin-dirs): include/config/tristate.conf
1315 $(Q)$(MAKE) $(modbuiltin)=$(patsubst _modbuiltin_%,%,$@)
1316
1299# Target to prepare building external modules
1300PHONY += modules_prepare
1301modules_prepare: prepare
1302
1303# Target to install modules
1304PHONY += modules_install
1305modules_install: _modinst_ _modinst_post
1306

--- 48 unchanged lines hidden (view full) ---

1355# make mrproper Delete the current configuration, and all generated files
1356# make distclean Remove editor backup files, patch leftover files and the like
1357
1358# Directories & files removed with 'make clean'
1359CLEAN_DIRS += $(MODVERDIR) include/ksym
1360CLEAN_FILES += modules.builtin.modinfo
1361
1362# Directories & files removed with 'make mrproper'
1317# Target to prepare building external modules
1318PHONY += modules_prepare
1319modules_prepare: prepare
1320
1321# Target to install modules
1322PHONY += modules_install
1323modules_install: _modinst_ _modinst_post
1324

--- 48 unchanged lines hidden (view full) ---

1373# make mrproper Delete the current configuration, and all generated files
1374# make distclean Remove editor backup files, patch leftover files and the like
1375
1376# Directories & files removed with 'make clean'
1377CLEAN_DIRS += $(MODVERDIR) include/ksym
1378CLEAN_FILES += modules.builtin.modinfo
1379
1380# Directories & files removed with 'make mrproper'
1363MRPROPER_DIRS += include/config usr/include include/generated \
1381MRPROPER_DIRS += include/config include/generated \
1364 arch/$(SRCARCH)/include/generated .tmp_objdiff
1365MRPROPER_FILES += .config .config.old .version \
1366 Module.symvers tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS \
1367 signing_key.pem signing_key.priv signing_key.x509 \
1368 x509.genkey extra_certificates signing_key.x509.keyid \
1369 signing_key.x509.signer vmlinux-gdb.py
1370
1371# clean - Delete most, but leave enough to build external modules

--- 174 unchanged lines hidden (view full) ---

1546PHONY += $(DOC_TARGETS)
1547$(DOC_TARGETS): scripts_basic FORCE
1548 $(Q)$(MAKE) $(build)=Documentation $@
1549
1550# Misc
1551# ---------------------------------------------------------------------------
1552
1553PHONY += scripts_gdb
1382 arch/$(SRCARCH)/include/generated .tmp_objdiff
1383MRPROPER_FILES += .config .config.old .version \
1384 Module.symvers tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS \
1385 signing_key.pem signing_key.priv signing_key.x509 \
1386 x509.genkey extra_certificates signing_key.x509.keyid \
1387 signing_key.x509.signer vmlinux-gdb.py
1388
1389# clean - Delete most, but leave enough to build external modules

--- 174 unchanged lines hidden (view full) ---

1564PHONY += $(DOC_TARGETS)
1565$(DOC_TARGETS): scripts_basic FORCE
1566 $(Q)$(MAKE) $(build)=Documentation $@
1567
1568# Misc
1569# ---------------------------------------------------------------------------
1570
1571PHONY += scripts_gdb
1554scripts_gdb: prepare
1572scripts_gdb: prepare0
1555 $(Q)$(MAKE) $(build)=scripts/gdb
1556 $(Q)ln -fsn $(abspath $(srctree)/scripts/gdb/vmlinux-gdb.py)
1557
1558ifdef CONFIG_GDB_SCRIPTS
1559all: scripts_gdb
1560endif
1561
1562else # KBUILD_EXTMOD

--- 77 unchanged lines hidden (view full) ---

1640 $(call cmd,rmfiles)
1641 @find $(if $(KBUILD_EXTMOD), $(KBUILD_EXTMOD), .) $(RCS_FIND_IGNORE) \
1642 \( -name '*.[aios]' -o -name '*.ko' -o -name '.*.cmd' \
1643 -o -name '*.ko.*' \
1644 -o -name '*.dtb' -o -name '*.dtb.S' -o -name '*.dt.yaml' \
1645 -o -name '*.dwo' -o -name '*.lst' \
1646 -o -name '*.su' \
1647 -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
1573 $(Q)$(MAKE) $(build)=scripts/gdb
1574 $(Q)ln -fsn $(abspath $(srctree)/scripts/gdb/vmlinux-gdb.py)
1575
1576ifdef CONFIG_GDB_SCRIPTS
1577all: scripts_gdb
1578endif
1579
1580else # KBUILD_EXTMOD

--- 77 unchanged lines hidden (view full) ---

1658 $(call cmd,rmfiles)
1659 @find $(if $(KBUILD_EXTMOD), $(KBUILD_EXTMOD), .) $(RCS_FIND_IGNORE) \
1660 \( -name '*.[aios]' -o -name '*.ko' -o -name '.*.cmd' \
1661 -o -name '*.ko.*' \
1662 -o -name '*.dtb' -o -name '*.dtb.S' -o -name '*.dt.yaml' \
1663 -o -name '*.dwo' -o -name '*.lst' \
1664 -o -name '*.su' \
1665 -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
1666 -o -name '*.hdrtest.c' \
1648 -o -name '*.lex.c' -o -name '*.tab.[ch]' \
1649 -o -name '*.asn1.[ch]' \
1650 -o -name '*.symtypes' -o -name 'modules.order' \
1651 -o -name modules.builtin -o -name '.tmp_*.o.*' \
1652 -o -name '*.c.[012]*.*' \
1653 -o -name '*.ll' \
1654 -o -name '*.gcno' \) -type f -print | xargs rm -f
1655

--- 94 unchanged lines hidden (view full) ---

1750 $(Q)$(MAKE) $(build)=$(build-dir) $(build-target)
1751%.ko: %.o
1752 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
1753
1754# Modules
1755PHONY += /
1756/: ./
1757
1667 -o -name '*.lex.c' -o -name '*.tab.[ch]' \
1668 -o -name '*.asn1.[ch]' \
1669 -o -name '*.symtypes' -o -name 'modules.order' \
1670 -o -name modules.builtin -o -name '.tmp_*.o.*' \
1671 -o -name '*.c.[012]*.*' \
1672 -o -name '*.ll' \
1673 -o -name '*.gcno' \) -type f -print | xargs rm -f
1674

--- 94 unchanged lines hidden (view full) ---

1769 $(Q)$(MAKE) $(build)=$(build-dir) $(build-target)
1770%.ko: %.o
1771 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
1772
1773# Modules
1774PHONY += /
1775/: ./
1776
1758# Make sure the latest headers are built for Documentation
1759Documentation/ samples/: headers_install
1760%/: prepare FORCE
1761 $(Q)$(MAKE) KBUILD_MODULES=1 $(build)=$(build-dir)
1762
1763# FIXME Should go into a make.lib or something
1764# ===========================================================================
1765
1766quiet_cmd_rmdirs = $(if $(wildcard $(rm-dirs)),CLEAN $(wildcard $(rm-dirs)))
1767 cmd_rmdirs = rm -rf $(rm-dirs)

--- 29 unchanged lines hidden ---
1777%/: prepare FORCE
1778 $(Q)$(MAKE) KBUILD_MODULES=1 $(build)=$(build-dir)
1779
1780# FIXME Should go into a make.lib or something
1781# ===========================================================================
1782
1783quiet_cmd_rmdirs = $(if $(wildcard $(rm-dirs)),CLEAN $(wildcard $(rm-dirs)))
1784 cmd_rmdirs = rm -rf $(rm-dirs)

--- 29 unchanged lines hidden ---