Makefile (1751B)
- # SPDX-FileCopyrightText: 2017-2023 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
- # SPDX-License-Identifier: MPL-2.0
- include config.mk
- all: $(EXE)
- .c:
- rm -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno}
- $(CC) -std=c99 $(CFLAGS) -o $@ $< $(LDFLAGS)
- .c.o:
- rm -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno}
- $(CC) -std=c99 $(CFLAGS) -c -o $@ $<
- cmd/sizeof32: cmd/sizeof.c
- $(CC) -std=c99 -m32 $(CFLAGS) -o $@ $< $(LDFLAGS)
- .PHONY: test check
- check: test
- test: all
- MALLOC_CHECK_=3 POSIX_ME_HARDER=1 POSIXLY_CORRECT=1 kyua test || (kyua report --verbose --results-filter=broken,failed; false)
- .PHONY: lint
- lint:
- $(SHELLCHECK) ./configure test_all.sh test_functions.sh ./sh/*
- SHELLCHECK=${SHELLCHECK} ./test-cmd/shellcheck
- ${FLAWFINDER} --error-level=4 .
- $(MANDOC) -Tlint -Wunsupp,error,warning $(MAN1)
- $(REUSE) lint
- clean:
- rm -fr $(EXE)
- rm -fr ${EXE:=.c.gcov} ${EXE:=.gcda} ${EXE:=.gcno}
- install: script-install cmd-install
- script-install:
- mkdir -p $(DESTDIR)$(SHELLDIR)/ $(DESTDIR)$(PERLDIR)/
- cp -r sh/* $(DESTDIR)$(SHELLDIR)/
- cp -r perl/* $(DESTDIR)$(PERLDIR)/
- cmd-install:
- mkdir -p ${DESTDIR}${BINDIR}/
- cp -p ${EXE} ${DESTDIR}${BINDIR}/
- chown 0:0 ${DESTDIR}${BINDIR}/memsys
- chmod 4755 ${DESTDIR}${BINDIR}/memsys
- mkdir -p ${DESTDIR}${MANDIR}/man1
- cp -p ${MAN1} ${DESTDIR}${MANDIR}/man1
- .PHONY: coverage
- coverage:
- $(GCOV) -b $(EXE)
- C_SOURCES = cmd/*.c lib/*.h lib/*.c
- format: $(C_SOURCES)
- clang-format -style=file -assume-filename=.clang-format -i $(C_SOURCES)
- cmd/lolcat: cmd/lolcat.c Makefile
- rm -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno}
- $(CC) -std=c99 $(CFLAGS) -o $@ cmd/lolcat.c -lm $(LDFLAGS)
- cmd/xcd: cmd/xcd.c Makefile
- rm -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno}
- $(CC) -std=c99 $(CFLAGS) -o $@ cmd/xcd.c -lm $(LDFLAGS)