aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile52
1 files changed, 52 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..ddf36c8
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,52 @@
+TARGET = libmg2d.so
+
+CC = cc
+
+SRC_DIR = ./src/
+
+VPATH = $(SRC_DIR)
+
+CFLAGS = -std=c11 -fPIC
+CFLAGS += -g -O3
+CFLAGS += -D_XOPEN_SOURCE=700 # POSIX
+CFLAGS += -D_DEFAULT_SOURCE=1 # for random_r
+CFLAGS += -I$(SRC_DIR)/
+
+TARGET_LDFLAGS = -Wl,--version-script=$(SRC_DIR)/libmg2d.v -shared -lm -llapacke -lthreadpool -lndarray -lmpi
+TEST_LIBS = -lm -llapacke -lcblas -lpthread
+
+OBJS = \
+ bicgstab.c.o \
+ boundary.c.o \
+ components.c.o \
+ cpu.c.o \
+ cpuid.asm.o \
+ ell_grid_solve.c.o \
+ log.c.o \
+ mg2d.o \
+ ndarray.asm.o \
+ residual_calc.asm.o \
+ residual_calc.c.o \
+ step_control.c.o \
+ timer.c.o \
+ transfer.c.o \
+ transfer_interp.asm.o \
+
+all: $(TARGET)
+
+$(TARGET): $(OBJS)
+ $(CC) -o $@ $(OBJS) ${TARGET_LDFLAGS}
+
+%.c.o: %.c
+ $(CC) $(CFLAGS) -MMD -MF $(@:.o=.d) -MT $@ -c -o $@ $<
+
+%.asm.o: %.asm
+ nasm -i $(SRC_DIR) -f elf64 -M $< > $(@:.o=.d)
+ nasm -i $(SRC_DIR) -f elf64 -o $@ $<
+
+clean:
+ -rm -f *.o *.d *.pyc $(TARGET)
+
+-include $(OBJS:.o=.d)
+
+.PHONY: clean