-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
36 lines (28 loc) · 1005 Bytes
/
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
CXXFLAGS=-O2 -std=gnu++0x -Wall -pedantic
LDFLAGS=-O2
LIBS=-lgmpxx -lgmp
all: factor
factor: main.cpp fermat.o rho.o qs.o
$(CXX) -c $(CXXFLAGS) -o main.o main.cpp
$(CXX) $(LDFLAGS) -o factor main.o fermat.o rho.o qs.o $(LIBS)
rho.o: rho.cpp rho.h
$(CXX) -c $(CXXFLAGS) -o rho.o rho.cpp
fermat.o: fermat.cpp fermat.h
$(CXX) -c $(CXXFLAGS) -o fermat.o fermat.cpp
qs.o: qs.cpp qs.h matrix.h
$(CXX) -c $(CXXFLAGS) -o qs.o qs.cpp
test: test-50bits test-55bits test-60bits test-65bits test-70bits test-75bits \
test-80bits test-85bits test-90bits test-95bits test-100bits
test-%: factor
@echo running tests in data/test$*.in
@while read N p q; do \
actual=$$(printf $$N | ./factor | sort); \
expected=$$(printf "$$p\n$$q\n\n" | sort); \
if [ "$$actual" != "$$expected" ]; then \
echo test case $$N $$p $$q in data/test$*.in failed; \
echo expected: \"$$expected\", but got \"$$actual\"; \
exit 1; \
fi \
done < data/test$*.in
clean:
-@rm *.o factor 2> /dev/null || true