summaryrefslogtreecommitdiff
path: root/OASIS/c/Makefile
diff options
context:
space:
mode:
authorEric Dao <eric@erickhangdao.com>2023-05-12 14:09:07 -0400
committerEric Dao <eric@erickhangdao.com>2023-05-12 14:09:07 -0400
commit191e4bd8beae134295d481773823142d2fdc6a98 (patch)
treeaaca4e7f8e229f9bd551d9bb1583b8ecd7a59d4a /OASIS/c/Makefile
parent186daed7e179241377c117e9d208ccd301d4d712 (diff)
downloadura-master.tar.gz
ura-master.tar.bz2
ura-master.zip
refactored tool chain setup, able to debug and run from vscode nowHEADmaster
Diffstat (limited to 'OASIS/c/Makefile')
-rw-r--r--OASIS/c/Makefile34
1 files changed, 34 insertions, 0 deletions
diff --git a/OASIS/c/Makefile b/OASIS/c/Makefile
new file mode 100644
index 0000000..7de5117
--- /dev/null
+++ b/OASIS/c/Makefile
@@ -0,0 +1,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