Sha256: 5a822b1c0e9cb80c7fc3e0205671c517b494f612da28baecb2d488e5bd3c97f0

Contents?: true

Size: 1.28 KB

Versions: 1

Compression:

Stored size: 1.28 KB

Contents

CFLAGS := $(shell printenv CFLAGS) -O2 -Wall -fPIC -Wno-deprecated-declarations
SO_LINKS = $(shell printenv LDFLAGS) -lm -lcrypto

UNAME := $(shell uname -s)
ifeq ($(UNAME),Darwin)
LIB = libfpe.a libfpe.dylib
else
LIB = libfpe.a libfpe.so
endif

EXAMPLE_SRC = example.c
EXAMPLE_EXE = example
OBJS = src/ff1.o src/ff3.o src/fpe_locl.o


all: $(LIB) $(EXAMPLE_EXE)

libfpe.a: $(OBJS)
	ar rcs $@ $(OBJS)

ifeq ($(UNAME),Darwin)
libfpe.dylib: $(OBJS)
	gcc -shared -fPIC -Wl,-install_name,libfpe.dylib $(OBJS) $(SO_LINKS) -o $@
else
libfpe.so: $(OBJS)
	gcc -shared -fPIC -Wl,-soname,libfpe.so $(OBJS) $(SO_LINKS) -o $@
endif

.PHONY = all clean install

src/ff1.o: src/ff1.c
	gcc $(CFLAGS) -c src/ff1.c -o $@

src/ff3.o: src/ff3.c
	gcc $(CFLAGS) -c src/ff3.c -o $@

src/fpe_locl.o: src/fpe_locl.c
	gcc $(CFLAGS) -c src/fpe_locl.c -o $@

$(EXAMPLE_EXE): $(EXAMPLE_SRC) $(LIB)
ifeq ($(UNAME),Darwin)
	gcc $(CFLAGS) -Wl, $(EXAMPLE_SRC) -L. -lfpe $(SO_LINKS) -Isrc -o $@
else
	gcc $(CFLAGS) -Wl,-rpath=\$$ORIGIN $(EXAMPLE_SRC) -L. -lfpe $(SO_LINKS) -Isrc -o $@
endif

test:
	python test.py

# MacOS
leaks:
	leaks -atExit --  ./example EF4359D8D580AA4F7F036D6F04FC6A94 D8E7920AFA330A73 10 890121234567890000

clean:
	rm $(OBJS) $(EXAMPLE_EXE) $(LIB)

install:
	cp libfpe.so /usr/local/lib
	cp src/*.h /usr/local/include

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby_clang_fpe-0.1.0 vendor/clang-fpe/Makefile