diff options
-rw-r--r-- | Makefile | 52 | ||||
-rw-r--r-- | config.asm | 6 | ||||
-rw-r--r-- | config.h | 10 |
3 files changed, 68 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 diff --git a/config.asm b/config.asm new file mode 100644 index 0000000..9eaa8e4 --- /dev/null +++ b/config.asm @@ -0,0 +1,6 @@ +%define ARCH_X86 1 + +%define ARCH_X86_32 0 + +%define ARCH_X86_64 1 + diff --git a/config.h b/config.h new file mode 100644 index 0000000..ab9aef0 --- /dev/null +++ b/config.h @@ -0,0 +1,10 @@ +#ifndef MG2D_CONFIG_H +#define MG2D_CONFIG_H + +#define ARCH_X86 1 + +#define ARCH_X86_64 1 + +#define HAVE_EXTERNAL_ASM 1 + +#endif // MG2D_CONFIG_H |