Makefile 3.04 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
ifndef LG_RT_DIR
$(error LG_RT_DIR variable is not defined, aborting build)
endif

# from Makefile.config
OBJECT        = ../../src/

# Flags for directing the runtime makefile what to include
DEBUG           ?= 1		# Include debugging symbols
OUTPUT_LEVEL    ?= LEVEL_DEBUG	# Compile time logging level
SHARED_LOWLEVEL ?= 0		# Use shared-memory runtime (not recommended)
USE_CUDA        ?= 0		# Include CUDA support (requires CUDA)
USE_GASNET      ?= 0		# Include GASNet support (requires GASNet)
USE_HDF         ?= 0		# Include HDF5 support (requires HDF5)
ALT_MAPPERS     ?= 0		# Include alternative mappers (not recommended)

# Put the binary file name here

# You can modify these variables, some will be appended to by the runtime makefile
Ethan Coon's avatar
Ethan Coon committed
20
GEN_SRC		?= tasks.cc
21
22
23
24
INC_FLAGS	?= -I$(AMANZI_TPLS_DIR)/include -I../../src/cpp -I../tests_c
NVCC_FLAGS	?=
GASNET_FLAGS	?=

25
26
27
28
29
30
31
32
include $(OBJECT)config/Makefile.config

TESTS = test_CanopyHydrology_kern1_multiple #\
#        test_CanopyHydrology_module


EXEC_TESTS = CanopyHydrology_kern1_multiple #\
#             CanopyHydrology_module
33

34
35
36
37
38
39


#
# Load Legion logic, but not rules
#
NO_BUILD_RULES = 1
40
41
include $(LG_RT_DIR)/runtime.mk

42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59

#
# Legion rules
#
.PHONY: links library test

default: all

all: links library $(TESTS)

test: $(EXEC_TESTS)
	python ../compare_to_gold.py $(TESTS)


CanopyHydrology_kern1_multiple: test_CanopyHydrology_kern1_multiple
	./test_CanopyHydrology_kern1_multiple &> test_CanopyHydrology_kern1_multiple.stdout


Ethan Coon's avatar
Ethan Coon committed
60
61
62
sandbox: test_sandbox
	./sandbox

63
64
65
66
67
68
69
70
71
72
73
74
75
76
# If we're using CUDA we have to link with nvcc
test_%: %.cc.o $(GEN_OBJS) $(GEN_GPU_OBJS) $(SLIB_LEGION) $(SLIB_REALM)
	@echo "---> Linking objects into one binary: $()"
	$(CXX) -o $@ $< $(GEN_OBJS) $(GEN_GPU_OBJS) $(CC_LD_FLAGS) $(LEGION_LIBS) $(LEGION_LD_FLAGS) $(GASNET_FLAGS)

$(SLIB_LEGION) : $(LEGION_OBJS) $(MAPPER_OBJS)
	rm -f $@
	$(AR) rc $@ $^

$(SLIB_REALM) : $(REALM_OBJS)
	rm -f $@
	$(AR) rc $@ $^

$(GEN_OBJS) : %.cc.o : %.cc
Ethan Coon's avatar
Ethan Coon committed
77
	$(CXX) -o $@ -c $< $(CC_FLAGS) $(CPP_FLAGS) $(INC_FLAGS)
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99

$(ASM_OBJS) : %.S.o : %.S
	$(CXX) -o $@ -c $< $(CC_FLAGS) $(INC_FLAGS)

$(REALM_OBJS) : %.cc.o : %.cc
	$(CXX) -o $@ -c $< $(CC_FLAGS) $(INC_FLAGS)

$(LEGION_OBJS) : %.cc.o : %.cc
	$(CXX) -o $@ -c $< $(CC_FLAGS) $(INC_FLAGS)

$(MAPPER_OBJS) : %.cc.o : %.cc
	$(CXX) -o $@ -c $< $(CC_FLAGS) $(INC_FLAGS)

$(GEN_GPU_OBJS) : %.cu.o : %.cu
	$(NVCC) -o $@ -c $< $(NVCC_FLAGS) $(INC_FLAGS)

$(GPU_RUNTIME_OBJS): %.cu.o : %.cu
	$(NVCC) -o $@ -c $< $(NVCC_FLAGS) $(INC_FLAGS)

# disable gmake's default rule for building % from %.o
#% : %.o

Ethan Coon's avatar
Ethan Coon committed
100
101
%.cc.o : %.cc domains.hh readers.hh utils.hh
	$(CXX) $(CC_FLAGS) $(CPP_FLAGS) $(INC_FLAGS) -c $< -o $@
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124

clean :
	$(ELM_CLEAN)

allclean : clean
	$(MAKE) -C $(OBJECT) allclean
	$(RM) -f $(SLIB_LEGION) $(SLIB_REALM) $(GEN_OBJS) $(GEN_GPU_OBJS) $(REALM_OBJS) $(LEGION_OBJS) $(GPU_RUNTIME_OBJS) $(MAPPER_OBJS) $(ASM_OBJS)

ifeq ($(strip $(USE_LLVM)),1)
llvmjit_internal.cc.o : CC_FLAGS += $(LLVM_CXXFLAGS)
%/llvmjit_internal.cc.o : CC_FLAGS += $(LLVM_CXXFLAGS)
endif



links:
	@echo "making in links"
	$(MAKE) -C ../links links


library:
	$(MAKE) -C $(OBJECT) all