forked from msotoodeh/integer-encoder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
51 lines (35 loc) · 1.14 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#
TARGET_SYS = $(shell gcc -dumpmachine)
ifneq ($(findstring x86_64,$(TARGET_SYS)),)
CFLAGS = -m64 -fno-asm -Wno-format -D_LINUX_
else
CFLAGS = -m32 -march=i386 -D__i386__ -D_LINUX_
endif
# random.c is used for test files
LIB_SRCS = ayden32.c ayden64.c ayden_init.c prng.c sha256.c random.c
LIB_OBJS = $(LIB_SRCS:%.c=build/%.o)
LIB_TARGET = build/libintncoder.a
CFLAGS += -Iinclude
.PHONY: all clean distclean test
default: all
all: test
init:
@[ -d build ] || mkdir build
build/%.o: src/%.c
gcc $(CFLAGS) -o $@ -c $<
build/%.o: test/%.c
gcc $(CFLAGS) -o $@ -c $<
$(LIB_TARGET): init $(LIB_OBJS)
ar r $@ $(LIB_OBJS)
build/test_ayden32: build/test_ayden32.o $(LIB_TARGET)
g++ -static -o $@ build/test_ayden32.o $(LIB_TARGET)
build/test_ayden64: build/test_ayden64.o $(LIB_TARGET)
g++ -static -o $@ build/test_ayden64.o $(LIB_TARGET)
test: init build/test_ayden32 build/test_ayden64
./build/test_ayden32 || exit 1
./build/test_ayden64 || exit 1
./build/test_ayden32 my-secret-key 1000 20000 40000 || exit 1
clean:
@rm -rf build/*
distclean: clean
@rm -rf windows/Debug/ windows/Release/ windows/ipch/ windows/x64/ windows/*.sdf windows/*.suo