Makefile (2002B)
1 NAME = 1d_fd_simple_shear 2 VERSION = 0.6.0 3 4 PREFIX ?= /usr/local 5 MANPREFIX ?= ${PREFIX}/man 6 DOCPREFIX ?= ${PREFIX}/share/doc/${NAME} 7 8 HDR = \ 9 arg.h\ 10 arrays.h\ 11 fluid.h\ 12 simulation.h 13 BIN = \ 14 1d_fd_simple_shear\ 15 max_depth_simple_shear\ 16 shear_flux 17 MAN1 = \ 18 1d_fd_simple_shear.1\ 19 max_depth_simple_shear.1\ 20 shear_flux.1 21 DOC = \ 22 README.md\ 23 LICENSE 24 25 HERE_CFLAGS = ${CFLAGS} -O2 -g -std=c99 26 HERE_LDFLAGS = ${LDFLAGS} -lm -g 27 GLOBALCONST = -DVERSION=\"${VERSION}\" 28 29 all: ${BIN} 30 31 .o: 32 ${CC} ${LDFLAGS} -o $@ ${LIBS} 33 34 .c.o: ${HDR} 35 ${CC} ${HERE_CFLAGS} ${GLOBALCONST} -o $@ -c $< 36 37 1d_fd_simple_shear: 1d_fd_simple_shear.o arrays.o fluid.o simulation.o 38 ${CC} ${HERE_LDFLAGS}\ 39 1d_fd_simple_shear.o arrays.o fluid.o simulation.o\ 40 -o $@ 41 42 max_depth_simple_shear: max_depth_simple_shear.o arrays.o fluid.o simulation.o ${HDR} 43 ${CC} ${HERE_LDFLAGS}\ 44 max_depth_simple_shear.o arrays.o fluid.o simulation.o\ 45 -o $@ 46 47 shear_flux: shear_flux.o ${HDR} 48 ${CC} ${HERE_LDFLAGS}\ 49 shear_flux.o\ 50 -o $@ 51 52 install: ${BIN} 53 # installing executables 54 mkdir -p ${DESTDIR}${PREFIX}/bin 55 cp -f ${BIN} ${DESTDIR}${PREFIX}/bin 56 for f in ${BIN}; do chmod 755 ${DESTDIR}${PREFIX}/bin/$$f; done 57 # installing documentation and license information 58 mkdir -p ${DESTDIR}${DOCPREFIX} 59 cp -f ${DOC} ${DESTDIR}${DOCPREFIX} 60 for f in ${DOC}; do chmod 644 ${DESTDIR}${DOCPREFIX}/$$f; done 61 # installing man pages 62 mkdir -p ${DESTDIR}${MANPREFIX}/man1 63 cp -f ${MAN1} ${DESTDIR}${MANPREFIX}/man1 64 for f in ${MAN1}; do echo chmod 644 ${DESTDIR}${MANPREFIX}/man1/$$f; done 65 66 uninstall: 67 # removing executable files 68 for f in ${BIN}; do rm -f ${DESTDIR}${PREFIX}/bin/$$f; done 69 # removing documentation and license information 70 for f in ${DOC}; do rm -f ${DESTDIR}${DOCPREFIX}/$$f; done 71 -rmdir ${DESTDIR}${DOCPREFIX} 72 # removing man pages 73 for f in ${MAN1}; do rm -f ${DESTDIR}${MANPREFIX}/man1/$$f; done 74 75 test: ${BIN} 76 make -C test/ 77 78 clean: 79 rm -f *.txt 80 rm -f *.o 81 rm -f ${BIN} 82 83 .PHONY: all install uninstall watch test memtest clean