Makefile 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 -Werror -O6 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fPIC
  17. CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
  18. CFLAGS += -I$(srctree)/tools/include/
  19. CFLAGS += -I$(srctree)/include/uapi
  20. CFLAGS += -I$(srctree)/include
  21. SUBCMD_IN := $(OUTPUT)libsubcmd-in.o
  22. all:
  23. export srctree OUTPUT CC LD CFLAGS V
  24. include $(srctree)/tools/build/Makefile.include
  25. all: fixdep $(LIBFILE)
  26. $(SUBCMD_IN): FORCE
  27. @$(MAKE) $(build)=libsubcmd
  28. $(LIBFILE): $(SUBCMD_IN)
  29. $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(SUBCMD_IN)
  30. clean:
  31. $(call QUIET_CLEAN, libsubcmd) $(RM) $(LIBFILE); \
  32. find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o -or -name \*.o.cmd -or -name \*.o.d | xargs $(RM)
  33. FORCE:
  34. .PHONY: clean FORCE