2 # This file is part of mutest, a simple micro unit testing framework for C.
4 # mutest was written by Leandro Lucarella <llucax@gmail.com> and is released
5 # under the BOLA license, please see the LICENSE file or visit:
6 # http://blitiri.com.ar/p/bola/
8 # This is the samples Makefile.
10 # Please, read the README file for more details.
13 # Show the tests summary
16 # Set to 0 if you don't want to compile the C++ test suite
19 CFLAGS = -Wall -std=c89
20 CXXFLAGS = -Wall -std=c++98
24 RUNNER_SRC = test_suite_runner.c
25 MKMUTEST = ../mkmutest
27 MUTEST_H = ../mutest.h
28 MUTEST_C = ../mutest.c
30 OBJS = factorial.o sum.o
31 TEST_OBJS = factorial_test.o sum_test.o init_fail_test.o
33 RUNNER_OBJ = $(RUNNER_SRC:.c=.o)
34 ALL_OBJS = $(RUNNER_OBJ) $(OBJS) $(TEST_OBJS) $(MUTEST_OBJ)
35 TEST_SOS = $(TEST_OBJS:.o=.so)
37 ifeq ($(CPP_SUITE), 1)
38 TEST_OBJS += exception_test.o
46 $(TARGET): $(ALL_OBJS)
47 $(LD) $(LDFLAGS) -o $@ $^
49 $(RUNNER_SRC): $(MKMUTEST_OBJ) $(MUTEST_H) $(TEST_OBJS)
50 $(MKMUTEST) $(MUTEST_H) $(TEST_OBJS) > $@
52 factorial_test.so: factorial.c
56 $(MUTEST_OBJ): $(MUTEST_C)
57 $(CC) $(CFLAGS) -c -o $@ $^
66 $(RM) $(TARGET) $(TEST_SOS) $(ALL_OBJS) $(RUNNER_SRC)
69 $(CC) $(CFLAGS) $(LDFLAGS) -DMUTEST_PY -fPIC -shared -o $@ $^
72 $(CXX) $(CXXFLAGS) $(LDFLAGS) -DMUTEST_PY -fPIC -shared -o $@ $^
76 .PHONY: all test clean