-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
61 lines (47 loc) · 1.51 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
52
53
54
55
56
57
58
59
60
MAKEFLAGS += --no-print-directory
# build options to test dynamic library
LIB_WEILEI_PATH=/rhome/wzeng002/.local/lib
LIB_WEILEI=-L$(LIB_WEILEI_PATH) -lweilei -Iweilei_lib
INC_DIR=weilei_lib
#INC_DIR=~/working/weilei_lib
CXX=g++ -O3 -Wall -std=c++11 -fopenmp
CXX=g++ -O3 -Wall -std=c++11
# optimization options -O2 -O5 -Os
ITPP=`pkg-config --cflags itpp` `pkg-config --libs itpp`
#full command example
#g++ `pkg-config --cflags itpp` -o hello.out hello.cpp `pkg-config --libs itpp` -fopenmp
object_files=$(INC_DIR)/mm_read.o $(INC_DIR)/mmio.o $(INC_DIR)/mm_write.o $(INC_DIR)/lib.o $(INC_DIR)/dist.o $(INC_DIR)/product_lib.o $(INC_DIR)/bp.o
header_files=$(INC_DIR)/mm_read.h $(INC_DIR)/mmio.h $(INC_DIR)/mm_write.h $(INC_DIR)/lib.h $(INC_DIR)/dist.h $(INC_DIR)/product_lib.h $(INC_DIR)/bp.h
#make object file for target file
%.o:%.cpp $(header_files)
$(CXX) $(START) $(END) -c $<
#compile object files for lib files
lib:
cd weilei_lib && make all
#now link object files
%.out:%.o $(object_files)
$(CXX) $(ITPP) -o $@ $< $(object_files)
cmd=make lib && make [email protected] && make [email protected]
# eg: make test.o && make lib && make test.out
product:
$(cmd)
test:
$(cmd)
test_lib:
$(cmd)
#add your new files here
clean:
rm *.o
rm *.out
#job management
sbatch-dry-run:
sbatch --test run_prod.sh
sbatch:
sbatch run_prod.sh
pkill-product:
pkill .product
#test dynamic lib
dynamic:$(LIB_WEILEI_PATH)/libweilei.so
cd weilei_lib && make libweilei.so
$(CXX) $(ITPP) -o test_dynamic.out test.cpp -lweilei -L$(LIB_WEILEI_PATH)
./test_dynamic.out