@@ -13,6 +13,14 @@ GIT_VERSION ?= $(shell git describe --long --abbrev=7)
13
13
ifndef GIT_VERSION
14
14
$(error GIT_VERSION is not set)
15
15
endif
16
+ export GIT_VERSION
17
+
18
+ # ## NOTES:
19
+ # ## SOURCE_DATE_EPOCH is used for reproducible builds
20
+ # ## for details consult https://reproducible-builds.org/docs/source-date-epoch/
21
+
22
+ SOURCE_DATE_EPOCH ?= $(shell git show -s --format=% ct HEAD || date +% s)
23
+ export SOURCE_DATE_EPOCH
16
24
17
25
# ## NOTES:
18
26
# ## to compile without jemalloc, set environment variable NOJEMALLOC=1
@@ -314,7 +322,7 @@ amd64-fedora: fedora40 fedora40-clang fedora40-dbg fedora41 fedora41-clang fedor
314
322
amd64-opensuse : opensuse15 opensuse15-clang opensuse15-dbg
315
323
amd64-ubuntu : ubuntu22 ubuntu22-clang ubuntu22-dbg ubuntu24 ubuntu24-clang ubuntu24-dbg
316
324
amd64-pkglist :
317
- @make -nk amd64-packages 2> /dev/null | grep -Po ' (?<=binaries/)proxysql\S+$$'
325
+ @${MAKE} -nk amd64-packages 2> /dev/null | grep -Po ' (?<=binaries/)proxysql\S+$$'
318
326
319
327
arm64-% : SYS_ARCH := aarch64
320
328
arm64-packages : arm64-centos arm64-debian arm64-ubuntu arm64-fedora arm64-opensuse arm64-almalinux
@@ -325,7 +333,7 @@ arm64-fedora: fedora40 fedora41
325
333
arm64-opensuse : opensuse15
326
334
arm64-ubuntu : ubuntu22 ubuntu24
327
335
arm64-pkglist :
328
- @make -nk arm64-packages 2> /dev/null | grep -Po ' (?<=binaries/)proxysql\S+$$'
336
+ @${MAKE} -nk arm64-packages 2> /dev/null | grep -Po ' (?<=binaries/)proxysql\S+$$'
329
337
330
338
almalinux% : build-almalinux% ;
331
339
centos% : build-centos% ;
@@ -339,24 +347,21 @@ ubuntu%: build-ubuntu% ;
339
347
.NOTPARALLEL : build-%
340
348
build-% : BLD_NAME=$(patsubst build-% ,% ,$@ )
341
349
build-% : PKG_VERS=$(if $(filter $(shell echo ${BLD_NAME} | grep -Po '[a-z]+') ,debian ubuntu) ,$(DEB_VERS ) ,$(RPM_VERS ) )
342
- build-% : PKG_TYPE=$(if $(filter $(shell echo $(BLD_NAME ) | grep -Po '\-de?bu?g') ,-dbg -debug) ,-dbg,)
350
+ build-% : PKG_TYPE=$(if $(filter $(shell echo $(BLD_NAME ) | grep -Po '\-de?bu?g|\-test|\-tap ') ,-dbg -debug -test -tap ) ,-dbg,)
343
351
build-% : PKG_NAME=$(firstword $(subst -, ,$(BLD_NAME ) ) )
344
352
build-% : PKG_COMP=$(if $(filter $(shell echo $(BLD_NAME ) | grep -Po '\-clang') ,-clang) ,-clang,)
345
353
build-% : PKG_ARCH=$(if $(filter $(shell echo ${BLD_NAME} | grep -Po '[a-z]+') ,debian ubuntu) ,$(DEB_ARCH ) ,$(RPM_ARCH ) )
346
354
build-% : PKG_KIND=$(if $(filter $(shell echo ${BLD_NAME} | grep -Po '[a-z]+') ,debian ubuntu) ,deb,rpm)
347
355
build-% : PKG_FILE=binaries/proxysql$(PKG_VERS )$(PKG_TYPE ) -$(PKG_NAME )$(PKG_COMP )$(PKG_ARCH ) .$(PKG_KIND )
348
356
build-% :
349
357
@echo ' building $@'
350
- @IMG_NAME=$(PKG_NAME ) IMG_TYPE=$(subst -,_,$(PKG_TYPE ) ) IMG_COMP=$(subst -,_,$(PKG_COMP ) ) $(MAKE ) $(PKG_FILE )
358
+ @IMG_NAME=$(PKG_NAME ) IMG_TYPE=$(subst -,_,$(PKG_TYPE ) ) IMG_COMP=$(subst -,_,$(PKG_COMP ) ) BLD_NAME= $( BLD_NAME ) $(MAKE ) $(PKG_FILE )
351
359
352
360
.NOTPARALLEL : binaries/proxysql%
353
361
binaries/proxysql% :
354
- cd deps && ${MAKE} cleanall
355
- cd lib && ${MAKE} clean
356
- cd src && ${MAKE} clean
357
- cd test/tap && ${MAKE} clean
358
- cd test/deps && ${MAKE} cleanall
359
- find . -not -path " ./binaries/*" -not -path " ./.git/*" -exec touch -h --date=@` git show -s --format=%ct HEAD` {} \;
362
+ ${MAKE} cleanbuild
363
+ ${MAKE} cleantest
364
+ find . -not -path " ./binaries/*" -not -path " ./.git/*" | xargs touch -h --date=@${SOURCE_DATE_EPOCH}
360
365
@docker compose -p " ${GIT_VERSION/ ./ } " down -v --remove-orphans
361
366
@docker compose -p " ${GIT_VERSION/ ./ } " up $(IMG_NAME )$(IMG_TYPE )$(IMG_COMP ) _build
362
367
@docker compose -p " ${GIT_VERSION/ ./ } " down -v --remove-orphans
@@ -383,23 +388,27 @@ cleandev:
383
388
cd lib && ${MAKE} clean
384
389
cd src && ${MAKE} clean
385
390
391
+ .PHONY : cleantest
392
+ cleantest :
393
+ cd test/tap && ${MAKE} clean
394
+ cd test/deps && ${MAKE} cleanall
395
+
386
396
.PHONY : cleanall
387
397
cleanall :
388
398
cd deps && ${MAKE} cleanall
389
399
cd lib && ${MAKE} clean
390
400
cd src && ${MAKE} clean
391
401
cd test/tap && ${MAKE} clean
392
402
cd test/deps && ${MAKE} cleanall
393
- rm -f binaries/* deb || true
394
- rm -f binaries/* rpm || true
395
- rm -f binaries/* id-hash || true
403
+ rm -f binaries/* || true
396
404
rm -rf pkgroot || true
397
405
398
406
.PHONY : cleanbuild
399
407
cleanbuild :
400
408
cd deps && ${MAKE} cleanall
401
409
cd lib && ${MAKE} clean
402
410
cd src && ${MAKE} clean
411
+ rm -rf pkgroot || true
403
412
404
413
405
414
# ## install targets
0 commit comments