logo

utils

Old programs, got split in utils-std and utils-extra git clone https://hacktivis.me/git/utils.git

Makefile (1751B)


  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)
  8. .c.o:
  9. rm -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno}
  10. $(CC) -std=c99 $(CFLAGS) -c -o $@ $<
  11. cmd/sizeof32: cmd/sizeof.c
  12. $(CC) -std=c99 -m32 $(CFLAGS) -o $@ $< $(LDFLAGS)
  13. .PHONY: test check
  14. check: test
  15. test: all
  16. MALLOC_CHECK_=3 POSIX_ME_HARDER=1 POSIXLY_CORRECT=1 kyua test || (kyua report --verbose --results-filter=broken,failed; false)
  17. .PHONY: lint
  18. lint:
  19. $(SHELLCHECK) ./configure test_all.sh test_functions.sh ./sh/*
  20. SHELLCHECK=${SHELLCHECK} ./test-cmd/shellcheck
  21. ${FLAWFINDER} --error-level=4 .
  22. $(MANDOC) -Tlint -Wunsupp,error,warning $(MAN1)
  23. $(REUSE) lint
  24. clean:
  25. rm -fr $(EXE)
  26. rm -fr ${EXE:=.c.gcov} ${EXE:=.gcda} ${EXE:=.gcno}
  27. install: script-install cmd-install
  28. script-install:
  29. mkdir -p $(DESTDIR)$(SHELLDIR)/ $(DESTDIR)$(PERLDIR)/
  30. cp -r sh/* $(DESTDIR)$(SHELLDIR)/
  31. cp -r perl/* $(DESTDIR)$(PERLDIR)/
  32. cmd-install:
  33. mkdir -p ${DESTDIR}${BINDIR}/
  34. cp -p ${EXE} ${DESTDIR}${BINDIR}/
  35. chown 0:0 ${DESTDIR}${BINDIR}/memsys
  36. chmod 4755 ${DESTDIR}${BINDIR}/memsys
  37. mkdir -p ${DESTDIR}${MANDIR}/man1
  38. cp -p ${MAN1} ${DESTDIR}${MANDIR}/man1
  39. .PHONY: coverage
  40. coverage:
  41. $(GCOV) -b $(EXE)
  42. C_SOURCES = cmd/*.c lib/*.h lib/*.c
  43. format: $(C_SOURCES)
  44. clang-format -style=file -assume-filename=.clang-format -i $(C_SOURCES)
  45. cmd/lolcat: cmd/lolcat.c Makefile
  46. rm -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno}
  47. $(CC) -std=c99 $(CFLAGS) -o $@ cmd/lolcat.c -lm $(LDFLAGS)
  48. cmd/xcd: cmd/xcd.c Makefile
  49. rm -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno}
  50. $(CC) -std=c99 $(CFLAGS) -o $@ cmd/xcd.c -lm $(LDFLAGS)