Makefile 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. LD ?= $(CROSS_COMPILE)ld
  11. AR ?= $(CROSS_COMPILE)ar
  12. RM = rm -f
  13. MAKEFLAGS += --no-print-directory
  14. LIBFILE = $(OUTPUT)libsubcmd.a
  15. CFLAGS := $(EXTRA_WARNINGS) $(EXTRA_CFLAGS)
  16. CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -O6 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fPIC
  17. # Treat warnings as errors unless directed not to
  18. ifneq ($(WERROR),0)
  19. CFLAGS += -Werror
  20. endif
  21. CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
  22. CFLAGS += -I$(srctree)/tools/include/
  23. CFLAGS += -I$(srctree)/include/uapi
  24. CFLAGS += -I$(srctree)/include
  25. SUBCMD_IN := $(OUTPUT)libsubcmd-in.o
  26. all:
  27. export srctree OUTPUT CC LD CFLAGS V
  28. include $(srctree)/tools/build/Makefile.include
  29. all: fixdep $(LIBFILE)
  30. $(SUBCMD_IN): FORCE
  31. @$(MAKE) $(build)=libsubcmd
  32. $(LIBFILE): $(SUBCMD_IN)
  33. $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(SUBCMD_IN)
  34. clean:
  35. $(call QUIET_CLEAN, libsubcmd) $(RM) $(LIBFILE); \
  36. find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o -or -name \*.o.cmd -or -name \*.o.d | xargs $(RM)
  37. FORCE:
  38. .PHONY: clean FORCE