diff --git a/csidh/Makefile b/csidh/Makefile new file mode 100644 index 0000000..eb654ef --- /dev/null +++ b/csidh/Makefile @@ -0,0 +1,33 @@ +objify = $(patsubst %.c,$(BUILD_DIR)/%.$2,$(patsubst %.s,$(BUILD_DIR)/%.$2,$1)) + +CFLAGS=-Wall -Wextra -Wpedantic -O3 -funroll-loops +LDFLAGS= +BUILD_DIR=build +AR=ar rcs +RANLIB=ranlib + +CODE_SRC_C = \ + ref/csidh/rng.c \ + ref/csidh/mont.c \ + ref/csidh/csidh.c +CODE_SRC_S = \ + ref/csidh/u512.s \ + ref/csidh/fp.s +CODE_OBJ = \ + $(call objify,$(CODE_SRC_C),o) \ + $(call objify,$(CODE_SRC_S),o) + +$(BUILD_DIR)/%.o: %.c + case $@ in */*) f=$@; mkdir -p $${f%/*} ;; esac + $(CC) -c -o $@ $< $(CFLAGS) + +$(BUILD_DIR)/%.o: %.s + case $@ in */*) f=$@; mkdir -p $${f%/*} ;; esac + $(CC) -c -o $@ $< $(CFLAGS) + +all: $(CODE_OBJ) + $(AR) $(BUILD_DIR)/libcsidh.a $^ + $(RANLIB) $(BUILD_DIR)/libcsidh.a + +clean: + rm -rf build