Compare commits
No commits in common. "10767638ca795513ef5a63c98cedba060958687a" and "b33b2a98aca87f1bdd53e4cf703c1f9ae533ea02" have entirely different histories.
10767638ca
...
b33b2a98ac
47
Makefile
47
Makefile
|
@ -54,37 +54,39 @@ PATH_PREFIX := /home/build/.local/bin:/home/build/$(CACHE_DIR)/bin:/home/build/$
|
||||||
PREFIX := $(HOME)/.local
|
PREFIX := $(HOME)/.local
|
||||||
XDG_CONFIG_HOME := $(HOME)/.config
|
XDG_CONFIG_HOME := $(HOME)/.config
|
||||||
|
|
||||||
# MacOS users do not have a 'date' command that supports milliseconds
|
|
||||||
# This is what we are forced to do. Other ideas welcome
|
|
||||||
define epochms
|
|
||||||
$$(python3 -c 'from time import time; print(int(round(time() * 1000)))')
|
|
||||||
endef
|
|
||||||
|
|
||||||
ifneq ($(TOOLCHAIN_PROFILE),false)
|
ifneq ($(TOOLCHAIN_PROFILE),false)
|
||||||
TOOLCHAIN_PROFILE_DIR := .toolchain/profiles
|
TOOLCHAIN_PROFILE_DIR := .toolchain/profiles
|
||||||
mkc := $(shell mkdir -p $(TOOLCHAIN_PROFILE_DIR))
|
mkc := $(shell mkdir -p $(TOOLCHAIN_PROFILE_DIR))
|
||||||
ifndef TOOLCHAIN_PROFILE_RUNNING
|
ifndef TOOLCHAIN_PROFILE_RUNNING
|
||||||
TOOLCHAIN_PROFILE_INIT := $(shell printf $(call epochms))
|
TOOLCHAIN_PROFILE_INIT := $(shell date +%s)
|
||||||
|
TOOLCHAIN_PROFILE_START := 0
|
||||||
|
TOOLCHAIN_PROFILE_TOTAL := 0
|
||||||
|
TOOLCHAIN_PROFILE_TRACKED := 0
|
||||||
|
TOOLCHAIN_PROFILE_UNTRACKED := 0
|
||||||
TOOLCHAIN_PROFILE_RUNNING := true
|
TOOLCHAIN_PROFILE_RUNNING := true
|
||||||
TOOLCHAIN_PROFILE_FILE := \
|
TOOLCHAIN_PROFILE_FILE := \
|
||||||
$(TOOLCHAIN_PROFILE_DIR)/$(HOSTNAME)-$(USERNAME)-$(HOST_OS)-$(HOST_ARCH).$(shell date -u -d @$$(($(TOOLCHAIN_PROFILE_INIT) / 1000)) +%Y%m%dT%H%M%S).csv
|
$(TOOLCHAIN_PROFILE_DIR)/$(HOSTNAME)-$(USERNAME)-$(HOST_OS)-$(HOST_ARCH).$(shell date -u -d @$(TOOLCHAIN_PROFILE_INIT) +%Y%m%dT%H%M%S).csv
|
||||||
endif
|
endif
|
||||||
|
|
||||||
.PHONY: toolchain-profile
|
.PHONY: toolchain-profile
|
||||||
toolchain-profile:
|
toolchain-profile:
|
||||||
$(call toolchain-profile-total)
|
$(call toolchain-profile-total)
|
||||||
|
$(call toolchain-profile-tracked)
|
||||||
|
$(call toolchain-profile-untracked)
|
||||||
|
@printf "unprofiled,%s\n" "$(TOOLCHAIN_PROFILE_UNTRACKED)" \
|
||||||
|
>> $(TOOLCHAIN_PROFILE_FILE)
|
||||||
|
@printf "total,%s\n" "$(TOOLCHAIN_PROFILE_TOTAL)" \
|
||||||
|
>> $(TOOLCHAIN_PROFILE_FILE)
|
||||||
@echo Build times:
|
@echo Build times:
|
||||||
@bash -c ' \
|
@bash -c ' \
|
||||||
while IFS=, read -r target ms_start ms_stop; do \
|
while IFS=, read -r target seconds; do \
|
||||||
ms_diff=$$(($$ms_stop - $$ms_start)); \
|
echo $$target,$$(date -u -d @$$seconds +%T); \
|
||||||
echo - $$target,$$(date -u -d @$$(( $$ms_diff / 1000 )) +%T); \
|
|
||||||
done < $(TOOLCHAIN_PROFILE_FILE)' \
|
done < $(TOOLCHAIN_PROFILE_FILE)' \
|
||||||
| column -c 80 -s, -t
|
| column -c 80 -s, -t
|
||||||
@echo "Total: $$(date -u -d @$$(( $(TOOLCHAIN_PROFILE_TOTAL) / 1000 )) +%T)";
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
define toolchain-profile-total
|
define toolchain-profile-total
|
||||||
$(eval TOOLCHAIN_PROFILE_TOTAL=$(shell expr $(call epochms) - $(TOOLCHAIN_PROFILE_INIT)) )
|
$(eval TOOLCHAIN_PROFILE_TOTAL=$(shell expr $(shell date +%s) - $(TOOLCHAIN_PROFILE_INIT)) )
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define toolchain-profile-tracked
|
define toolchain-profile-tracked
|
||||||
|
@ -96,17 +98,13 @@ define toolchain-profile-untracked
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define toolchain-profile-start
|
define toolchain-profile-start
|
||||||
printf "%s,$(call epochms),\n" "$@" >> $(TOOLCHAIN_PROFILE_FILE);
|
$(eval TOOLCHAIN_PROFILE_START=$(shell date +%s))
|
||||||
|
printf "%s," "$@" >> $(TOOLCHAIN_PROFILE_FILE)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define toolchain-profile-stop
|
define toolchain-profile-stop
|
||||||
tmpfile=$$(mktemp -q "$(TOOLCHAIN_PROFILE_DIR)/tmp.XXXXXXXXX") \
|
printf "%s\n" "$$(($$(date +%s)-$(TOOLCHAIN_PROFILE_START)))" \
|
||||||
&& cp $(TOOLCHAIN_PROFILE_FILE) $$tmpfile \
|
>> $(TOOLCHAIN_PROFILE_FILE)
|
||||||
&& awk \
|
|
||||||
-v ms="$(call epochms)" \
|
|
||||||
'/^$(@),/ {$$0=$$0ms} 1' \
|
|
||||||
$$tmpfile \
|
|
||||||
> $(TOOLCHAIN_PROFILE_FILE)
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
export
|
export
|
||||||
|
@ -152,7 +150,7 @@ toolchain-restore-mtime:
|
||||||
for d in $$(git ls-files | xargs -n 1 dirname | uniq); do \
|
for d in $$(git ls-files | xargs -n 1 dirname | uniq); do \
|
||||||
mkdir -p "$$d"; \
|
mkdir -p "$$d"; \
|
||||||
done; \
|
done; \
|
||||||
for f in $$((git ls-files --modified; git ls-files) | sort | uniq -u); do \
|
for f in $$(git ls-tree -r -t --full-name --name-only "HEAD"); do \
|
||||||
( test -f "$$f" || test -d "$$f" ) \
|
( test -f "$$f" || test -d "$$f" ) \
|
||||||
&& touch -t \
|
&& touch -t \
|
||||||
$$(git log \
|
$$(git log \
|
||||||
|
@ -409,10 +407,7 @@ define fetch_pgp_key
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define toolchain
|
define toolchain
|
||||||
( test -f $(CACHE_DIR_ROOT)/toolchain.state || { \
|
$(MAKE) toolchain \
|
||||||
echo "Error: toolchain.state not found. Check dependencies!"; \
|
|
||||||
exit 1; \
|
|
||||||
};) \
|
|
||||||
&& docker run \
|
&& docker run \
|
||||||
--rm \
|
--rm \
|
||||||
--tty \
|
--tty \
|
||||||
|
|
Loading…
Reference in New Issue