trick/trick_source/sim_services/MemoryManager/test/Makefile
2020-10-23 08:28:01 -05:00

222 lines
9.9 KiB
Makefile

#SYNOPSIS:
#
# make [all] - makes everything.
# make TARGET - makes the given target.
# make clean - removes all files generated by make.
include $(dir $(lastword $(MAKEFILE_LIST)))../../../../share/trick/makefiles/Makefile.common
# Replace -isystem with -I so ICG doesn't skip Trick headers
TRICK_SYSTEM_CXXFLAGS := $(subst -isystem,-I,$(TRICK_SYSTEM_CXXFLAGS))
#COVERAGE_FLAGS += -fprofile-arcs -ftest-coverage -O0
#TRICK_SYSTEM_LDFLAGS += ${COVERAGE_FLAGS}
# Flags passed to the preprocessor.
TRICK_CPPFLAGS += -I$(GTEST_HOME)/include -I$(TRICK_HOME)/include -g -Wall -Wextra ${COVERAGE_FLAGS} -std=c++11 ${TRICK_SYSTEM_CXXFLAGS}
TRICK_LIBS = -L${TRICK_LIB_DIR} -ltrick_mm -ltrick_units -ltrick -ltrick_mm -ltrick_units -ltrick
TRICK_EXEC_LINK_LIBS += -L${GTEST_HOME}/lib64 -L${GTEST_HOME}/lib -lgtest -lgtest_main -lpthread
# All tests produced by this Makefile. Remember to add new tests you
# created to the list.
TESTS = MM_creation_unittest \
MM_declare_var_unittest \
MM_declare_var_2_unittest \
MM_declare_extern_var_unittest \
MM_delete_var_unittest \
MM_ref_attributes_unittest \
MM_resize_array_unittest \
MM_strdup_unittest \
MM_write_var_unittest \
MM_sizeof_type_unittest\
MM_read_checkpoint\
MM_clear_var_unittest\
MM_alloc_deps\
MM_write_checkpoint\
MM_write_checkpoint_hexfloat \
MM_get_enumerated\
MM_ref_name_from_address \
Bitfield_tests
#OTHER_OBJECTS = ../../include/object_${TRICK_HOST_CPU}/io_JobData.o \
# ../../include/object_${TRICK_HOST_CPU}/io_SimObject.o
# House-keeping build targets.
all : test
test: $(TESTS)
./MM_creation_unittest --gtest_output=xml:${TRICK_HOME}/trick_test/MM_creation.xml
./MM_declare_var_unittest --gtest_output=xml:${TRICK_HOME}/trick_test/MM_declare_var.xml
./MM_declare_var_2_unittest --gtest_output=xml:${TRICK_HOME}/trick_test/MM_declare_var_2.xml
./MM_declare_extern_var_unittest --gtest_output=xml:${TRICK_HOME}/trick_test/MM_declare_extern_var.xml
./MM_delete_var_unittest --gtest_output=xml:${TRICK_HOME}/trick_test/MM_delete_var.xml
./MM_ref_attributes_unittest --gtest_output=xml:${TRICK_HOME}/trick_test/MM_ref_attributes.xml
./MM_resize_array_unittest --gtest_output=xml:${TRICK_HOME}/trick_test/MM_resize_array.xml
./MM_strdup_unittest --gtest_output=xml:${TRICK_HOME}/trick_test/MM_strdup.xml
./MM_write_var_unittest --gtest_output=xml:${TRICK_HOME}/trick_test/MM_write_var.xml
./MM_sizeof_type_unittest --gtest_output=xml:${TRICK_HOME}/trick_test/MM_sizeof_type.xml
./MM_read_checkpoint --gtest_output=xml:${TRICK_HOME}/trick_test/MM_read_checkpoint_from_string.xml
./MM_clear_var_unittest --gtest_output=xml:${TRICK_HOME}/trick_test/MM_clear_var.xml
./MM_alloc_deps --gtest_output=xml:${TRICK_HOME}/trick_test/MM_alloc_deps.xml
./MM_write_checkpoint --gtest_output=xml:${TRICK_HOME}/trick_test/MM_write_checkpoint.xml
./MM_write_checkpoint_hexfloat --gtest_output=xml:${TRICK_HOME}/trick_test/MM_write_checkpoint_hexfloat.xml
./MM_get_enumerated --gtest_output=xml:${TRICK_HOME}/trick_test/MM_get_enumerated.xml
./MM_ref_name_from_address --gtest_output=xml:${TRICK_HOME}/trick_test/MM_ref_name_from_address.xml
./Bitfield_tests --gtest_output=xml:${TRICK_HOME}/trick_test/Bitfield_tests.xml
code-coverage: test
# Give rid of any old code-coverage HTML we may have.
rm -rf lcov_html
# Gather coverage information about the src code.
lcov --capture \
--directory ../object_${TRICK_HOST_CPU} \
--base-directory ../src \
--output-file src_coverage.info
# Filter out information about directories that we don't care about.
lcov --remove src_coverage.info '/Applications/*' '/usr/include/*' \
--output-file MemoryManager_code_coverage.info
# Generate HTML
genhtml MemoryManager_code_coverage.info \
--output-directory lcov_html
# Clean up
# rm *.info
clean :
rm -f $(TESTS)
rm -f *.o
# Remove gcov/gprof files.
rm -f *.gcno
rm -rf io_src xml
# Builds gtest.a and gtest_main.a.
io_MM_user_defined_types.o : MM_user_defined_types.hh
${TRICK_HOME}/bin/trick-ICG -sim_services -o ./io_src $(TRICK_CPPFLAGS) $<
$(TRICK_CXX) $(TRICK_CPPFLAGS) -c io_src/io_MM_user_defined_types.cpp
io_MM_alloc_deps.o : MM_alloc_deps.hh
${TRICK_HOME}/bin/trick-ICG -sim_services -o ./io_src $(TRICK_CPPFLAGS) $<
$(TRICK_CXX) $(TRICK_CPPFLAGS) -c io_src/io_MM_alloc_deps.cpp
io_MM_write_checkpoint.o : MM_write_checkpoint.hh
${TRICK_HOME}/bin/trick-ICG -sim_services -o ./io_src $(TRICK_CPPFLAGS) $<
$(TRICK_CXX) $(TRICK_CPPFLAGS) -c io_src/io_MM_write_checkpoint.cpp
io_MM_get_enumerated.o : MM_get_enumerated.hh
${TRICK_HOME}/bin/trick-ICG -sim_services -o ./io_src $(TRICK_CPPFLAGS) $<
$(TRICK_CXX) $(TRICK_CPPFLAGS) -c io_src/io_MM_get_enumerated.cpp
io_MM_ref_name_from_address.o : MM_ref_name_from_address.hh
${TRICK_HOME}/bin/trick-ICG -sim_services -o ./io_src $(TRICK_CPPFLAGS) $<
$(TRICK_CXX) $(TRICK_CPPFLAGS) -c io_src/io_MM_ref_name_from_address.cpp
MM_creation_unittest.o : MM_creation_unittest.cc
$(TRICK_CXX) $(TRICK_CPPFLAGS) -c $<
MM_declare_var_unittest.o : MM_declare_var_unittest.cc
$(TRICK_CXX) $(TRICK_CPPFLAGS) -c $<
MM_declare_var_2_unittest.o : MM_declare_var_2_unittest.cc
$(TRICK_CXX) $(TRICK_CPPFLAGS) -c $<
MM_declare_extern_var_unittest.o : MM_declare_extern_var_unittest.cc
$(TRICK_CXX) $(TRICK_CPPFLAGS) -c $<
MM_delete_var_unittest.o : MM_delete_var_unittest.cc
$(TRICK_CXX) $(TRICK_CPPFLAGS) -c $<
MM_ref_attributes_unittest.o : MM_ref_attributes_unittest.cc
$(TRICK_CXX) $(TRICK_CPPFLAGS) -c $<
MM_resize_array_unittest.o : MM_resize_array_unittest.cc
$(TRICK_CXX) $(TRICK_CPPFLAGS) -c $<
MM_strdup_unittest.o : MM_strdup_unittest.cc
$(TRICK_CXX) $(TRICK_CPPFLAGS) -c $<
MM_write_var_unittest.o : MM_write_var_unittest.cc
$(TRICK_CXX) $(TRICK_CPPFLAGS) -c $<
MM_sizeof_type_unittest.o : MM_sizeof_type_unittest.cc
$(TRICK_CXX) $(TRICK_CPPFLAGS) -c $<
MM_read_checkpoint.o : MM_read_checkpoint.cc
$(TRICK_CXX) $(TRICK_CPPFLAGS) -c $<
MM_clear_var_unittest.o : MM_clear_var_unittest.cc
$(TRICK_CXX) $(TRICK_CPPFLAGS) -c $<
MM_alloc_deps.o : MM_alloc_deps.cc
$(TRICK_CXX) $(TRICK_CPPFLAGS) -c $<
MM_write_checkpoint.o : MM_write_checkpoint.cc
$(TRICK_CXX) $(TRICK_CPPFLAGS) -c $<
MM_get_enumerated.o : MM_get_enumerated.cc
$(TRICK_CXX) $(TRICK_CPPFLAGS) -c $<
MM_ref_name_from_address.o : MM_ref_name_from_address.cc
$(TRICK_CXX) $(TRICK_CPPFLAGS) -c $<
MM_write_checkpoint_hexfloat.o : MM_write_checkpoint_hexfloat.cc
$(TRICK_CXX) $(TRICK_CPPFLAGS) -c $<
Bitfield_tests.o : Bitfield_tests.cpp
$(TRICK_CXX) $(TRICK_CPPFLAGS) -c $<
MM_creation_unittest : MM_creation_unittest.o
$(TRICK_CXX) $(TRICK_SYSTEM_LDFLAGS) -o $@ $^ -L${TRICK_HOME}/lib_${TRICK_HOST_CPU} $(TRICK_LIBS) $(TRICK_EXEC_LINK_LIBS)
MM_declare_var_unittest : MM_declare_var_unittest.o io_MM_user_defined_types.o
$(TRICK_CXX) $(TRICK_SYSTEM_LDFLAGS) -o $@ $^ -L${TRICK_HOME}/lib_${TRICK_HOST_CPU} $(TRICK_LIBS) $(TRICK_EXEC_LINK_LIBS)
MM_declare_var_2_unittest : MM_declare_var_2_unittest.o io_MM_user_defined_types.o
$(TRICK_CXX) $(TRICK_SYSTEM_LDFLAGS) -o $@ $^ -L${TRICK_HOME}/lib_${TRICK_HOST_CPU} $(TRICK_LIBS) $(TRICK_EXEC_LINK_LIBS)
MM_declare_extern_var_unittest : MM_declare_extern_var_unittest.o io_MM_user_defined_types.o
$(TRICK_CXX) $(TRICK_SYSTEM_LDFLAGS) -o $@ $^ -L${TRICK_HOME}/lib_${TRICK_HOST_CPU} $(TRICK_LIBS) $(TRICK_EXEC_LINK_LIBS)
MM_delete_var_unittest : MM_delete_var_unittest.o
$(TRICK_CXX) $(TRICK_SYSTEM_LDFLAGS) -o $@ $^ -L${TRICK_HOME}/lib_${TRICK_HOST_CPU} $(TRICK_LIBS) $(TRICK_EXEC_LINK_LIBS)
MM_ref_attributes_unittest : MM_ref_attributes_unittest.o io_MM_user_defined_types.o
$(TRICK_CXX) $(TRICK_SYSTEM_LDFLAGS) -o $@ $^ -L${TRICK_HOME}/lib_${TRICK_HOST_CPU} $(TRICK_LIBS) $(TRICK_EXEC_LINK_LIBS)
MM_resize_array_unittest : MM_resize_array_unittest.o io_MM_user_defined_types.o
$(TRICK_CXX) $(TRICK_SYSTEM_LDFLAGS) -o $@ $^ -L${TRICK_HOME}/lib_${TRICK_HOST_CPU} $(TRICK_LIBS) $(TRICK_EXEC_LINK_LIBS)
MM_strdup_unittest : MM_strdup_unittest.o
$(TRICK_CXX) $(TRICK_SYSTEM_LDFLAGS) -o $@ $^ -L${TRICK_HOME}/lib_${TRICK_HOST_CPU} $(TRICK_LIBS) $(TRICK_EXEC_LINK_LIBS)
MM_write_var_unittest : MM_write_var_unittest.o io_MM_user_defined_types.o
$(TRICK_CXX) $(TRICK_SYSTEM_LDFLAGS) -o $@ $^ -L${TRICK_HOME}/lib_${TRICK_HOST_CPU} $(TRICK_LIBS) $(TRICK_EXEC_LINK_LIBS)
MM_sizeof_type_unittest : MM_sizeof_type_unittest.o io_MM_user_defined_types.o
$(TRICK_CXX) $(TRICK_SYSTEM_LDFLAGS) -o $@ $^ -L${TRICK_HOME}/lib_${TRICK_HOST_CPU} $(TRICK_LIBS) $(TRICK_EXEC_LINK_LIBS)
MM_read_checkpoint : MM_read_checkpoint.o io_MM_user_defined_types.o
$(TRICK_CXX) $(TRICK_SYSTEM_LDFLAGS) -o $@ $^ -L${TRICK_HOME}/lib_${TRICK_HOST_CPU} $(TRICK_LIBS) $(TRICK_EXEC_LINK_LIBS)
MM_clear_var_unittest : MM_clear_var_unittest.o io_MM_user_defined_types.o
$(TRICK_CXX) $(TRICK_SYSTEM_LDFLAGS) -o $@ $^ -L${TRICK_HOME}/lib_${TRICK_HOST_CPU} $(TRICK_LIBS) $(TRICK_EXEC_LINK_LIBS)
MM_alloc_deps : MM_alloc_deps.o io_MM_alloc_deps.o
$(TRICK_CXX) $(TRICK_SYSTEM_LDFLAGS) -o $@ $^ -L${TRICK_HOME}/lib_${TRICK_HOST_CPU} $(TRICK_LIBS) $(TRICK_EXEC_LINK_LIBS)
MM_write_checkpoint : MM_write_checkpoint.o io_MM_write_checkpoint.o
$(TRICK_CXX) $(TRICK_SYSTEM_LDFLAGS) -o $@ $^ -L${TRICK_HOME}/lib_${TRICK_HOST_CPU} $(TRICK_LIBS) $(TRICK_EXEC_LINK_LIBS)
MM_get_enumerated : MM_get_enumerated.o io_MM_get_enumerated.o
$(TRICK_CXX) $(TRICK_SYSTEM_LDFLAGS) -o $@ $^ -L${TRICK_HOME}/lib_${TRICK_HOST_CPU} $(TRICK_LIBS) $(TRICK_EXEC_LINK_LIBS)
MM_ref_name_from_address : MM_ref_name_from_address.o io_MM_ref_name_from_address.o
$(TRICK_CXX) $(TRICK_SYSTEM_LDFLAGS) -o $@ $^ -L${TRICK_HOME}/lib_${TRICK_HOST_CPU} $(TRICK_LIBS) $(TRICK_EXEC_LINK_LIBS)
MM_write_checkpoint_hexfloat : MM_write_checkpoint_hexfloat.o io_MM_write_checkpoint.o
$(TRICK_CXX) $(TRICK_SYSTEM_LDFLAGS) -o $@ $^ -L${TRICK_HOME}/lib_${TRICK_HOST_CPU} $(TRICK_LIBS) $(TRICK_EXEC_LINK_LIBS)
Bitfield_tests : Bitfield_tests.o
$(TRICK_CXX) $(TRICK_SYSTEM_LDFLAGS) -o $@ $^ -L${TRICK_HOME}/lib_${TRICK_HOST_CPU} $(TRICK_LIBS) $(TRICK_EXEC_LINK_LIBS)