39 lines
847 B
Makefile
39 lines
847 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
|
|
GOPATH=/home/hdc/repos/nobs/build
|
|
|
|
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
|
|
$(CC) -o $(BUILD_DIR)/test test/main.c -L$(BUILD_DIR) -lcsidh
|
|
|
|
run: all
|
|
GOPATH=$(GOPATH) go run test/torturer.go
|
|
|
|
clean:
|
|
rm -rf build
|