From c105b6e91f57e92b501183f3b46c6c7fec716aba Mon Sep 17 00:00:00 2001 From: kevinnls <57634663+kevinnls@users.noreply.github.com> Date: Tue, 25 Jan 2022 11:18:01 +0100 Subject: [PATCH] add Makefile --- .gitignore | 1 + Makefile | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 .gitignore create mode 100644 Makefile diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..378eac2 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +build diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..bb1cb25 --- /dev/null +++ b/Makefile @@ -0,0 +1,38 @@ +.PHONY: all builddir configure compile clean +build: prebuild configure compile + +INSTALL = install +BUILD_DIR ?= build/ +PREFIX ?= /usr/local/ +DESTDIR ?= ${PREFIX} + + + +SRC_DIR = src/ +DOCS_DIR = docs/ + +BIN = stdouterr +MAN = ${BIN}.${man_category} +man_category = 1 +CC_ARGS = "-I${SRC_DIR}lib" +bindir = ${DESTDIR}bin/ +mandir = ${DESTDIR}share/man/${man_lang?:man_lang/}man${man_category}/ + +configure: + @echo nothing to configure +prebuild: clean + @mkdir ${BUILD_DIR} +clean: + @rm -rf ${BUILD_DIR} +compile: + $(CC) -o${BUILD_DIR}${BIN} ${SRC_DIR}main.c + +preinstall: + mkdir -p ${bindir} + mkdir -p ${mandir} +install: preinstall + $(INSTALL) ${BUILD_DIR}${BIN} ${bindir}${BIN} + $(INSTALL) -m644 ${DOCS_DIR}${MAN} ${mandir}${MAN} +uninstall: + rm ${bindir}${BIN} + rm ${mandir}${MAN}