summaryrefslogtreecommitdiff
blob: e2932be0fa0b613be1f0290e2ca3d2ca9cc4cd61 (plain)
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
--- Makefile.orig	2009-08-10 21:37:55.000000000 +0100
+++ Makefile	2009-08-10 22:07:35.000000000 +0100
@@ -1,14 +1,11 @@
 
 # Sorry, this makefile is kind of ugly, so pending a choice for an
 # appropriate building tool, we'll simply avoid make -j for this one.
-.NOTPARALLEL:
+#.NOTPARALLEL:
 
 # Default flags
-CFLAGS:=-O2 -DNDEBUG
-CXXFLAGS:=$(CFLAGS)
-
-ALWAYS_CFLAGS:=-std=c99 -g -W -Wall
-ALWAYS_CXXFLAGS:=-g -W -Wall
+ALWAYS_CFLAGS:=-std=c99 -W -Wall -DNDEBUG
+ALWAYS_CXXFLAGS:=-W -Wall -DNDEBUG
 
 # Start with defaults that should never be overridden
 MY_CFLAGS=$(ALWAYS_CFLAGS)
@@ -37,10 +34,12 @@
 .c.o:
 	$(CC) $(MY_CFLAGS) $< -c -o $@
 
+.SUFFIXES: .lo
+.c.lo:
+	$(CC) $(MY_CFLAGS) -fPIC $< -c -o $@
+
 ifeq ($(shell arch),i686)
 w:=32
-CFLAGS+=-msse2
-CXXFLAGS+=-msse2
 endif
 
 ifeq ($(shell arch),x86_64)
@@ -52,7 +51,7 @@
 
 .PHONY: all tune1
 
-all: tune1 libgf2x.a tunetoom
+all: tune1 libgf2x.a libgf2x.so tunetoom
 
 LIBGF2X_FILES:=mul-toom.c mul-gf2x.c mulfft-bit.c
 
@@ -60,6 +59,11 @@
 	rm -f $@
 	ar qcv $@ $^
 
+libgf2x.so: $(patsubst %.c,%.lo,$(LIBGF2X_FILES))
+	rm -f $@
+	$(CC) -shared $(LDFLAGS) -Wl,-soname,libgf2x.so.0 -o libgf2x.so.0 $^
+	ln -s libgf2x.so.0 libgf2x.so
+
 gen_bb_mul_code:	gen_bb_mul_code.c
 	$(CC) $(MY_CFLAGS) $< -o $@
 
@@ -141,6 +145,7 @@
 	-rm -f bench update-thresholds tunetoom tunefft libgf2x.a
 	-rm -f check*.res factor
 	-rm -f *.o
+	-rm -f *.lo libgf2x.so libgf2x.so.0
 
 gf2x.h:	mul-inlines.c mul-small.c mul-basecase.c thresholds.h
 mul-kara.o: gf2x.h thresholds.h