trick/trick_source/sim_services/MemoryManager/test/Makefile
Alex Lin d3acfa5fc0 Test code does not work with new directory locations.
Adjusted all of the source code to point to the header files in their new
locations.  Adjusted the makefiles for the header locations as well.
Added .gitignore files in the test directories to ignore test object code.
2015-06-22 16:11:08 -05:00

221 lines
9.7 KiB
Makefile

#SYNOPSIS:
#
# make [all] - makes everything.
# make TARGET - makes the given target.
# make clean - removes all files generated by make.
include ${TRICK_HOME}/share/trick/makefiles/Makefile.common
#COVERAGE_FLAGS += -fprofile-arcs -ftest-coverage -O0
#TRICK_LDFLAGS += ${COVERAGE_FLAGS}
# Flags passed to the preprocessor.
TRICK_CPPFLAGS += -I$(GTEST_HOME)/include -I$(TRICK_HOME)/include -g -Wall -Wextra ${COVERAGE_FLAGS}
TRICK_LIBS = ${TRICK_LIB_DIR}/libtrick.a
TRICK_EXEC_LINK_LIBS += ${GTEST_HOME}/lib/libgtest.a ${GTEST_HOME}/lib/libgtest_main.a
# 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 -s $(TRICK_CPPFLAGS) $<
$(TRICK_CPPC) $(TRICK_CPPFLAGS) -c ../../include/io_src/io_MM_user_defined_types.cpp
io_MM_alloc_deps.o : MM_alloc_deps.hh
${TRICK_HOME}/bin/trick-ICG -s $(TRICK_CPPFLAGS) $<
$(TRICK_CPPC) $(TRICK_CPPFLAGS) -c ../../include/io_src/io_MM_alloc_deps.cpp
io_MM_write_checkpoint.o : MM_write_checkpoint.hh
${TRICK_HOME}/bin/trick-ICG -s $(TRICK_CPPFLAGS) $<
$(TRICK_CPPC) $(TRICK_CPPFLAGS) -c ../../include/io_src/io_MM_write_checkpoint.cpp
io_MM_get_enumerated.o : MM_get_enumerated.hh
${TRICK_HOME}/bin/trick-ICG -s $(TRICK_CPPFLAGS) $<
$(TRICK_CPPC) $(TRICK_CPPFLAGS) -c ../../include/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 -s $(TRICK_CPPFLAGS) $<
$(TRICK_CPPC) $(TRICK_CPPFLAGS) -c ../../include/io_src/io_MM_ref_name_from_address.cpp
MM_creation_unittest.o : MM_creation_unittest.cc
$(TRICK_CPPC) $(TRICK_CPPFLAGS) -c $<
MM_declare_var_unittest.o : MM_declare_var_unittest.cc
$(TRICK_CPPC) $(TRICK_CPPFLAGS) -c $<
MM_declare_var_2_unittest.o : MM_declare_var_2_unittest.cc
$(TRICK_CPPC) $(TRICK_CPPFLAGS) -c $<
MM_declare_extern_var_unittest.o : MM_declare_extern_var_unittest.cc
$(TRICK_CPPC) $(TRICK_CPPFLAGS) -c $<
MM_delete_var_unittest.o : MM_delete_var_unittest.cc
$(TRICK_CPPC) $(TRICK_CPPFLAGS) -c $<
MM_ref_attributes_unittest.o : MM_ref_attributes_unittest.cc
$(TRICK_CPPC) $(TRICK_CPPFLAGS) -c $<
MM_resize_array_unittest.o : MM_resize_array_unittest.cc
$(TRICK_CPPC) $(TRICK_CPPFLAGS) -c $<
MM_strdup_unittest.o : MM_strdup_unittest.cc
$(TRICK_CPPC) $(TRICK_CPPFLAGS) -c $<
MM_write_var_unittest.o : MM_write_var_unittest.cc
$(TRICK_CPPC) $(TRICK_CPPFLAGS) -c $<
MM_sizeof_type_unittest.o : MM_sizeof_type_unittest.cc
$(TRICK_CPPC) $(TRICK_CPPFLAGS) -c $<
MM_read_checkpoint.o : MM_read_checkpoint.cc
$(TRICK_CPPC) $(TRICK_CPPFLAGS) -c $<
MM_clear_var_unittest.o : MM_clear_var_unittest.cc
$(TRICK_CPPC) $(TRICK_CPPFLAGS) -c $<
MM_alloc_deps.o : MM_alloc_deps.cc
$(TRICK_CPPC) $(TRICK_CPPFLAGS) -c $<
MM_write_checkpoint.o : MM_write_checkpoint.cc
$(TRICK_CPPC) $(TRICK_CPPFLAGS) -c $<
MM_get_enumerated.o : MM_get_enumerated.cc
$(TRICK_CPPC) $(TRICK_CPPFLAGS) -c $<
MM_ref_name_from_address.o : MM_ref_name_from_address.cc
$(TRICK_CPPC) $(TRICK_CPPFLAGS) -c $<
MM_write_checkpoint_hexfloat.o : MM_write_checkpoint_hexfloat.cc
$(TRICK_CPPC) $(TRICK_CPPFLAGS) -c $<
Bitfield_tests.o : Bitfield_tests.cpp
$(TRICK_CPPC) $(TRICK_CPPFLAGS) -c $<
MM_creation_unittest : MM_creation_unittest.o
$(TRICK_LD) $(TRICK_LDFLAGS) -o $@ $^ $(OTHER_OBJECTS) -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_LD) $(TRICK_LDFLAGS) -o $@ $^ $(OTHER_OBJECTS) -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_LD) $(TRICK_LDFLAGS) -o $@ $^ $(OTHER_OBJECTS) -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_LD) $(TRICK_LDFLAGS) -o $@ $^ $(OTHER_OBJECTS) -L${TRICK_HOME}/lib_${TRICK_HOST_CPU} $(TRICK_LIBS) $(TRICK_EXEC_LINK_LIBS)
MM_delete_var_unittest : MM_delete_var_unittest.o
$(TRICK_LD) $(TRICK_LDFLAGS) -o $@ $^ $(OTHER_OBJECTS) -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_LD) $(TRICK_LDFLAGS) -o $@ $^ $(OTHER_OBJECTS) -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_LD) $(TRICK_LDFLAGS) -o $@ $^ $(OTHER_OBJECTS) -L${TRICK_HOME}/lib_${TRICK_HOST_CPU} $(TRICK_LIBS) $(TRICK_EXEC_LINK_LIBS)
MM_strdup_unittest : MM_strdup_unittest.o
$(TRICK_LD) $(TRICK_LDFLAGS) -o $@ $^ $(OTHER_OBJECTS) -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_LD) $(TRICK_LDFLAGS) -o $@ $^ $(OTHER_OBJECTS) -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_LD) $(TRICK_LDFLAGS) -o $@ $^ $(OTHER_OBJECTS) -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_LD) $(TRICK_LDFLAGS) -o $@ $^ $(OTHER_OBJECTS) -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_LD) $(TRICK_LDFLAGS) -o $@ $^ $(OTHER_OBJECTS) -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_LD) $(TRICK_LDFLAGS) -o $@ $^ $(OTHER_OBJECTS) -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_LD) $(TRICK_LDFLAGS) -o $@ $^ $(OTHER_OBJECTS) -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_LD) $(TRICK_LDFLAGS) -o $@ $^ $(OTHER_OBJECTS) -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_LD) $(TRICK_LDFLAGS) -o $@ $^ $(OTHER_OBJECTS) -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_LD) $(TRICK_LDFLAGS) -o $@ $^ $(OTHER_OBJECTS) -L${TRICK_HOME}/lib_${TRICK_HOST_CPU} $(TRICK_LIBS) $(TRICK_EXEC_LINK_LIBS)
Bitfield_tests : Bitfield_tests.o
$(TRICK_LD) $(TRICK_LDFLAGS) -o $@ $^ $(OTHER_OBJECTS) -L${TRICK_HOME}/lib_${TRICK_HOST_CPU} $(TRICK_LIBS) $(TRICK_EXEC_LINK_LIBS)