ipq40xx: only include ath10k-board-qca4019 for the generic subtarget
[openwrt/staging/chunkeey.git] / Makefile
1 # SPDX-License-Identifier: GPL-2.0-only
2 #
3 # Copyright (C) 2007 OpenWrt.org
4
5 TOPDIR:=${CURDIR}
6 LC_ALL:=C
7 LANG:=C
8 TZ:=UTC
9 export TOPDIR LC_ALL LANG TZ
10
11 empty:=
12 space:= $(empty) $(empty)
13 $(if $(findstring $(space),$(TOPDIR)),$(error ERROR: The path to the OpenWrt directory must not include any spaces))
14
15 world:
16
17 DISTRO_PKG_CONFIG:=$(shell $(TOPDIR)/scripts/command_all.sh pkg-config | grep -E '\/usr' | head -n 1)
18 export PATH:=$(TOPDIR)/staging_dir/host/bin:$(PATH)
19
20 ifneq ($(OPENWRT_BUILD),1)
21 _SINGLE=export MAKEFLAGS=$(space);
22
23 override OPENWRT_BUILD=1
24 export OPENWRT_BUILD
25 GREP_OPTIONS=
26 export GREP_OPTIONS
27 CDPATH=
28 export CDPATH
29 include $(TOPDIR)/include/debug.mk
30 include $(TOPDIR)/include/depends.mk
31 include $(TOPDIR)/include/toplevel.mk
32 else
33 include rules.mk
34 include $(INCLUDE_DIR)/depends.mk
35 include $(INCLUDE_DIR)/subdir.mk
36 include target/Makefile
37 include package/Makefile
38 include tools/Makefile
39 include toolchain/Makefile
40
41 $(toolchain/stamp-compile): $(tools/stamp-compile) $(if $(CONFIG_BUILDBOT),toolchain_rebuild_check)
42 $(target/stamp-compile): $(toolchain/stamp-compile) $(tools/stamp-compile) $(BUILD_DIR)/.prepared
43 $(package/stamp-compile): $(target/stamp-compile) $(package/stamp-cleanup)
44 $(package/stamp-install): $(package/stamp-compile)
45 $(target/stamp-install): $(package/stamp-compile) $(package/stamp-install)
46 check: $(tools/stamp-check) $(toolchain/stamp-check) $(package/stamp-check)
47
48 printdb:
49 @true
50
51 prepare: $(target/stamp-compile)
52
53 _clean: FORCE
54 rm -rf $(BUILD_DIR) $(STAGING_DIR) $(BIN_DIR) $(OUTPUT_DIR)/packages/$(ARCH_PACKAGES) $(TOPDIR)/staging_dir/packages
55
56 clean: _clean
57 rm -rf $(BUILD_LOG_DIR)
58
59 targetclean: _clean
60 rm -rf $(TOOLCHAIN_DIR) $(BUILD_DIR_BASE)/hostpkg $(BUILD_DIR_TOOLCHAIN)
61
62 dirclean: targetclean clean
63 rm -rf $(STAGING_DIR_HOST) $(STAGING_DIR_HOSTPKG) $(BUILD_DIR_BASE)/host
64 rm -rf $(TMP_DIR)
65 $(MAKE) -C $(TOPDIR)/scripts/config clean
66
67 toolchain_rebuild_check:
68 $(SCRIPT_DIR)/check-toolchain-clean.sh
69
70 cacheclean:
71 ifneq ($(CONFIG_CCACHE),)
72 $(STAGING_DIR_HOST)/bin/ccache -C
73 endif
74
75 ifndef DUMP_TARGET_DB
76 $(BUILD_DIR)/.prepared: Makefile
77 @mkdir -p $$(dirname $@)
78 @touch $@
79
80 tmp/.prereq_packages: .config
81 unset ERROR; \
82 for package in $(sort $(prereq-y) $(prereq-m)); do \
83 $(_SINGLE)$(NO_TRACE_MAKE) -s -r -C package/$$package prereq || ERROR=1; \
84 done; \
85 if [ -n "$$ERROR" ]; then \
86 echo "Package prerequisite check failed."; \
87 false; \
88 fi
89 touch $@
90 endif
91
92 # check prerequisites before starting to build
93 prereq: $(target/stamp-prereq) tmp/.prereq_packages
94 @if [ ! -f "$(INCLUDE_DIR)/site/$(ARCH)" ]; then \
95 echo 'ERROR: Missing site config for architecture "$(ARCH)" !'; \
96 echo ' The missing file will cause configure scripts to fail during compilation.'; \
97 echo ' Please provide a "$(INCLUDE_DIR)/site/$(ARCH)" file and restart the build.'; \
98 exit 1; \
99 fi
100
101 $(BIN_DIR)/profiles.json: FORCE
102 $(if $(CONFIG_JSON_OVERVIEW_IMAGE_INFO), \
103 WORK_DIR=$(BUILD_DIR)/json_info_files \
104 $(SCRIPT_DIR)/json_overview_image_info.py $@ \
105 )
106
107 json_overview_image_info: $(BIN_DIR)/profiles.json
108
109 checksum: FORCE
110 $(call sha256sums,$(BIN_DIR),$(CONFIG_BUILDBOT))
111
112 buildversion: FORCE
113 $(SCRIPT_DIR)/getver.sh > $(BIN_DIR)/version.buildinfo
114
115 feedsversion: FORCE
116 $(SCRIPT_DIR)/feeds list -fs > $(BIN_DIR)/feeds.buildinfo
117
118 diffconfig: FORCE
119 mkdir -p $(BIN_DIR)
120 $(SCRIPT_DIR)/diffconfig.sh > $(BIN_DIR)/config.buildinfo
121
122 buildinfo: FORCE
123 $(_SINGLE)$(SUBMAKE) -r diffconfig buildversion feedsversion
124
125 prepare: .config $(tools/stamp-compile) $(toolchain/stamp-compile)
126 $(_SINGLE)$(SUBMAKE) -r buildinfo
127
128 world: prepare $(target/stamp-compile) $(package/stamp-compile) $(package/stamp-install) $(target/stamp-install) FORCE
129 $(_SINGLE)$(SUBMAKE) -r package/index
130 $(_SINGLE)$(SUBMAKE) -r json_overview_image_info
131 $(_SINGLE)$(SUBMAKE) -r checksum
132 ifneq ($(CONFIG_CCACHE),)
133 $(STAGING_DIR_HOST)/bin/ccache -s
134 endif
135
136 .PHONY: clean dirclean prereq prepare world package/symlinks package/symlinks-install package/symlinks-clean
137
138 endif