DESTDIR ?= /usr/local
CFLAGS := -Wall -Wextra -pedantic -std=c99 -fPIC ${CFLAGS}
-all: lib man
+all: shared static man pkgconfig
-lib:
- ${CC} -shared ${LDFLAGS} ${OBJS} -o libacheam.so src/*.c ${CFLAGS}
+shared:
+ ${CC} -shared ${LDFLAGS} -o libacheam.so src/libacheam/*.c ${CFLAGS}
+
+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 \
${DESTDIR}/lib/pkgconfig \
${DESTDIR}/man/man3
- cp libacheam.so ${DESTDIR}/lib
- cp acheam.pc ${DESTDIR}/lib/pkgconfig
- cp src/acheam.h ${DESTDIR}/include
- cp man/*.3 ${DESTDIR}/man/man3/
+ cp libacheam.so ${DESTDIR}/lib
+ cp acheam.pc ${DESTDIR}/lib/pkgconfig
+ cp man/*.3 ${DESTDIR}/man/man3/
+ cp src/libacheam/acheam.h ${DESTDIR}/include
uninstall:
rm ${DESTDIR}/include/acheam.h \
rm ${DESTDIR}/man/man3/$$(basename "$$i" ".scd"); \
done
+test: static
+ ${CC} -o test src/tests.c -I./src/libacheam libacheam.a ${CFLAGS}
+ ./test
+
+clean:
+ rm -f test libacheam.so libacheam.a *.o man/*.3
+
.POSIX:
-.PHONY: all man
+.PHONY: all man test