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