sidh_torture/csidh/Makefile

39 lines
843 B
Makefile
Raw Normal View History

2019-01-15 17:10:24 +00:00
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
2019-01-16 17:20:24 +00:00
GOPATH=/home/hdc/repos/nobs/build
2019-01-15 17:10:24 +00:00
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
2019-01-15 18:40:54 +00:00
$(CC) -o $(BUILD_DIR)/test test/main.c -L$(BUILD_DIR) -lcsidh
2019-01-15 17:10:24 +00:00
2019-01-16 17:20:24 +00:00
run: all
GOPATH=$(GOPATH) go run test/test.go
2019-01-15 17:10:24 +00:00
clean:
rm -rf build