tMakefile - granular - granular dynamics simulation (HTM) git clone git://src.adamsgaard.dk/granular (DIR) Log (DIR) Files (DIR) Refs (DIR) README (DIR) LICENSE --- tMakefile (2536B) --- 1 .POSIX: 2 3 NAME = granular 4 VERSION = 0.1.0 5 6 # paths 7 PREFIX = /usr/local 8 MANPREFIX = ${PREFIX}/share/man 9 DOCPREFIX = ${PREFIX}/share/doc/${NAME} 10 11 BIN = \ 12 granular\ 13 granular2vtu\ 14 granularenergy\ 15 granulargrain\ 16 granularpacking\ 17 18 SCRIPTS = \ 19 granular2img\ 20 21 SRC = \ 22 arrays.c\ 23 contact.c\ 24 grain.c\ 25 grains.c\ 26 packing.c\ 27 simulation.c\ 28 util.c\ 29 30 HDR = \ 31 arg.h\ 32 arrays.h\ 33 contact.h\ 34 grain.h\ 35 grains.h\ 36 granular.h\ 37 packing.h\ 38 simulation.h\ 39 util.h\ 40 41 LIBS = -lm 42 43 GRANULAR_CFLAGS = ${CFLAGS} ${INCS} -DVERSION=\"${VERSION}\" 44 GRANULAR_LDFLAGS = ${LDFLAGS} 45 GRANULAR_LIBS = ${LIBS} 46 47 MAN1 = ${BIN:=.1}\ 48 ${SCRIPTS:=.1} 49 MAN5 = ${NAME:=.5} 50 DOC = \ 51 README.md\ 52 LICENSE\ 53 two-grain-collision.sh\ 54 many-grain-collision.sh 55 56 all: ${BIN} 57 58 OBJ = ${SRC:.c=.o} 59 60 ${OBJ}: ${HDR} 61 62 granular: granular.o 63 granular2vtu: granular2vtu.o 64 granularenergy: granularenergy.o 65 granulargrain: granulargrain.o 66 granularpacking: granularpacking.o 67 68 ${BIN}: ${OBJ} 69 ${CC} ${GRANULAR_LDFLAGS} -o $@ ${@:=.o} ${OBJ} ${GRANULAR_LIBS} 70 71 .c.o: 72 ${CC} ${GRANULAR_CFLAGS} -o $@ -c $< 73 74 dist: 75 rm -rf "${NAME}-${VERSION}" 76 mkdir -p "${NAME}-${VERSION}" 77 cp -rf ${MAN1} ${MAN5} ${DOC} ${HDR} ${SRC} ${BIN:=.c} ${SCRIPTS} \ 78 Makefile "${NAME}-${VERSION}" 79 # make tarball 80 tar cf - "${NAME}-${VERSION}" | \ 81 gzip -c > "${NAME}-${VERSION}.tar.gz" 82 rm -rf "${NAME}-${VERSION}" 83 84 install: ${BIN} 85 # installing executables 86 mkdir -p ${DESTDIR}${PREFIX}/bin 87 cp -f ${BIN} ${SCRIPTS} ${DESTDIR}${PREFIX}/bin 88 for f in ${BIN} ${SCRIPTS}; do chmod 755 ${DESTDIR}${PREFIX}/bin/$$f; done 89 # installing documentation and license information 90 mkdir -p ${DESTDIR}${DOCPREFIX} 91 cp -f ${DOC} ${DESTDIR}${DOCPREFIX} 92 for f in ${DOC}; do chmod 644 ${DESTDIR}${DOCPREFIX}/$$f; done 93 # installing man pages 94 mkdir -p ${DESTDIR}${MANPREFIX}/man1 95 cp -f ${MAN1} ${DESTDIR}${MANPREFIX}/man1 96 for f in ${MAN1}; do chmod 644 ${DESTDIR}${MANPREFIX}/man1/$$f; done 97 mkdir -p ${DESTDIR}${MANPREFIX}/man5 98 cp -f ${MAN5} ${DESTDIR}${MANPREFIX}/man5 99 for f in ${MAN5}; do chmod 644 ${DESTDIR}${MANPREFIX}/man5/$$f; done 100 101 uninstall: 102 # removing executable files 103 for f in ${BIN} ${SCRIPTS}; do rm -f ${DESTDIR}${PREFIX}/bin/$$f; done 104 # removing documentation and license information 105 for f in ${DOC}; do rm -f ${DESTDIR}${DOCPREFIX}/$$f; done 106 -rmdir ${DESTDIR}${DOCPREFIX} 107 # removing man pages 108 for f in ${MAN1}; do rm -f ${DESTDIR}${MANPREFIX}/man1/$$f; done 109 for f in ${MAN5}; do rm -f ${DESTDIR}${MANPREFIX}/man5/$$f; done 110 111 clean: 112 rm -f ${BIN} ${OBJ} ${BIN:=.o} 113 114 .PHONY: all install uninstall clean dist