xref: /linux/tools/lib/api/Makefile (revision b983d54473344a9ef524a231943478047a779796)
1553873e1SBorislav Petkovinclude ../../scripts/Makefile.include
2ca70c24fSArnaldo Carvalho de Meloinclude ../../scripts/utilities.mak		# QUIET_CLEAN
3553873e1SBorislav Petkov
4b4f91668SJiri Olsaifeq ($(srctree),)
5b4f91668SJiri Olsasrctree := $(patsubst %/,%,$(dir $(shell pwd)))
6b4f91668SJiri Olsasrctree := $(patsubst %/,%,$(dir $(srctree)))
7b4f91668SJiri Olsasrctree := $(patsubst %/,%,$(dir $(srctree)))
8b4f91668SJiri Olsa#$(info Determined 'srctree' to be $(srctree))
9b4f91668SJiri Olsaendif
10b4f91668SJiri Olsa
11553873e1SBorislav PetkovCC = $(CROSS_COMPILE)gcc
12553873e1SBorislav PetkovAR = $(CROSS_COMPILE)ar
13703e0165SLucas StachLD = $(CROSS_COMPILE)ld
14553873e1SBorislav Petkov
15b4f91668SJiri OlsaMAKEFLAGS += --no-print-directory
16553873e1SBorislav Petkov
17285a8f24SJiri OlsaLIBFILE = $(OUTPUT)libapi.a
18553873e1SBorislav Petkov
19b4f91668SJiri OlsaCFLAGS := $(EXTRA_WARNINGS) $(EXTRA_CFLAGS)
20*b983d544SChris PhlipotCFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -O6 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fPIC
21*b983d544SChris Phlipot
22*b983d544SChris Phlipot# Treat warnings as errors unless directed not to
23*b983d544SChris Phlipotifneq ($(WERROR),0)
24*b983d544SChris Phlipot  CFLAGS += -Werror
25*b983d544SChris Phlipotendif
26*b983d544SChris Phlipot
27b4f91668SJiri OlsaCFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
28975f14faSJiri OlsaCFLAGS += -I$(srctree)/tools/lib/api
29553873e1SBorislav Petkov
30553873e1SBorislav PetkovRM = rm -f
31553873e1SBorislav Petkov
32285a8f24SJiri OlsaAPI_IN := $(OUTPUT)libapi-in.o
33553873e1SBorislav Petkov
347c422f55SJiri Olsaall:
357c422f55SJiri Olsa
36b4f91668SJiri Olsaexport srctree OUTPUT CC LD CFLAGS V
37ab6201d0SJiri Olsainclude $(srctree)/tools/build/Makefile.include
38553873e1SBorislav Petkov
397c422f55SJiri Olsaall: fixdep $(LIBFILE)
40553873e1SBorislav Petkov
41b4f91668SJiri Olsa$(API_IN): FORCE
42285a8f24SJiri Olsa	@$(MAKE) $(build)=libapi
43b4f91668SJiri Olsa
44b4f91668SJiri Olsa$(LIBFILE): $(API_IN)
45b4f91668SJiri Olsa	$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(API_IN)
46553873e1SBorislav Petkov
47553873e1SBorislav Petkovclean:
48285a8f24SJiri Olsa	$(call QUIET_CLEAN, libapi) $(RM) $(LIBFILE); \
49c867b150SRiku Voipio	find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o -or -name \*.o.cmd -or -name \*.o.d | xargs $(RM)
50553873e1SBorislav Petkov
51b4f91668SJiri OlsaFORCE:
52b4f91668SJiri Olsa
53b4f91668SJiri Olsa.PHONY: clean FORCE
54