trick/trick_source/trick_utils/trick_adt/test/Makefile

66 lines
2.5 KiB
Makefile
Raw Permalink Normal View History

2023-10-05 18:33:38 +00:00
#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
# Flags passed to the preprocessor.
TRICK_CXXFLAGS += -I$(GTEST_HOME)/include -I$(TRICK_HOME)/include -g -Wall -Wextra ${TRICK_SYSTEM_CXXFLAGS} ${TRICK_TEST_FLAGS}
TRICK_LIBS = ${TRICK_LIB_DIR}/libtrick.a
TRICK_EXEC_LINK_LIBS += -L${GTEST_HOME}/lib64 -L${GTEST_HOME}/lib -lgtest -lgtest_main -lpthread
# Added for Ubuntu... not required for other systems.
TRICK_EXEC_LINK_LIBS += -lpthread
# ==================================================================================
# All tests produced by this Makefile. Add new tests you create to this list.
# ==================================================================================
TESTS = dllist_unittest\
lqueue_unittest
2023-10-05 18:33:38 +00:00
# List of XML files produced by the tests.
unittest_results = $(patsubst %,%.xml,$(TESTS))
# List if Test-specific object files.
unittest_objects = $(patsubst %,%.o,$(TESTS))
# House-keeping build targets.
# ==================================================================================
# TARGETS
# ==================================================================================
all : test
test: unit_tests $(unittest_results)
unit_tests: $(TESTS)
clean :
rm -f $(TESTS)
rm -f *.o
# ==================================================================================
# Generate JUNIT (XML) Test Results
# ==================================================================================
$(unittest_results): %.xml: %
./$< --gtest_output=xml:${TRICK_HOME}/trick_test/$@
# ==================================================================================
# Build Unit test Objects
# ==================================================================================
$(unittest_objects): %.o: %.cpp
$(TRICK_CXX) $(TRICK_CXXFLAGS) -c $<
# ==================================================================================
# Build Unit test programs
# ==================================================================================
$(TESTS) : %: %.o
$(TRICK_CXX) $(TRICK_SYSTEM_LDFLAGS) -o $@ $^ -L${TRICK_HOME}/lib_${TRICK_HOST_CPU} $(TRICK_LIBS) $(TRICK_EXEC_LINK_LIBS)
# ----------------------------------------------------------------------------------
# The following unittest programs are also dependent on the indicated object files.
# ----------------------------------------------------------------------------------