-
Notifications
You must be signed in to change notification settings - Fork 170
Expand file tree
/
Copy pathMakefile
More file actions
61 lines (42 loc) · 1.84 KB
/
Makefile
File metadata and controls
61 lines (42 loc) · 1.84 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
50
51
52
53
54
55
56
57
58
59
60
# 1. Put this file in the same folder as your 'driver' code
# (the code containing the 'main' function).
# 2. Edit LIBRARY_DIR to point at the location of your ITensor Library
# source folder (this is the folder that has options.mk in it)
LIBRARY_DIR=$(HOME)/itensor
# 3. If your 'main' function is in a file called 'myappname.cc', then
# set APP to 'myappname'. Running 'make' will compile the app.
# Running 'make debug' will make a program called 'myappname-g'
# which includes debugging symbols and can be used in gdb (Gnu debugger);
APP=myappname
# 4. Add any headers your program depends on here. The make program
# will auto-detect if these headers have changed and recompile your app.
HEADERS=myclass.h
# 5. For any additional .cc (source) files making up your project,
# add their full filenames here.
CCFILES=$(APP).cc
#################################################################
#################################################################
#################################################################
#################################################################
include $(LIBRARY_DIR)/this_dir.mk
include $(LIBRARY_DIR)/options.mk
TENSOR_HEADERS=$(LIBRARY_DIR)/itensor/core.h
#Mappings --------------
OBJECTS=$(patsubst %.cc,%.o, $(CCFILES))
GOBJECTS=$(patsubst %,.debug_objs/%, $(OBJECTS))
#Rules ------------------
%.o: %.cc $(HEADERS) $(TENSOR_HEADERS)
$(CCCOM) -c $(CCFLAGS) -o $@ $<
.debug_objs/%.o: %.cc $(HEADERS) $(TENSOR_HEADERS)
$(CCCOM) -c $(CCGFLAGS) -o $@ $<
#Targets -----------------
build: $(APP)
debug: $(APP)-g
$(APP): $(OBJECTS) $(ITENSOR_LIBS)
$(CCCOM) $(CCFLAGS) $(OBJECTS) -o $(APP) $(LIBFLAGS)
$(APP)-g: mkdebugdir $(GOBJECTS) $(ITENSOR_GLIBS)
$(CCCOM) $(CCGFLAGS) $(GOBJECTS) -o $(APP)-g $(LIBGFLAGS)
clean:
rm -fr .debug_objs *.o $(APP) $(APP)-g
mkdebugdir:
mkdir -p .debug_objs