blob: 1faecb82ad42e65538b3a9a74a62d882afc783a3 [file] [log] [blame]
Josh Poimboeuf4b6ab942015-12-15 09:39:39 -06001include ../../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
Josh Poimboeufc1d45c32016-03-02 18:39:37 -060011CC ?= $(CROSS_COMPILE)gcc
12LD ?= $(CROSS_COMPILE)ld
13AR ?= $(CROSS_COMPILE)ar
14
Josh Poimboeuf4b6ab942015-12-15 09:39:39 -060015RM = rm -f
16
17MAKEFLAGS += --no-print-directory
18
19LIBFILE = $(OUTPUT)libsubcmd.a
20
21CFLAGS := $(EXTRA_WARNINGS) $(EXTRA_CFLAGS)
22CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fPIC
23CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
24
25CFLAGS += -I$(srctree)/tools/include/
26CFLAGS += -I$(srctree)/include/uapi
27CFLAGS += -I$(srctree)/include
28
29SUBCMD_IN := $(OUTPUT)libsubcmd-in.o
30
31all:
32
33export srctree OUTPUT CC LD CFLAGS V
34include $(srctree)/tools/build/Makefile.include
35
36all: fixdep $(LIBFILE)
37
38$(SUBCMD_IN): FORCE
39 @$(MAKE) $(build)=libsubcmd
40
41$(LIBFILE): $(SUBCMD_IN)
42 $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(SUBCMD_IN)
43
44clean:
45 $(call QUIET_CLEAN, libsubcmd) $(RM) $(LIBFILE); \
46 find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o -or -name \*.o.cmd -or -name \*.o.d | xargs $(RM)
47
48FORCE:
49
50.PHONY: clean FORCE