Makefile 3.31 KB
Newer Older
1
2
3
4
5
6
ifndef LG_RT_DIR
$(error LG_RT_DIR variable is not defined, aborting build)
endif

# from Makefile.config
OBJECT        = ../../src/
7
KERNEL_LANG	  = cc_kokkos
8
SRCDIR	      =	$(OBJECT)$(KERNEL_LANG)
9
10
11
12
13
14
15
16
17
18
19
20
# 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
21
GEN_SRC		?= tasks.cc
22

23
INC_FLAGS	?= -I$(NETCDF_ROOT)/include -I$(SRCDIR) -I../tests_c_legion
24
25
26
NVCC_FLAGS	?=
GASNET_FLAGS	?=

27
28
include $(OBJECT)config/Makefile.config

29
30
TESTS = test_CanopyHydrology_kern1_multiple \
        test_CanopyHydrology_module
31
32


33
34
EXEC_TESTS = CanopyHydrology_kern1_multiple \
             CanopyHydrology_module
35

36
37


38

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

45
46
47
48
49
50
51

#
# Legion rules
#
.PHONY: links library test

default: all
52
53
	echo "GEN OBJS = $(GEN_OBJS)"

54
55
56
57
58
59
60
61

all: links library $(TESTS)

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


CanopyHydrology_kern1_multiple: test_CanopyHydrology_kern1_multiple
62
	./test_CanopyHydrology_kern1_multiple > test_CanopyHydrology_kern1_multiple.stdout
63

64
65
66
CanopyHydrology_module: test_CanopyHydrology_module
	./test_CanopyHydrology_module &> test_CanopyHydrology_module.stdout

67

68
69
sandbox: test_sandbox_domain_template_magic
	./test_sandbox_domain_template_magic
Ethan Coon's avatar
Ethan Coon committed
70

71
72
73
74
75
76
77
78
79
80
81
82
83
84
# 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
85
	$(CXX) -o $@ -c $< $(CC_FLAGS) $(CPP_FLAGS) $(INC_FLAGS)
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107

$(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
108
109
%.cc.o : %.cc domains.hh readers.hh utils.hh
	$(CXX) $(CC_FLAGS) $(CPP_FLAGS) $(INC_FLAGS) -c $< -o $@
110
111
112

clean :
	$(ELM_CLEAN)
113
	rm -f test_*
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133

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