logo

utils-extra

Collection of extra tools for Unixes

Makefile (1484B)


  1. # SPDX-FileCopyrightText: 2017-2023 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
  2. # SPDX-License-Identifier: MPL-2.0
  3. include config.mk
  4. all: $(EXE)
  5. .c:
  6. rm -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno}
  7. $(CC) -std=c99 $(CFLAGS) -o $@ $< $(LDFLAGS) $(LDSTATIC)
  8. .c.o:
  9. rm -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno}
  10. $(CC) -std=c99 $(CFLAGS) -c -o $@ $<
  11. .PHONY: check
  12. check: all
  13. MALLOC_CHECK_=3 POSIX_ME_HARDER=1 POSIXLY_CORRECT=1 kyua test || (kyua report --verbose --results-filter=broken,failed; false)
  14. .PHONY: lint
  15. lint:
  16. $(SHELLCHECK) ./configure test_functions.sh ./sh/*
  17. SHELLCHECK=${SHELLCHECK} ./test-cmd/shellcheck
  18. ${FLAWFINDER} --error-level=4 .
  19. $(MANDOC) -Tlint -Wunsupp,error,warning $(MAN1)
  20. $(REUSE) lint
  21. clean:
  22. rm -fr $(EXE)
  23. rm -fr ${EXE:=.c.gcov} ${EXE:=.gcda} ${EXE:=.gcno}
  24. install: all
  25. mkdir -p ${DESTDIR}${BINDIR}/
  26. cp -p ${EXE} ${DESTDIR}${BINDIR}/
  27. chown 0:0 ${DESTDIR}${BINDIR}/memsys
  28. chmod 4755 ${DESTDIR}${BINDIR}/memsys
  29. mkdir -p ${DESTDIR}${MANDIR}/man1
  30. cp -p ${MAN1} ${DESTDIR}${MANDIR}/man1
  31. .PHONY: coverage
  32. coverage:
  33. $(GCOV) -b $(EXE)
  34. C_SOURCES = cmd/*.c
  35. format: $(C_SOURCES)
  36. clang-format -style=file -assume-filename=.clang-format -i $(C_SOURCES)
  37. cmd/lolcat: cmd/lolcat.c Makefile
  38. rm -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno}
  39. $(CC) -std=c99 $(CFLAGS) -o $@ cmd/lolcat.c -lm $(LDFLAGS) $(LDSTATIC)
  40. cmd/xcd: cmd/xcd.c Makefile
  41. rm -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno}
  42. $(CC) -std=c99 $(CFLAGS) -o $@ cmd/xcd.c -lm $(LDFLAGS) $(LDSTATIC)