Makefile.chkbss 555 B

123456789101112131415161718192021222324
  1. # SPDX-License-Identifier: GPL-2.0
  2. quiet_cmd_chkbss = CHKBSS $<
  3. define cmd_chkbss
  4. rm -f $@; \
  5. if ! $(OBJDUMP) -j .bss -w -h $< | awk 'END { if ($$3) exit 1 }'; then \
  6. echo "error: $< .bss section is not empty" >&2; exit 1; \
  7. fi; \
  8. touch $@;
  9. endef
  10. chkbss-target ?= $(obj)/built-in.a
  11. ifneq (,$(findstring /,$(chkbss)))
  12. chkbss-files := $(patsubst %, %.chkbss, $(chkbss))
  13. else
  14. chkbss-files := $(patsubst %, $(obj)/%.chkbss, $(chkbss))
  15. endif
  16. $(chkbss-target): $(chkbss-files)
  17. targets += $(notdir $(chkbss-files))
  18. %.o.chkbss: %.o
  19. $(call cmd,chkbss)