diff options
author | Anton Khirnov <anton@khirnov.net> | 2022-11-23 16:09:08 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2022-11-23 16:27:59 +0100 |
commit | bda9a532a8edfbac51717979fc11117a9bdfee30 (patch) | |
tree | 25e8772b8cd86e4034c6c12dc6f6d31fef769e83 /Makefile | |
parent | 71c57b6bb58ac03699e0c9723c9a5765e2526690 (diff) |
Preliminary make support.make
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 52 |
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 |