nftables: fix parsing date expressions
[openwrt/openwrt.git] / rules.mk
1 # SPDX-License-Identifier: GPL-2.0-only
2 #
3 # Copyright (C) 2006-2010 OpenWrt.org
4 # Copyright (C) 2016 LEDE Project
5
6 ifneq ($(__rules_inc),1)
7 __rules_inc=1
8
9 ifeq ($(DUMP),)
10 -include $(TOPDIR)/.config
11 endif
12 include $(TOPDIR)/include/debug.mk
13 include $(TOPDIR)/include/verbose.mk
14
15 ifneq ($(filter check,$(MAKECMDGOALS)),)
16 CHECK:=1
17 DUMP:=1
18 endif
19
20 export TMP_DIR:=$(TOPDIR)/tmp
21 export TMPDIR:=$(TMP_DIR)
22
23 qstrip=$(strip $(subst ",,$(1)))
24 #"))
25
26 empty:=
27 space:= $(empty) $(empty)
28 comma:=,
29 merge=$(subst $(space),,$(1))
30 confvar=$(shell echo '$(foreach v,$(1),$(v)=$(subst ','\'',$($(v))))' | $(MKHASH) md5)
31 strip_last=$(patsubst %.$(lastword $(subst .,$(space),$(1))),%,$(1))
32
33 paren_left = (
34 paren_right = )
35 chars_lower = a b c d e f g h i j k l m n o p q r s t u v w x y z
36 chars_upper = A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
37
38 define sep
39
40 endef
41
42 define newline
43
44
45 endef
46
47 __tr_list = $(join $(join $(1),$(foreach char,$(1),$(comma))),$(2))
48 __tr_head_stripped = $(subst $(space),,$(foreach cv,$(call __tr_list,$(1),$(2)),$$$(paren_left)subst$(cv)$(comma)))
49 __tr_head = $(subst $(paren_left)subst,$(paren_left)subst$(space),$(__tr_head_stripped))
50 __tr_tail = $(subst $(space),,$(foreach cv,$(1),$(paren_right)))
51 __tr_template = $(__tr_head)$$(1)$(__tr_tail)
52
53 $(eval toupper = $(call __tr_template,$(chars_lower),$(chars_upper)))
54 $(eval tolower = $(call __tr_template,$(chars_upper),$(chars_lower)))
55
56 version_abbrev = $(if $(if $(CHECK),,$(DUMP)),$(1),$(shell printf '%.8s' $(1)))
57
58 _SINGLE=export MAKEFLAGS=$(space);
59 CFLAGS:=
60 ARCH:=$(subst i486,i386,$(subst i586,i386,$(subst i686,i386,$(call qstrip,$(CONFIG_ARCH)))))
61 ARCH_PACKAGES:=$(call qstrip,$(CONFIG_TARGET_ARCH_PACKAGES))
62 BOARD:=$(call qstrip,$(CONFIG_TARGET_BOARD))
63 SUBTARGET:=$(call qstrip,$(CONFIG_TARGET_SUBTARGET))
64 TARGET_OPTIMIZATION:=$(call qstrip,$(CONFIG_TARGET_OPTIMIZATION))
65 TARGET_SUFFIX=$(call qstrip,$(CONFIG_TARGET_SUFFIX))
66 BUILD_SUFFIX:=$(call qstrip,$(CONFIG_BUILD_SUFFIX))
67 SUBDIR:=$(patsubst $(TOPDIR)/%,%,${CURDIR})
68 BUILD_SUBDIR:=$(patsubst $(TOPDIR)/%,%,${CURDIR})
69 NPROC:=$(shell sysctl -n hw.ncpu 2>/dev/null || nproc)
70 export SHELL:=/usr/bin/env bash
71
72 IS_PACKAGE_BUILD := $(if $(filter package/%,$(BUILD_SUBDIR)),1)
73
74 OPTIMIZE_FOR_CPU=$(subst i386,i486,$(ARCH))
75
76 ifneq (,$(findstring $(ARCH) , aarch64 aarch64_be powerpc ))
77 FPIC:=-DPIC -fPIC
78 else
79 FPIC:=-DPIC -fpic
80 endif
81
82 HOST_FPIC:=-DPIC -fPIC
83
84 ARCH_SUFFIX:=$(call qstrip,$(CONFIG_CPU_TYPE))
85 GCC_ARCH:=
86
87 ifneq ($(ARCH_SUFFIX),)
88 ARCH_SUFFIX:=_$(ARCH_SUFFIX)
89 endif
90 ifneq ($(filter -march=armv%,$(TARGET_OPTIMIZATION)),)
91 GCC_ARCH:=$(patsubst -march=%,%,$(filter -march=armv%,$(TARGET_OPTIMIZATION)))
92 endif
93 ifdef CONFIG_HAS_SPE_FPU
94 TARGET_SUFFIX:=$(TARGET_SUFFIX)spe
95 endif
96 ifdef CONFIG_MIPS64_ABI
97 ifneq ($(CONFIG_MIPS64_ABI_O32),y)
98 ARCH_SUFFIX:=$(ARCH_SUFFIX)_$(call qstrip,$(CONFIG_MIPS64_ABI))
99 endif
100 endif
101
102 DEFAULT_SUBDIR_TARGETS:=clean download prepare compile update refresh prereq dist distcheck configure check check-depends
103
104 define DefaultTargets
105 $(foreach t,$(DEFAULT_SUBDIR_TARGETS) $(1),
106 .$(t):
107 $(t): .$(t)
108 .PHONY: $(t) .$(t)
109 )
110 endef
111
112 DL_DIR:=$(if $(call qstrip,$(CONFIG_DOWNLOAD_FOLDER)),$(call qstrip,$(CONFIG_DOWNLOAD_FOLDER)),$(TOPDIR)/dl)
113 OUTPUT_DIR:=$(if $(call qstrip,$(CONFIG_BINARY_FOLDER)),$(call qstrip,$(CONFIG_BINARY_FOLDER)),$(TOPDIR)/bin)
114 BIN_DIR:=$(OUTPUT_DIR)/targets/$(BOARD)/$(SUBTARGET)
115 INCLUDE_DIR:=$(TOPDIR)/include
116 SCRIPT_DIR:=$(TOPDIR)/scripts
117 BUILD_DIR_BASE:=$(TOPDIR)/build_dir
118 ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
119 GCCV:=$(call qstrip,$(CONFIG_GCC_VERSION))
120 LIBC:=$(call qstrip,$(CONFIG_LIBC))
121 REAL_GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-openwrt-linux$(if $(TARGET_SUFFIX),-$(TARGET_SUFFIX))
122 GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-openwrt-linux
123 DIR_SUFFIX:=_$(LIBC)$(if $(CONFIG_arm),_eabi)
124 BIN_DIR:=$(BIN_DIR)$(if $(CONFIG_USE_MUSL),,-$(LIBC))
125 TARGET_DIR_NAME = target-$(ARCH)$(ARCH_SUFFIX)$(DIR_SUFFIX)$(if $(BUILD_SUFFIX),_$(BUILD_SUFFIX))
126 TOOLCHAIN_DIR_NAME = toolchain-$(ARCH)$(ARCH_SUFFIX)_gcc-$(GCCV)$(DIR_SUFFIX)
127 else
128 ifeq ($(CONFIG_NATIVE_TOOLCHAIN),)
129 GNU_TARGET_NAME=$(call qstrip,$(CONFIG_TARGET_NAME))
130 else
131 GNU_TARGET_NAME=$(shell gcc -dumpmachine)
132 endif
133 REAL_GNU_TARGET_NAME=$(GNU_TARGET_NAME)
134 LIBC:=$(call qstrip,$(CONFIG_LIBC))
135 TARGET_DIR_NAME:=target-$(GNU_TARGET_NAME)_$(LIBC)$(if $(BUILD_SUFFIX),_$(BUILD_SUFFIX))
136 TOOLCHAIN_DIR_NAME:=toolchain-$(GNU_TARGET_NAME)
137 endif
138
139 ifeq ($(or $(CONFIG_EXTERNAL_TOOLCHAIN),$(CONFIG_TARGET_uml)),)
140 iremap = -f$(if $(CONFIG_REPRODUCIBLE_DEBUG_INFO),file,macro)-prefix-map=$(1)=$(2)
141 endif
142
143 PACKAGE_DIR:=$(BIN_DIR)/packages
144 PACKAGE_DIR_ALL:=$(TOPDIR)/staging_dir/packages/$(BOARD)
145 BUILD_DIR:=$(BUILD_DIR_BASE)/$(TARGET_DIR_NAME)
146 STAGING_DIR:=$(TOPDIR)/staging_dir/$(TARGET_DIR_NAME)
147 BUILD_DIR_TOOLCHAIN:=$(BUILD_DIR_BASE)/$(TOOLCHAIN_DIR_NAME)
148 TOOLCHAIN_DIR:=$(TOPDIR)/staging_dir/$(TOOLCHAIN_DIR_NAME)
149 STAMP_DIR:=$(BUILD_DIR)/stamp
150 STAMP_DIR_HOST=$(BUILD_DIR_HOST)/stamp
151 TARGET_ROOTFS_DIR?=$(if $(call qstrip,$(CONFIG_TARGET_ROOTFS_DIR)),$(call qstrip,$(CONFIG_TARGET_ROOTFS_DIR)),$(BUILD_DIR))
152 TARGET_DIR:=$(TARGET_ROOTFS_DIR)/root-$(BOARD)
153 STAGING_DIR_ROOT:=$(STAGING_DIR)/root-$(BOARD)
154 STAGING_DIR_IMAGE:=$(STAGING_DIR)/image
155 BUILD_LOG_DIR:=$(if $(call qstrip,$(CONFIG_BUILD_LOG_DIR)),$(call qstrip,$(CONFIG_BUILD_LOG_DIR)),$(TOPDIR)/logs)
156 PKG_INFO_DIR := $(STAGING_DIR)/pkginfo
157
158 BUILD_DIR_HOST:=$(if $(IS_PACKAGE_BUILD),$(BUILD_DIR_BASE)/hostpkg,$(BUILD_DIR_BASE)/host)
159 STAGING_DIR_HOST:=$(TOPDIR)/staging_dir/host
160 STAGING_DIR_HOSTPKG:=$(TOPDIR)/staging_dir/hostpkg
161
162 TARGET_PATH:=$(subst $(space),:,$(filter-out .,$(filter-out ./,$(subst :,$(space),$(PATH)))))
163 TARGET_INIT_PATH:=$(call qstrip,$(CONFIG_TARGET_INIT_PATH))
164 TARGET_INIT_PATH:=$(if $(TARGET_INIT_PATH),$(TARGET_INIT_PATH),/usr/sbin:/sbin:/usr/bin:/bin)
165 TARGET_CFLAGS:=$(TARGET_OPTIMIZATION)$(if $(CONFIG_DEBUG), -g3) $(call qstrip,$(CONFIG_EXTRA_OPTIMIZATION))
166 TARGET_CXXFLAGS = $(TARGET_CFLAGS)
167 TARGET_ASFLAGS_DEFAULT = $(TARGET_CFLAGS)
168 TARGET_ASFLAGS = $(TARGET_ASFLAGS_DEFAULT)
169 ifneq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
170 LIBGCC_S_PATH=$(realpath $(wildcard $(call qstrip,$(CONFIG_LIBGCC_ROOT_DIR))/$(call qstrip,$(CONFIG_LIBGCC_FILE_SPEC))))
171 LIBGCC_S=$(if $(LIBGCC_S_PATH),-L$(dir $(LIBGCC_S_PATH)) -lgcc_s)
172 LIBGCC_A=$(realpath $(lastword $(wildcard $(dir $(LIBGCC_S_PATH))/gcc/*/*/libgcc.a)))
173 else
174 LIBGCC_A=$(lastword $(wildcard $(TOOLCHAIN_DIR)/lib/gcc/*/*/libgcc.a))
175 LIBGCC_S=$(if $(wildcard $(TOOLCHAIN_DIR)/lib/libgcc_s.so),-L$(TOOLCHAIN_DIR)/lib -lgcc_s,$(LIBGCC_A))
176 endif
177
178 ifeq ($(CONFIG_ARCH_64BIT),y)
179 LIB_SUFFIX:=64
180 endif
181
182 ifndef DUMP
183 ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
184 -include $(TOOLCHAIN_DIR)/info.mk
185 export GCC_HONOUR_COPTS:=0
186 TARGET_CROSS:=$(if $(TARGET_CROSS),$(TARGET_CROSS),$(OPTIMIZE_FOR_CPU)-openwrt-linux$(if $(TARGET_SUFFIX),-$(TARGET_SUFFIX))-)
187 TARGET_CFLAGS+= -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result
188 TARGET_CPPFLAGS+= -I$(TOOLCHAIN_DIR)/usr/include
189 ifeq ($(CONFIG_USE_MUSL),y)
190 TARGET_CPPFLAGS+= -I$(TOOLCHAIN_DIR)/include/fortify
191 endif
192 TARGET_CPPFLAGS+= -I$(TOOLCHAIN_DIR)/include
193 TARGET_LDFLAGS+= -L$(TOOLCHAIN_DIR)/usr/lib -L$(TOOLCHAIN_DIR)/lib
194 TARGET_PATH:=$(TOOLCHAIN_DIR)/bin:$(TARGET_PATH)
195 else
196 ifeq ($(CONFIG_NATIVE_TOOLCHAIN),)
197 TARGET_CROSS:=$(call qstrip,$(CONFIG_TOOLCHAIN_PREFIX))
198 TOOLCHAIN_ROOT_DIR:=$(call qstrip,$(CONFIG_TOOLCHAIN_ROOT))
199 TOOLCHAIN_BIN_DIRS:=$(patsubst ./%,$(TOOLCHAIN_ROOT_DIR)/%,$(call qstrip,$(CONFIG_TOOLCHAIN_BIN_PATH)))
200 TOOLCHAIN_INC_DIRS:=$(patsubst ./%,$(TOOLCHAIN_ROOT_DIR)/%,$(call qstrip,$(CONFIG_TOOLCHAIN_INC_PATH)))
201 TOOLCHAIN_LIB_DIRS:=$(patsubst ./%,$(TOOLCHAIN_ROOT_DIR)/%,$(call qstrip,$(CONFIG_TOOLCHAIN_LIB_PATH)))
202 ifneq ($(TOOLCHAIN_BIN_DIRS),)
203 TARGET_PATH:=$(subst $(space),:,$(TOOLCHAIN_BIN_DIRS)):$(TARGET_PATH)
204 endif
205 ifneq ($(TOOLCHAIN_INC_DIRS),)
206 TARGET_CPPFLAGS+= $(patsubst %,-I%,$(TOOLCHAIN_INC_DIRS))
207 endif
208 ifneq ($(TOOLCHAIN_LIB_DIRS),)
209 TARGET_LDFLAGS+= $(patsubst %,-L%,$(TOOLCHAIN_LIB_DIRS))
210 endif
211 endif
212 endif
213 endif
214 TARGET_PATH_PKG:=$(STAGING_DIR)/host/bin:$(STAGING_DIR_HOSTPKG)/bin:$(TARGET_PATH)
215
216 ifeq ($(CONFIG_SOFT_FLOAT),y)
217 SOFT_FLOAT_CONFIG_OPTION:=--with-float=soft
218 ifeq ($(CONFIG_arm),y)
219 TARGET_CFLAGS+= -mfloat-abi=soft
220 else
221 TARGET_CFLAGS+= -msoft-float
222 endif
223 else
224 SOFT_FLOAT_CONFIG_OPTION:=
225 ifeq ($(CONFIG_arm),y)
226 TARGET_CFLAGS+= -mfloat-abi=hard
227 endif
228 endif
229
230 export PATH:=$(TARGET_PATH)
231 export STAGING_DIR STAGING_DIR_HOST STAGING_DIR_HOSTPKG
232 export SH_FUNC:=. $(INCLUDE_DIR)/shell.sh;
233
234 PKG_CONFIG:=$(STAGING_DIR_HOST)/bin/pkg-config
235
236 export PKG_CONFIG
237
238 HOSTCC:=gcc
239 HOSTCXX:=g++
240 HOST_CPPFLAGS:=-I$(STAGING_DIR_HOST)/include $(if $(IS_PACKAGE_BUILD),-I$(STAGING_DIR_HOSTPKG)/include -I$(STAGING_DIR)/host/include)
241 HOST_CXXFLAGS:=
242 HOST_CFLAGS:=-O2 $(HOST_CPPFLAGS)
243 HOST_LDFLAGS:=-L$(STAGING_DIR_HOST)/lib $(if $(IS_PACKAGE_BUILD),-L$(STAGING_DIR_HOSTPKG)/lib -L$(STAGING_DIR)/host/lib)
244
245 BUILD_KEY=$(TOPDIR)/key-build
246
247 FAKEROOT:=$(STAGING_DIR_HOST)/bin/fakeroot
248
249 TARGET_AR:=$(TARGET_CROSS)gcc-ar
250 TARGET_RANLIB:=$(TARGET_CROSS)gcc-ranlib
251 TARGET_NM:=$(TARGET_CROSS)gcc-nm
252 TARGET_CC:=$(TARGET_CROSS)gcc
253 TARGET_CXX:=$(TARGET_CROSS)g++
254 KPATCH:=$(SCRIPT_DIR)/patch-kernel.sh
255 SED:=$(STAGING_DIR_HOST)/bin/sed -i -e
256 ESED:=$(STAGING_DIR_HOST)/bin/sed -E -i -e
257 MKHASH:=$(STAGING_DIR_HOST)/bin/mkhash
258 # MKHASH is used in /scripts, so we export it here.
259 export MKHASH
260 CP:=cp -fpR
261 LN:=ln -sf
262 XARGS:=xargs -r
263
264 BASH:=bash
265 TAR:=tar
266 FIND:=find
267 PATCH:=patch
268 PYTHON:=python3
269
270 INSTALL_BIN:=install -m0755
271 INSTALL_SUID:=install -m4755
272 INSTALL_DIR:=install -d -m0755
273 INSTALL_DATA:=install -m0644
274 INSTALL_CONF:=install -m0600
275
276 TARGET_CC_NOCACHE:=$(TARGET_CC)
277 TARGET_CXX_NOCACHE:=$(TARGET_CXX)
278 HOSTCC_NOCACHE:=$(HOSTCC)
279 HOSTCXX_NOCACHE:=$(HOSTCXX)
280 export TARGET_CC_NOCACHE
281 export TARGET_CXX_NOCACHE
282 export HOSTCC_NOCACHE
283 export HOSTCXX_NOCACHE
284
285 ifneq ($(CONFIG_CCACHE),)
286 TARGET_CC:= ccache_cc
287 TARGET_CXX:= ccache_cxx
288 HOSTCC:= ccache $(HOSTCC)
289 HOSTCXX:= ccache $(HOSTCXX)
290 export CCACHE_BASEDIR:=$(TOPDIR)
291 export CCACHE_DIR:=$(if $(call qstrip,$(CONFIG_CCACHE_DIR)),$(call qstrip,$(CONFIG_CCACHE_DIR)),$(TOPDIR)/.ccache)
292 export CCACHE_COMPILERCHECK:=%compiler% -dumpmachine; %compiler% -dumpversion
293 endif
294
295 TARGET_CONFIGURE_OPTS = \
296 AR="$(TARGET_AR)" \
297 AS="$(TARGET_CC) -c $(TARGET_ASFLAGS)" \
298 LD=$(TARGET_CROSS)ld \
299 NM="$(TARGET_NM)" \
300 CC="$(TARGET_CC)" \
301 GCC="$(TARGET_CC)" \
302 CXX="$(TARGET_CXX)" \
303 RANLIB="$(TARGET_RANLIB)" \
304 STRIP=$(TARGET_CROSS)strip \
305 OBJCOPY=$(TARGET_CROSS)objcopy \
306 OBJDUMP=$(TARGET_CROSS)objdump \
307 SIZE=$(TARGET_CROSS)size
308
309 # strip an entire directory
310 ifneq ($(CONFIG_NO_STRIP),)
311 RSTRIP:=:
312 STRIP:=:
313 else
314 ifneq ($(CONFIG_USE_STRIP),)
315 STRIP:=$(TARGET_CROSS)strip $(call qstrip,$(CONFIG_STRIP_ARGS))
316 else
317 ifneq ($(CONFIG_USE_SSTRIP),)
318 STRIP:=$(STAGING_DIR_HOST)/bin/sstrip $(call qstrip,$(CONFIG_SSTRIP_ARGS))
319 endif
320 endif
321 RSTRIP= \
322 export CROSS="$(TARGET_CROSS)" \
323 $(if $(PKG_BUILD_ID),KEEP_BUILD_ID=1) \
324 $(if $(CONFIG_KERNEL_KALLSYMS),NO_RENAME=1) \
325 $(if $(CONFIG_KERNEL_PROFILING),KEEP_SYMBOLS=1); \
326 NM="$(TARGET_CROSS)nm" \
327 STRIP="$(STRIP)" \
328 STRIP_KMOD="$(SCRIPT_DIR)/strip-kmod.sh" \
329 PATCHELF="$(STAGING_DIR_HOST)/bin/patchelf" \
330 $(SCRIPT_DIR)/rstrip.sh
331 endif
332
333 NINJA = \
334 MAKEFLAGS="$(MAKE_JOBSERVER)" \
335 $(STAGING_DIR_HOST)/bin/ninja \
336 $(if $(findstring c,$(OPENWRT_VERBOSE)),-v) \
337 $(if $(MAKE_JOBSERVER),,-j1)
338
339 ifeq ($(CONFIG_IPV6),y)
340 DISABLE_IPV6:=
341 else
342 DISABLE_IPV6:=--disable-ipv6
343 endif
344
345 TAR_OPTIONS:=-xf -
346
347 ifeq ($(CONFIG_BUILD_LOG),y)
348 BUILD_LOG:=1
349 endif
350
351 export BISON_PKGDATADIR:=$(STAGING_DIR_HOST)/share/bison
352 export M4:=$(STAGING_DIR_HOST)/bin/m4
353
354 define shvar
355 V_$(subst .,_,$(subst -,_,$(subst /,_,$(1))))
356 endef
357
358 define shexport
359 export $(call shvar,$(1))=$$(call $(1))
360 endef
361
362 # Execute commands under flock
363 # $(1) => The shell expression.
364 # $(2) => The lock name. If not given, the global lock will be used.
365 ifneq ($(wildcard $(STAGING_DIR_HOST)/bin/flock),)
366 define locked
367 SHELL= \
368 flock \
369 $(TMP_DIR)/.$(if $(2),$(strip $(2)),global).flock \
370 -c '$(subst ','\'',$(1))'
371 endef
372 else
373 locked=$(1)
374 endif
375
376 # Recursively copy paths into another directory, purge dangling
377 # symlinks before.
378 # $(1) => File glob expression
379 # $(2) => Destination directory
380 define file_copy
381 for src_dir in $(sort $(foreach d,$(wildcard $(1)),$(dir $(d)))); do \
382 ( cd $$src_dir; find -type f -or -type d ) | \
383 ( cd $(2); while :; do \
384 read FILE; \
385 [ -z "$$FILE" ] && break; \
386 [ -L "$$FILE" ] || continue; \
387 echo "Removing symlink $(2)/$$FILE"; \
388 rm -f "$$FILE"; \
389 done; ); \
390 done; \
391 $(CP) $(1) $(2)
392 endef
393
394 # Calculate sha256sum of any plain file within a given directory
395 # $(1) => Input directory
396 # $(2) => If set, recurse into subdirectories
397 define sha256sums
398 (cd $(1); find . $(if $(2),,-maxdepth 1) -type f -not -name 'sha256sums' -printf "%P\n" | sort | \
399 xargs -r $(MKHASH) -n sha256 | sed -ne 's!^\(.*\) \(.*\)$$!\1 *\2!p' > sha256sums)
400 endef
401
402 # file extension
403 ext=$(word $(words $(subst ., ,$(1))),$(subst ., ,$(1)))
404
405 # Count Git commits of a package
406 # $(1) => if non-empty: count commits since last ": [uU]pdate to " or ": [bB]ump to " in commit message
407 define commitcount
408 $(shell \
409 if git log -1 >/dev/null 2>/dev/null; then \
410 if [ -n "$(1)" ]; then \
411 last_bump="$$(git log --pretty=format:'%h %s' . | \
412 grep --max-count=1 -e ': [uU]pdate to ' -e ': [bB]ump to ' | \
413 cut -f 1 -d ' ')"; \
414 fi; \
415 if [ -n "$$last_bump" ]; then \
416 echo -n $$(($$(git rev-list --count "$$last_bump..HEAD" .) + 1)); \
417 else \
418 git rev-list --count HEAD .; \
419 fi; \
420 else \
421 secs="$$(($(SOURCE_DATE_EPOCH) % 86400))"; \
422 date="$$(date --utc --date="@$(SOURCE_DATE_EPOCH)" "+%y%m%d")"; \
423 printf '%s.%05d' "$$date" "$$secs"; \
424 fi; \
425 )
426 endef
427
428 abi_version_str = $(subst -,,$(subst _,,$(subst .,,$(1))))
429
430 COMMITCOUNT = $(if $(DUMP),0,$(call commitcount))
431 AUTORELEASE = $(if $(DUMP),0,$(call commitcount,1))
432
433 all:
434 FORCE: ;
435 .PHONY: FORCE
436
437 check: FORCE
438 @true
439
440 val.%:
441 @$(if $(filter undefined,$(origin $*)),\
442 echo "$* undefined" >&2, \
443 echo '$(subst ','"'"',$($*))' \
444 )
445
446 var.%:
447 @$(if $(filter undefined,$(origin $*)),\
448 echo "$* undefined" >&2, \
449 echo "$*='"'$(subst ','"'\"'\"'"',$($*))'"'" \
450 )
451
452 endif #__rules_inc