forked from lanl/SICM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
51 lines (39 loc) · 1.79 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
51
CC := gcc
FC := gfortran
CXX := g++
INCLUDES := sicm_low.h
SOURCES := sicm_low sicm_arena
JEMALLOCDIR := $(HOME)/jemalloc
IDIR := include
CFLAGS := -I$(IDIR) -I$(JEMALLOCDIR)/include -fPIC -Wall -fopenmp -O2
LDFLAGS := -L$(JEMALLOCDIR)/lib -lnuma -ljemalloc
ODIR := obj
SDIR := src
DEPS := $(patsubst %,$(IDIR)/%,$(INCLUDES))
OBJ = $(patsubst %,$(ODIR)/%.o,$(SOURCES))
sg: $(OBJ) obj/sg_fshim.o obj/sg.o src/sg.f90 src/sg.cpp sicm
$(CC) -o libsg.so obj/sg.o $(OBJ) -shared $(CFLAGS)
$(CXX) -o libsgcpp.so src/sg.cpp obj/sg.o $(OBJ) -shared $(CFLAGS)
$(FC) -o libsgf.so src/sg.f90 obj/sg_fshim.o obj/sg.o $(OBJ) -shared $(CFLAGS)
sicm: $(OBJ)
$(CC) -o lib$@.so $^ -shared $(CFLAGS) $(LDFLAGS)
fortran: src/fbinding.f90 $(OBJ) obj/fbinding.o
$(FC) -o sicm_f90.so src/fbinding.f90 obj/fbinding.o $(OBJ) -shared $(CFLAGS) $(LDFLAGS)
obj/sicm_cpp.o: src/sicm_cpp.cpp include/sicm_cpp.hpp $(OBJ)
$(CXX) -o obj/sicm_cpp.o -c src/sicm_cpp.cpp $(CFLAGS)
cpp: obj/sicm_cpp.o $(OBJ)
$(CXX) -o libsicm_cpp.so obj/sicm_cpp.o $(OBJ) -shared $(CFLAGS)
.PHONY: examples
examples: sicm sg
$(CC) -o examples/basic examples/basic.c -L. -lsicm $(CFLAGS) $(LDFLAGS)
$(CC) -o examples/hugepages examples/hugepages.c -L. -lsicm $(CFLAGS) $(LDFLAGS)
$(CXX) -o examples/class examples/class.cpp -L. -lsicm_cpp $(CFLAGS) $(LDFLAGS)
$(CXX) -o examples/stl examples/stl.cpp -L. -lsicm_cpp $(CFLAGS) $(LDFLAGS)
$(CC) -o examples/greedy examples/greedy.c -L. -lsg $(CFLAGS) $(LDFLAGS)
$(CXX) -o examples/greedypp examples/greedypp.cpp -L. -lsgcpp $(CFLAGS) $(LDFLAGS)
$(FC) -o examples/greedyf examples/greedyf.f90 -L. -lsgf $(CFLAGS) $(LDFLAGS)
$(CC) -o examples/simple_knl_test examples/simple_knl_test.c -L. -lsg $(CFLAGS) $(LDFLAGS)
clean: $(OBJ) *.so
/bin/rm obj/* *.so
$(ODIR)/%.o: $(SDIR)/%.c $(DEPS)
$(CC) $(CFLAGS) -o $@ -c $<