顶层makefile
COMMON_TARGETS := pan utils
COMMON_TARGETS += tools testcases/ddt
COMMON_TARGETS += testcases/kernel/timers
COMMON_TARGETS += testcases/kernel/ipc
COMMON_TARGETS += testcases/kernel/mem
COMMON_TARGETS += testcases/kernel/lib
COMMON_TARGETS += testcases/kernel/syscalls
COMMON_TARGETS += testcases/kernel/security
COMMON_TARGETS += testcases/kernel/sched
COMMON_TARGETS += testcases/kernel/hotplug
COMMON_TARGETS += testcases/misc/math
COMMON_TARGETS += testcases/lib
COMMON_TARGETS += testcases/realtime
COMMON_TARGETS += testcases/cve
COMMON_TARGETS += testcases/commands/keyctl
需要编译的目标,可以在此处注释掉,不进行编译,最终目标文件夹会小很多(只编译pan utils tools testcases/ddt 和testcases/lib 54MB)
all: $(addsuffix -all,$(COMMON_TARGETS)) Version
$(MAKE_TARGETS): lib-all
$(MAKE_TARGETS) include-all lib-all:
$(MAKE) -C "$(subst -all,,$@)" \
-f "$(abs_top_srcdir)/$(subst -all,,$@)/Makefile" all
先编译lib,之后按照COMMON_TARGETS 顺序逐一编译。
./testcases:
top_srcdir ?= ..
include $(top_srcdir)/include/mk/env_pre.mk
FILTER_OUT_DIRS := kdump
ifneq ($(WITH_OPEN_POSIX_TESTSUITE),yes)
FILTER_OUT_DIRS += open_posix_testsuite
endif
ifneq ($(WITH_REALTIME_TESTSUITE),yes)
FILTER_OUT_DIRS += realtime
endif
include $(top_srcdir)/include/mk/generic_trunk_target.mk # 包含generic_trunk_target.inc 中包含all:
./testcases/ddt:
top_srcdir ?= ../..
include $(top_srcdir)/include/mk/env_pre.mk
include $(top_srcdir)/include/mk/generic_trunk_target.mk
./testcases/ddt/i2c_test_suite:
top_srcdir ?= ../../..
include $(top_srcdir)/include/mk/env_pre.mk
KERNEL_DIR := $(patsubst %/include,%,$(KERNEL_INC))
INSTALL_DIR := testcases/bin/ddt
FILTER_OUT_DIRS :=
# We don't want to copy over the Makefile
UNWANTED_FILES := Makefile
INSTALL_MODE := 00755
#INSTALL_TARGETS := $(filter-out $(UNWANTED_FILES),$(notdir $(patsubst $(abs_srcdir)/%,%,$(wildcard $(abs_srcdir)/*))))
CFLAGS += -g -Wall -O1 -fomit-frame-pointer
LDFLAGS += -g -static
INCLUDES = -I $(KERNEL_USR_INC) -I src/interface/common -I ../utils/user
#List of source files- Update this on adding a new C file
SOURCES := \
../utils/user/st_timer.c \
../utils/user/st_cpu_load.c \
src/testcases/st_i2c_eeprom.c \
src/interface/common/st_i2c_common.c \
src/parser/st_i2c_parser.c
MAKE_TARGETS := i2c_tests
i2c_tests:
$(CC) $(CFLAGS) $(LDFLAGS) -o i2c_tests ${INCLUDES} ${SOURCES}
include $(top_srcdir)/include/mk/generic_leaf_target.mk #包含generic_leaf_target.inc 中包含all:
./testcases/ddt/scripts
top_srcdir ?= ../../..
include $(top_srcdir)/include/mk/env_pre.mk
# Define directories to exclude from build/installation
#FILTER_OUT_DIRS := kdump
include $(top_srcdir)/include/mk/generic_trunk_target.mk
./testcases/ddt/scripts/eth
top_srcdir ?= ../../../..
include $(top_srcdir)/include/mk/env_pre.mk
INSTALL_DIR := testcases/bin/ddt/$(notdir $(CURDIR:%/=%))
FILTER_OUT_DIRS :=
# We don't want to copy over the Makefile
UNWANTED_FILES := Makefile
INSTALL_MODE := 00755
INSTALL_TARGETS := $(filter-out $(UNWANTED_FILES),$(notdir $(patsubst $(abs_srcdir)/%,%,$(wildcard $(abs_srcdir)/*)))) #shell脚本只需要install 不要gcc
MAKE_TARGETS :=
include $(top_srcdir)/include/mk/generic_leaf_target.mk #最底层文件夹用leaf
./testcases/kernel:
top_srcdir ?= ../..
include $(top_srcdir)/include/mk/env_pre.mk
# NOTE (garrcoop): mce-test isn't integrated into the build.
# Build syscalls in all scenarios.
SUBDIRS := syscalls
# Build lib
SUBDIRS += lib
ifneq ($(UCLINUX),1)
# KEEP THIS LIST ALPHABETIZED PLEASE!
SUBDIRS += connectors \
containers \
controllers \
device-drivers \
firmware \
fs \
hotplug \
input \
io \
ipc \
logging \
mem \
numa \
pty \
sched \
security \
timers \
tracing \
module \
ifeq ($(WITH_POWER_MANAGEMENT_TESTSUITE),yes)
SUBDIRS += power_management
endif
endif
ifeq ($(ANDROID),1)
FILTER_OUT_DIRS += containers controllers device-drivers fs io ipc mem \
sched security timers
endif
include $(top_srcdir)/include/mk/generic_trunk_target.mk
./testcases/kernel/syscalls
top_srcdir ?= ../../..
include $(top_srcdir)/include/mk/env_pre.mk
ifeq ($(UCLINUX),1)
FILTER_OUT_DIRS += capget capset chmod chown clone fork getcontext llseek \
mincore mprotect nftw profil remap_file_pages sbrk
endif
ifeq ($(UCLIBC),1)
FILTER_OUT_DIRS += profil
endif
ifeq ($(ANDROID), 1)
FILTER_OUT_DIRS += \
accept4 adjtimex cma confstr fcntl fmtmsg futex getcontext getcpu \
getdomainname getdtablesize gethostid getgroups get_mempolicy ipc \
linkat kill mallopt memmap mq_notify mq_open mq_timedreceive \
mq_timedsend mq_unlink mmap mremap open openat profil ptrace quotactl \
readahead remap_file_pages rt_sigsuspend rt_sigtimedwait \
sched_getaffinity sched_setaffinity sendmsg setgroups setns sighold \
sigrelse sigsuspend sigtimedwait sigwait sigwaitinfo stime \
setdomainname sethostname symlinkat ulimit ustat vfork vhangup vmsplice
endif
include $(top_srcdir)/include/mk/generic_trunk_target.mk
./testcases/kernel/syscalls/alarm
top_srcdir ?= ../../../..
include $(top_srcdir)/include/mk/testcases.mk
include $(top_srcdir)/include/mk/generic_leaf_target.mk