Makefile (1158B)
- # Copyright © 2024 Haelwenn (lanodan) Monnier <contact@hacktivis.me>
- # SPDX-License-Identifier: MIT
- PREFIX ?= /usr
- LIBDIR ?= ${PREFIX}/lib
- INCDIR ?= ${PREFIX}/include
- PKG_CONFIG_DIR = ${LIBDIR}/pkgconfig/
- all: liberror.so liberror.a
- error.o: error.c error.h
- ${CC} ${CFLAGS} -c -o error.o error.c
- test-error: test-error.c error.o
- ${CC} ${CFLAGS} -o test-error test-error.c error.o ${LDFLAGS} ${LDSTATIC}
- liberror.so: error.o
- ${CC} ${CFLAGS} -shared -Wl,-soname=liberror.so -o liberror.so error.o ${LDFLAGS}
- liberror.a: error.o
- ${AR} rc liberror.a error.o
- install-shared: install liberror.so
- mkdir -p ${DESTDIR}${LIBDIR}/
- cp -p liberror.so ${DESTDIR}${LIBDIR}/
- install-static: install liberror.a
- mkdir -p ${DESTDIR}${LIBDIR}/
- cp -p liberror.a ${DESTDIR}${LIBDIR}/
- install:
- mkdir -p ${DESTDIR}${INCDIR}/
- cp error.h ${DESTDIR}${INCDIR}/error.h
- mkdir -p ${DESTDIR}${PKG_CONFIG_DIR}/
- sed -e 's;@PREFIX@;${PREFIX};' -e 's;@LIBDIR@;${LIBDIR};' -e 's;@INCDIR@;${INCDIR};' error-standalone.pc.in > ${DESTDIR}${PKG_CONFIG_DIR}/error-standalone.pc
- clean:
- rm -f error.o liberror.so liberror.a
- .PHONY: install-shared install-static install clean