1include ../../scripts/Makefile.include 2include ../../perf/config/utilities.mak # QUIET_CLEAN 3 4ifeq ($(srctree),) 5srctree := $(patsubst %/,%,$(dir $(shell pwd))) 6srctree := $(patsubst %/,%,$(dir $(srctree))) 7srctree := $(patsubst %/,%,$(dir $(srctree))) 8#$(info Determined 'srctree' to be $(srctree)) 9endif 10 11CC = $(CROSS_COMPILE)gcc 12AR = $(CROSS_COMPILE)ar 13RM = rm -f 14 15MAKEFLAGS += --no-print-directory 16 17LIBFILE = $(OUTPUT)libsubcmd.a 18 19CFLAGS := $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) 20CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fPIC 21CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE 22 23CFLAGS += -I$(srctree)/tools/include/ 24CFLAGS += -I$(srctree)/include/uapi 25CFLAGS += -I$(srctree)/include 26 27SUBCMD_IN := $(OUTPUT)libsubcmd-in.o 28 29all: 30 31export srctree OUTPUT CC LD CFLAGS V 32include $(srctree)/tools/build/Makefile.include 33 34all: fixdep $(LIBFILE) 35 36$(SUBCMD_IN): FORCE 37 @$(MAKE) $(build)=libsubcmd 38 39$(LIBFILE): $(SUBCMD_IN) 40 $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(SUBCMD_IN) 41 42clean: 43 $(call QUIET_CLEAN, libsubcmd) $(RM) $(LIBFILE); \ 44 find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o -or -name \*.o.cmd -or -name \*.o.d | xargs $(RM) 45 46FORCE: 47 48.PHONY: clean FORCE 49