Generate acheam.pc from DESTDIR in Makefile main
authorArmaan Bhojwani <me@armaanb.net>
Tue, 11 May 2021 13:44:09 +0000 (09:44 -0400)
committerArmaan Bhojwani <me@armaanb.net>
Tue, 11 May 2021 13:44:09 +0000 (09:44 -0400)
.gitignore
Makefile
acheam.pc.in [new file with mode: 0644]

index ee15c0d44c68e429f4a46603b1577d473f9da966..fddbcfb8b9e70f33af284cec868835e591ae85be 100644 (file)
@@ -2,6 +2,7 @@
 *.a
 *.so
 
+acheam.pc
 man/*
 !man/*.scd
 
index a301e4aed716f72e877fb7a4dcd01a8d9d66ace7..3d0bd0da1b2338ab689f957456765c2265935787 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 DESTDIR  ?= /usr/local
 CFLAGS   := -Wall -Wextra -pedantic -std=c99 -fPIC ${CFLAGS}
 
-all: shared static man
+all: shared static man pkgconfig
 
 shared:
        ${CC} -shared ${LDFLAGS} -o libacheam.so src/libacheam/*.c ${CFLAGS}
@@ -10,6 +10,9 @@ static:
        ${CC} ${LDFLAGS} src/libacheam/*.c ${CFLAGS} -c
        ar rcs libacheam.a *.o
 
+pkgconfig:
+       sed "s|PREFIX_HERE|${DESTDIR}|g" acheam.pc.in > acheam.pc
+
 man:
        for i in man/*.scd; do \
                outp=$$(echo "$$i" | rev | cut -f 2- -d '.' | rev); \
diff --git a/acheam.pc.in b/acheam.pc.in
new file mode 100644 (file)
index 0000000..6878d5a
--- /dev/null
@@ -0,0 +1,11 @@
+prefix=PREFIX_HERE
+exec_prefix=${prefix}
+includedir=${prefix}/include
+libdir=${prefix}/lib
+
+Name: libacheam
+Version: 0.0.0
+Description: Armaan's personal C library
+Requires:
+Cflags: -I${includedir}/
+Libs: -L${libdir} -lacheam