Makefile (1670B)
1 # libdht - simple dht library 2 # See LICENSE file for copyright and license details. 3 4 include config.mk 5 6 SRC = dht.c ind.c dhtlist.c 7 OBJ = ${SRC:.c=.o} 8 SOUT = ${NAME}.a 9 DOUT = ${NAME}.so 10 11 all: options ${SOUT} ${DOUT} 12 13 options: 14 @echo ${NAME} build options: 15 @echo "CFLAGS = ${CFLAGS}" 16 @echo "LDFLAGS = ${LDFLAGS}" 17 @echo "CC = ${CC}" 18 19 .c.o: 20 @echo CC $< 21 @${CC} -c ${CFLAGS} $< 22 23 ${OBJ}: config.mk 24 25 ${SOUT}: ${OBJ} 26 @ar rcs ${SOUT} ${OBJ} 27 28 ${DOUT}: ${OBJ} 29 @${CC} -shared ${OBJ} -o ${DOUT} 30 31 dhttest: ${OBJ} dhttest.o 32 @echo CC -o $@ 33 @${CC} -o $@ ${OBJ} dhttest.o ${LDFLAGS} 34 35 test: dhttest 36 @echo running dhttest 37 ./dhttest 38 39 clean: 40 @echo cleaning 41 @rm -f *.so *.a ${NAME} ${OBJ} dhttest dhttest.o ${NAME}-${VERSION}.tar.gz 42 43 dist: clean 44 @echo creating dist tarball 45 @mkdir -p ${NAME}-${VERSION} 46 @cp -R LICENSE Makefile README.md config.mk \ 47 ${SRC} *.h ${NAME}-${VERSION} 48 @tar -cf ${NAME}-${VERSION}.tar ${NAME}-${VERSION} 49 @gzip ${NAME}-${VERSION}.tar 50 @rm -rf ${NAME}-${VERSION} 51 52 install: all 53 @echo installing libraries to ${DESTDIR}${PREFIX}/lib 54 @mkdir -p ${DESTDIR}${PREFIX}/lib 55 @cp -f ${NAME}.a ${NAME}.so ${DESTDIR}${PREFIX}/lib 56 @chmod 755 ${DESTDIR}${PREFIX}/lib/${NAME}.* 57 @echo installing header file to ${DESTDIR}${PREFIX}/include 58 @mkdir -p ${DESTDIR}${PREFIX}/include 59 @cp -f dht.h ${DESTDIR}${PREFIX}/include 60 @chmod 644 ${DESTDIR}${PREFIX}/include/dht.h 61 62 uninstall: 63 @echo removing libraries from ${DESTDIR}${PREFIX}/bin 64 @rm -f ${DESTDIR}${PREFIX}/lib/${NAME}.* 65 @echo removing header file from ${DESTDIR}${PREFIX}/include 66 @rm -f ${DESTDIR}${PREFIX}/include/dht.h 67 68 .PHONY: all options clean dist install uninstall test 69 # DO NOT DELETE