-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmakefile
executable file
·54 lines (39 loc) · 979 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
CC = mpicc
CCFLAGS = -O3 -std=gnu99 -Wall
LFLAGS = -lm
CCLIBFLAGS = -fpic
LIBPATH = -L/usr/lib/
INCPATH =
LIB = -lnetwork #-lvectors
SRC = ga.c element.c
INC = $(SRC:.c=.h)
#OBJ = $(SRC:.c=.o)
OBJ = $(addprefix static-lib/, $(patsubst %.c, %.o, $(wildcard *.c)))
OBJD= $(addprefix shared-lib/, $(patsubst %.c, %.o, $(wildcard *.c)))
#vpath %.h ./vectors/
#vpath %.h ./networks/
default: all
all: static-lib libga.a shared-lib libga.so
#static compilation
static-lib:
mkdir static-lib
static-lib/%.o: %.c $(INC)
$(CC) $(CCFLAGS) $(INCPATH) -c $< -o $@
@echo $(OBJ)
libga.a: $(OBJ)
ar rcs libga.a $(OBJ)
cp libga.a ../.
cp libga.a ~/lib/.
shared-lib:
mkdir shared-lib
shared-lib/%.o: %.c $(INC)
$(CC) $(CCFLAGS) $(CCLIBFLAGS) $(INCPATH) -c $< -o $@
@echo $(OBJ)
libga.so: $(OBJD)
$(CC) $(CCFLAGS) -shared $(INCPATH) -o libga.so $(OBJD) $(LFLAGS) -lpthread
@cp libga.so ../.
@cp libga.so ~/lib/.
clean:
rm -rf static-lib
rm -rf shared-lib
rm *.a *.so