34 lines
698 B
Makefile
34 lines
698 B
Makefile
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
|