18c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0 28c2ecf20Sopenharmony_ciinclude ../../scripts/Makefile.include 38c2ecf20Sopenharmony_ciinclude ../../scripts/utilities.mak # QUIET_CLEAN 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ciifeq ($(srctree),) 68c2ecf20Sopenharmony_cisrctree := $(patsubst %/,%,$(dir $(CURDIR))) 78c2ecf20Sopenharmony_cisrctree := $(patsubst %/,%,$(dir $(srctree))) 88c2ecf20Sopenharmony_cisrctree := $(patsubst %/,%,$(dir $(srctree))) 98c2ecf20Sopenharmony_ci#$(info Determined 'srctree' to be $(srctree)) 108c2ecf20Sopenharmony_ciendif 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ciCC ?= $(CROSS_COMPILE)gcc 138c2ecf20Sopenharmony_ciLD ?= $(CROSS_COMPILE)ld 148c2ecf20Sopenharmony_ciAR ?= $(CROSS_COMPILE)ar 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ciRM = rm -f 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ciMAKEFLAGS += --no-print-directory 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ciLIBFILE = $(OUTPUT)libsubcmd.a 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ciCFLAGS := -ggdb3 -Wall -Wextra -std=gnu99 -fPIC 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ciifeq ($(DEBUG),0) 258c2ecf20Sopenharmony_ci ifeq ($(feature-fortify-source), 1) 268c2ecf20Sopenharmony_ci CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 278c2ecf20Sopenharmony_ci endif 288c2ecf20Sopenharmony_ciendif 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ciifeq ($(DEBUG),1) 318c2ecf20Sopenharmony_ci CFLAGS += -O0 328c2ecf20Sopenharmony_cielse ifeq ($(CC_NO_CLANG), 0) 338c2ecf20Sopenharmony_ci CFLAGS += -O3 348c2ecf20Sopenharmony_cielse 358c2ecf20Sopenharmony_ci CFLAGS += -O6 368c2ecf20Sopenharmony_ciendif 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci# Treat warnings as errors unless directed not to 398c2ecf20Sopenharmony_ciifneq ($(WERROR),0) 408c2ecf20Sopenharmony_ci CFLAGS += -Werror 418c2ecf20Sopenharmony_ciendif 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_ciCFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_ciCFLAGS += -I$(srctree)/tools/include/ 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ciCFLAGS += $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ciSUBCMD_IN := $(OUTPUT)libsubcmd-in.o 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_ciall: 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_ciexport srctree OUTPUT CC LD CFLAGS V 548c2ecf20Sopenharmony_ciinclude $(srctree)/tools/build/Makefile.include 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ciall: fixdep $(LIBFILE) 578c2ecf20Sopenharmony_ci 588c2ecf20Sopenharmony_ci$(SUBCMD_IN): FORCE 598c2ecf20Sopenharmony_ci @$(MAKE) $(build)=libsubcmd 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_ci$(LIBFILE): $(SUBCMD_IN) 628c2ecf20Sopenharmony_ci $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(SUBCMD_IN) 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ciclean: 658c2ecf20Sopenharmony_ci $(call QUIET_CLEAN, libsubcmd) $(RM) $(LIBFILE); \ 668c2ecf20Sopenharmony_ci find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o -or -name \*.o.cmd -or -name \*.o.d | xargs $(RM) 678c2ecf20Sopenharmony_ci 688c2ecf20Sopenharmony_ciFORCE: 698c2ecf20Sopenharmony_ci 708c2ecf20Sopenharmony_ci.PHONY: clean FORCE 71