Makefile (1121B)
1 CFLAGS = -std=c99 -pedantic -Wall -O3 2 LDFLAGS = -lm 3 SRC = arrays.c fluid.c main.c simulation.c 4 OBJ = $(SRC:.c=.o) 5 HDR = arrays.h fluid.h parameter_defaults.h simulation.h 6 BIN = ./1d_fd_simple_shear_transient 7 8 PREFIX ?= /usr/local 9 INSTALL ?= install 10 STRIP ?= strip 11 12 default: $(BIN) 13 14 $(BIN): $(OBJ) $(HDR) 15 $(CC) $(LDFLAGS) $(OBJ) -o $@ 16 17 install: $(BIN) 18 $(STRIP) $(BIN) 19 $(INSTALL) -m 0755 -d $(DESTDIR)$(PREFIX)/bin 20 $(INSTALL) -m 0755 $(BIN) $(DESTDIR)$(PREFIX)/bin 21 22 uninstall: 23 rm -f $(DESTDIR)$(PREFIX)/bin/$(BIN) 24 25 watch: 26 echo $(SRC) $(HDR) | tr ' ' '\n' | entr -s 'make && ./1d_fd_simple_shear' 27 28 test: $(BIN) 29 make -C test/ 30 31 memtest: $(BIN) 32 valgrind --error-exitcode=1 --leak-check=full $(BIN) -h 33 valgrind --error-exitcode=1 --leak-check=full $(BIN) 34 valgrind --error-exitcode=1 --leak-check=full $(BIN) -F 35 valgrind --error-exitcode=1 --leak-check=full $(BIN) -F \ 36 --fluid-pressure-top 50e3 \ 37 --fluid-pressure-ampl 50e3 \ 38 --fluid-pressure-freq $(echo "1/3600" | bc -l) \ 39 --time-end 3600 40 41 clean: 42 rm -f *.txt 43 rm -f *.o 44 rm -f 1d_fd_simple_shear 45 46 .PHONY: default install uninstall watch test memtest clean