-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
49 lines (38 loc) · 1.42 KB
/
Makefile
File metadata and controls
49 lines (38 loc) · 1.42 KB
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
#Call "./configure" to configure the library, then "make" to build the project. "make clean" clears up the .o files.
#Name of the output library
TARGET = eis
#The object files to build
OBJS = eis.o
#Nothing after here should be modified, unless you know what you are doing.
#PARI_LIB is folder where libpari.so/libpari.dylib is found, PARI_INCLUDE is where the pari.h header file is found, and PARI_CFG is the location of pari.cfg.
PARI_LOC = $(TARGET).cfg
PARI_CFG = $(shell grep "CFG=" "$(PARI_LOC)" -s | cut -d"'" -f2)
ifeq ($(PARI_CFG), )
PARI_CFG = /usr/local/lib/pari/pari.cfg
endif
PARI_LIB = $(shell grep "libdir=" "$(PARI_CFG)" -s | cut -d"'" -f2)
PARI_INCLUDE = $(shell grep "includedir=" "$(PARI_CFG)" -s | cut -d"'" -f2)/pari
#Naming the library file to include the version of pari/gp.
VER = $(shell grep "pari_release=" "$(PARI_CFG)" -s | cut -d"'" -f2 | tr . - | cut -d"-" -f1,2,3)
DYN = lib$(TARGET)-$(VER).so
#Compiling options
CC = cc
CFLAGS = -O3 -Wall -fno-strict-aliasing -fPIC -march=native
RM = rm -f
#System check as -shared option for linker fails on MacOS
ifneq ($(shell uname -s), Darwin)
OS_FLAG = -Wl,-shared
else
OS_FLAG =
endif
#Recipes
all: $(DYN)
#Build the shared library object
$(DYN): $(OBJS)
$(CC) -o $@ -shared $(CFLAGS) $(OS_FLAG) $(OBJS) -lc -lm -L$(PARI_LIB) -lpari
#Make the object files
%.o: %.c
$(CC) -c $(CFLAGS) -I. -I$(PARI_INCLUDE) $<
#Clear all .o files
clean:
$(RM) *.o $(ALL)