Makefile 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. include ../../scripts/Makefile.include
  2. include ../../scripts/utilities.mak # QUIET_CLEAN
  3. ifeq ($(srctree),)
  4. srctree := $(patsubst %/,%,$(dir $(shell pwd)))
  5. srctree := $(patsubst %/,%,$(dir $(srctree)))
  6. srctree := $(patsubst %/,%,$(dir $(srctree)))
  7. #$(info Determined 'srctree' to be $(srctree))
  8. endif
  9. CC = $(CROSS_COMPILE)gcc
  10. AR = $(CROSS_COMPILE)ar
  11. LD = $(CROSS_COMPILE)ld
  12. MAKEFLAGS += --no-print-directory
  13. LIBFILE = $(OUTPUT)libapi.a
  14. CFLAGS := $(EXTRA_WARNINGS) $(EXTRA_CFLAGS)
  15. CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -O6 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fPIC
  16. # Treat warnings as errors unless directed not to
  17. ifneq ($(WERROR),0)
  18. CFLAGS += -Werror
  19. endif
  20. CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
  21. CFLAGS += -I$(srctree)/tools/lib/api
  22. CFLAGS += -I$(srctree)/tools/include
  23. RM = rm -f
  24. API_IN := $(OUTPUT)libapi-in.o
  25. all:
  26. export srctree OUTPUT CC LD CFLAGS V
  27. include $(srctree)/tools/build/Makefile.include
  28. all: fixdep $(LIBFILE)
  29. $(API_IN): FORCE
  30. @$(MAKE) $(build)=libapi
  31. $(LIBFILE): $(API_IN)
  32. $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(API_IN)
  33. clean:
  34. $(call QUIET_CLEAN, libapi) $(RM) $(LIBFILE); \
  35. find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o -or -name \*.o.cmd -or -name \*.o.d | xargs $(RM)
  36. FORCE:
  37. .PHONY: clean FORCE