nuttx-apps/Directory.mk
chao an 52353a7eb2 apps/build: Restore ARLOCK to improve compile speed in incremental case
To solve the issue of carrying object files from previous builds,
Matias changed the archiving process to re-archive libapps.a on every compilation,
if libapps.a carries more object files, incremental compilation will waste too
many time in re-archiving, compared with the previous implement, this is a degradation
of the build system.  Referring to mature engineering projects such as cmake, if there
is configuration or source file changed, the best solution should be to reconfigure
the environment.

Revert this PR to ensure the compilation speed during incremental compilation.

|  commit 18137c0fec
|  Author: Matias N <matias@protobits.dev>
|  Date:   Sat Sep 12 00:36:23 2020 -0300
|
|      Fix: ensure archive files do not carry object files from prior builds
|
|      This is the corresponding change to the one on main NuttX repo. In this
|      case this involves splitting the build of libapps.a into: a) building
|      all applications (which is safely parallelizable), b) adding each
|      application's object files to the archive in turns (serial by nature).
|
|      This removes the need for the flock used to protect the parallel build.

Testing:

sim:nsh
-------------------------------
|   Patched    |  Current
-------------------------------
|$ time make   |  $ time make
|real 0m1.270s |  real 0m1.728s
|user 0m0.971s |  user 0m1.276s
|sys  0m0.363s |  sys  0m0.530s
-------------------------------

Private project (20+ 3rd library needs archive to libapps.a)
-------------------------------
|   Patched     |  Current
-------------------------------
|$ time make    |  $ time make
|real 0m21.181s |  real 0m39.721s
|user 0m14.638s |  user 0m24.837s
|sys  0m6.919s  |  sys  0m14.394s
-------------------------------

Signed-off-by: chao an <anchao@xiaomi.com>
2023-09-12 21:55:39 +08:00

64 lines
2.1 KiB
Makefile

############################################################################
# apps/Directory.mk
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# http:#www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
############################################################################
include $(APPDIR)/Make.defs
# Sub-directories that have been built or configured.
SUBDIRS := $(dir $(wildcard */Makefile))
CONFIGSUBDIRS := $(filter-out $(dir $(wildcard */Kconfig)),$(SUBDIRS))
CLEANSUBDIRS := $(dir $(wildcard *$(DELIM).built))
CLEANSUBDIRS += $(dir $(wildcard */.depend))
CLEANSUBDIRS += $(dir $(wildcard */.kconfig))
CLEANSUBDIRS := $(sort $(CLEANSUBDIRS))
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
CONFIGSUBDIRS := $(subst /,\,$(CONFIGSUBDIRS))
CLEANSUBDIRS := $(subst /,\,$(CLEANSUBDIRS))
endif
all: nothing
.PHONY: nothing clean distclean
$(foreach SDIR, $(CONFIGSUBDIRS), $(eval $(call SDIR_template,$(SDIR),preconfig)))
$(foreach SDIR, $(CLEANSUBDIRS), $(eval $(call SDIR_template,$(SDIR),clean)))
$(foreach SDIR, $(CLEANSUBDIRS), $(eval $(call SDIR_template,$(SDIR),distclean)))
nothing:
install:
preconfig: $(foreach SDIR, $(CONFIGSUBDIRS), $(SDIR)_preconfig)
ifneq ($(MENUDESC),)
$(Q) $(MKKCONFIG) -m $(MENUDESC)
endif
$(Q) touch .kconfig
clean: $(foreach SDIR, $(CLEANSUBDIRS), $(SDIR)_clean)
@:
distclean: $(foreach SDIR, $(CLEANSUBDIRS), $(SDIR)_distclean)
ifneq ($(MENUDESC),)
$(call DELFILE, Kconfig)
endif
$(call DELFILE, .kconfig)
-include Make.dep