blob: b7c843b86b93bd6ef6c8899147432b88344adff4 [file] [log] [blame]
E. Scott Daniels4e4fb502020-03-24 12:28:06 -04001
2coverage_opts = -ftest-coverage -fprofile-arcs
3
E. Scott Daniels97204c82020-06-29 15:39:57 -04004binaries = unit_test
5
E. Scott Danielsef362052020-07-22 15:49:54 -04006tests:: unit_test jhash_test metrics_test
7
8include_list = -I ../src/metrics -I ../src/alarm -I ../src/messaging
E. Scott Daniels4e4fb502020-03-24 12:28:06 -04009
10# RMR emulation
11rmr_em.o:: rmr_em.c
12 cc -g rmr_em.c -c
13
E. Scott Danielsef362052020-07-22 15:49:54 -040014# include the emulated rmr stuff, but we still need the rmr lib for symtab things which we cannot hope to
15# emulate (and don't need to)
16#
E. Scott Daniels4e4fb502020-03-24 12:28:06 -040017unit_test:: unit_test.cpp rmr_em.o
E. Scott Danielsef362052020-07-22 15:49:54 -040018 g++ -g $(coverage_opts) $(include_list) unit_test.cpp -o unit_test -L../.build -lricxfcpp rmr_em.o -lrmr_si -lpthread
E. Scott Daniels4e4fb502020-03-24 12:28:06 -040019
E. Scott Daniels97204c82020-06-29 15:39:57 -040020# build a special jwrapper object with coverage settings
21jwrapper_test.o:: ../src/json/jwrapper.c ../src/json/jwrapper.h
E. Scott Daniels5a9d7c62020-07-09 11:56:10 -040022 cc $(coverage_opts) -g -I ../src/json -I ../ext/jsmn ../src/json/jwrapper.c -c -o jwrapper_test.o
E. Scott Daniels97204c82020-06-29 15:39:57 -040023
24jhash_test:: jwrapper_test.o jhash_test.cpp
25 # do NOT link the xapp lib; we include all modules in the test programme
26 g++ -g $(coverage_opts) -I ../src/json -I ../ext/jsmn jhash_test.cpp -o jhash_test jwrapper_test.o -lrmr_si -lpthread
27
E. Scott Danielsef362052020-07-22 15:49:54 -040028metrics_test:: metrics_test.cpp rmr_em.o
29 # do NOT link the xapp lib; we include all modules in the test programme
30 g++ -g $(coverage_opts) $(include_list) metrics_test.cpp -o metrics_test -L../.build -lricxfcpp rmr_em.o -l rmr_si -lpthread
31
E. Scott Daniels4e4fb502020-03-24 12:28:06 -040032# prune gcov files generated by system include files
33clean::
34 rm -f *.h.gcov *.c.gcov
35
36# ditch anything that can be rebuilt
37nuke::
38 rm -f *.a *.o *.gcov *.gcda *.gcno core a.out $(binaries)
39