Commit a093730a authored by Coon, Ethan's avatar Coon, Ethan
Browse files

continued rework of make

parent 05f2b006
......@@ -79,5 +79,5 @@ CUDA_INCDIRS=-I/usr/local/cuda-10.0/include
#
# Legion tests
# ---------------------------------
LG_RT_DIR ?= /Users/uec/codes/legion/repos/dev/
LG_RT_DIR ?= /Users/uec/codes/legion/repos/dev/runtime
ifndef LG_RT_DIR
$(error LG_RT_DIR variable is not defined, aborting build)
endif
ELM_BASE = ../../src
KERNEL_FOLDER = cc
ELM_ROOT = $(ELM_BASE)/$(KERNEL_FOLDER)
# from Makefile.config
OBJECT = ../../src/
KERNEL_LANG = cc
SRCDIR = $(OBJECT)$(KERNEL_LANG)
NATURE =
# Flags for directing the runtime makefile what to include
DEBUG ?= 1 # Include debugging symbols
OUTPUT_LEVEL ?= LEVEL_DEBUG # Compile time logging level
......@@ -16,27 +11,18 @@ 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
GEN_SRC ?= tasks.cc
# include the user's config
include $(ELM_BASE)/config/Makefile.config
INC_FLAGS ?= -I$(NETCDF_ROOT)/include -I$(SRCDIR) -I../tests_legion_c
# legion variables
CC_FLAGS= -DLEGION_SPY
NVCC_FLAGS ?=
GASNET_FLAGS ?=
CC = mpicc
include $(OBJECT)config/Makefile.config
TESTS = test_CanopyHydrology_kern1_multiple \
test_CanopyHydrology_module
EXEC_TESTS = CanopyHydrology_kern1_multiple \
CanopyHydrology_module
# note: INC_FLAGS is defined by legion
CXXFLAGS += $(NETCDF_INC_FLAGS) $(INC_FLAGS)
CXX_LD_FLAGS += $(NETCDF_FLAGS)
#
# Load Legion logic, but not rules
......@@ -44,17 +30,25 @@ EXEC_TESTS = CanopyHydrology_kern1_multiple \
NO_BUILD_RULES = 1
include $(LG_RT_DIR)/runtime.mk
# now include our rules
include $(ELM_BASE)/config/Makefile.rules
TESTS = test_CanopyHydrology_kern1_multiple \
test_CanopyHydrology_module
EXEC_TESTS = CanopyHydrology_kern1_multiple \
CanopyHydrology_module
#
# Legion rules
#
.PHONY: links library test
.PHONY: links test
default: all
echo "GEN OBJS = $(GEN_OBJS)"
all: links library $(TESTS)
all: links $(TESTS)
test: $(EXEC_TESTS)
python ../compare_to_gold.py $(TESTS)
......@@ -75,9 +69,9 @@ sandbox: test_sandbox_domain_template_magic
./test_sandbox_domain_template_magic
# If we're using CUDA we have to link with nvcc
test_%: %.cc.o $(GEN_OBJS) $(GEN_GPU_OBJS) $(SLIB_LEGION) $(SLIB_REALM)
test_%: %.cpp.o tasks.cpp.o $(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)
$(CXX) -o $@ $< tasks.cpp.o $(CXX_LD_FLAGS) $(LEGION_LIBS) $(LEGION_LD_FLAGS) $(GASNET_FLAGS)
$(SLIB_LEGION) : $(LEGION_OBJS) $(MAPPER_OBJS)
rm -f $@
......@@ -87,32 +81,19 @@ $(SLIB_REALM) : $(REALM_OBJS)
rm -f $@
$(AR) rc $@ $^
$(GEN_OBJS) : %.cc.o : %.cc
$(CXX) -o $@ -c $< $(CC_FLAGS) $(CPP_FLAGS) $(INC_FLAGS)
$(GEN_OBJS) : %.cpp.o : %.cpp
$(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
%.cc.o : %.cc domains.hh readers.hh utils.hh
$(CXX) $(CXXFLAGS) $(NETCDF_FLAGS) $(INC_FLAGS) -c $< -o $@
clean :
$(ELM_CLEAN)
......@@ -123,8 +104,8 @@ allclean : clean
$(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)
llvmjit_internal.cpp.o : CC_FLAGS += $(LLVM_CXXFLAGS)
%/llvmjit_internal.cpp.o : CC_FLAGS += $(LLVM_CXXFLAGS)
endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment