summaryrefslogtreecommitdiff
path: root/OASIS/c/Makefile
blob: 7de5117f55cc56aa857debe19d92a676e8b7e2d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
CC = gcc
CFLAGS = -g -Wall -rdynamic -ggdb -O3 -fno-omit-frame-pointer -fopenmp -I/usr/include/gnu
SRC_DIR = src
OBJ_DIR = build
TARGET = $(OBJ_DIR)/model
SRCS = $(wildcard $(SRC_DIR)/*.c)
OBJS = $(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.o,$(SRCS))
DEPS = $(wildcard $(SRC_DIR)/*.h)

all: ulimit $(TARGET)

ulimit:
	ulimit -c unlimited

$(TARGET): $(OBJS)
	$(CC) $(CFLAGS) -o $@ $^ -lm -lopenblas

$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c $(DEPS)
	mkdir -p $(OBJ_DIR)
	$(CC) $(CFLAGS) -c -o $@ $< -I$(SRC_DIR)

run: $(TARGET)
	./$(TARGET)

debug: ulimit $(TARGET)
	gdb -c /tmp/core $(TARGET)

valgrind: $(TARGET)
	valgrind --leak-check=full --track-origins=yes ./$(TARGET)

clean:
	rm -rf $(OBJ_DIR)/*.o $(TARGET) core*

.PHONY: all ulimit run debug valgrind clean