Skip to content

Commit 8768ba0

Browse files
author
Jing Leng
committed
Improve the time statistics of the test app
1 parent 85a6333 commit 8768ba0

File tree

2 files changed

+127
-149
lines changed

2 files changed

+127
-149
lines changed

inc.makes

+25-7
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# https://github.com/lengjingzju/cbuild-ng #
66
############################################
77

8-
############# Date: 2024-01-31 #############
8+
############# Date: 2024-08-18 #############
99

1010
# The default behavior only includes inc.env.mk and inc.ins.mk.
1111
# INC_MAKES can be set to a combination of `disenv` `conf` `app` `mod` `disins`.
@@ -30,11 +30,13 @@ else
3030
PACKAGE_ID := $(PACKAGE_NAME)-native
3131
endif
3232

33-
ENV_OPTIMIZER ?= release
34-
ifeq ($(ENV_OPTIMIZER),debug)
33+
ENV_BUILD_TYPE ?= optimized
34+
ifeq ($(ENV_BUILD_TYPE),debug)
3535
OPTIMIZER_FLAG ?= -O0 -g -ggdb
36-
else ifeq ($(ENV_OPTIMIZER),speed)
36+
else ifeq ($(ENV_BUILD_TYPE),release)
3737
OPTIMIZER_FLAG ?= -O3
38+
else ifeq ($(ENV_BUILD_TYPE),minsize)
39+
OPTIMIZER_FLAG ?= -Os
3840
else
3941
OPTIMIZER_FLAG ?= -O2
4042
endif
@@ -151,6 +153,21 @@ endif
151153

152154
ifneq ($(ENV_BUILD_MODE),yocto)
153155

156+
define ft-config
157+
ifneq ($(NATIVE_BUILD),y)
158+
FT_CONFIG += $$(if $$(filter y,$$($1)),$2,$3)
159+
$(if $(filter y,$(CACHE_BUILD)),CACHE_APPENDS += $1=$$($1))
160+
else
161+
FT_CONFIG += $$(if $$(filter y,$$($1_NATIVE)),$2,$3)
162+
$(if $(filter y,$(CACHE_BUILD)),CACHE_APPENDS += $1_NATIVE=$$($1_NATIVE))
163+
endif
164+
endef
165+
166+
define FT-CONFIG
167+
FT_CONFIG += $$(if $$(filter y,$$($1)),$2,$3)
168+
$(if $(filter y,$(CACHE_BUILD)),CACHE_APPENDS += $1=$$($1))
169+
endef
170+
154171
PREPARE_SYSROOT := -s CROSS_DESTDIR=$(WORKDIR)/sysroot NATIVE_DESTDIR=$(WORKDIR)/sysroot-native \
155172
NATIVE_BUILD= INSTALL_OPTION=link -C $(ENV_TOP_DIR) $(PACKAGE_ID)_psysroot
156173

@@ -420,10 +437,11 @@ imake_cpflags += $(call link_hdrs)
420437
imake_ldflags += $(call link_libs)
421438

422439
imake_cpflags += $(OPTIMIZER_FLAG)
423-
imake_ldflags += -Wl,-O1
424-
ifeq ($(ENV_OPTIMIZER),release)
440+
ifneq ($(ENV_BUILD_TYPE),debug)
425441
imake_cpflags += -ffunction-sections -fdata-sections
426442
imake_ldflags += -Wl,--gc-sections
443+
else
444+
imake_ldflags += -Wl,-O1
427445
endif
428446
#imake_ldflags += -static
429447

@@ -503,7 +521,7 @@ imake_cpflags += $(IMAKE_CPFLAGS)
503521
imake_ldflags += $(IMAKE_LDFLAGS)
504522
prior_ldflags += $(PRIOR_LDFLAGS)
505523

506-
CHECK_INFO += ENV_OPTIMIZER=$(ENV_OPTIMIZER) \
524+
CHECK_INFO += ENV_BUILD_TYPE=$(ENV_BUILD_TYPE) \
507525
ENV_SECURITY=$(ENV_SECURITY) \
508526
ENV_SANITIZER=$(ENV_SANITIZER) \
509527
ENV_ANALYZER=$(ENV_ANALYZER) \

0 commit comments

Comments
 (0)