From: Steinar H. Gunderson Date: Wed, 22 Jan 2014 09:39:47 +0000 (+0100) Subject: Some tweaks to the libtool parts of the Makefile. X-Git-Tag: 1.0~65 X-Git-Url: https://git.sesse.net/?p=movit;a=commitdiff_plain;h=e0344975e8bf5c303af92926e415d86ec75a93a3;ds=sidebyside Some tweaks to the libtool parts of the Makefile. We don't need to build all the non-lib files (especially the unit tests) using libtool, so save some CPU time there. Also, unbreak coverage builds. --- diff --git a/Makefile.in b/Makefile.in index c4503f4..7f1bfb4 100644 --- a/Makefile.in +++ b/Makefile.in @@ -20,8 +20,9 @@ INSTALL=install MKDIR=mkdir ifeq ($(COVERAGE),1) -CXXFLAGS += -fprofile-arcs -ftest-coverage +CXXFLAGS += -fprofile-arcs -ftest-coverage --coverage LDFLAGS += -fprofile-arcs -ftest-coverage +LDLIBS += -lgcov endif DEMO_OBJS=demo.o @@ -83,26 +84,28 @@ gtest_sdl_main.o: gtest_sdl_main.cpp # Unit tests. $(TESTS): %: %.o $(TEST_OBJS) libmovit.la - $(LIBTOOL) --mode=link $(CXX) -o $@ $^ $(LDFLAGS) + $(LIBTOOL) --mode=link $(CXX) $(LDFLAGS) -o $@ $^ $(LDLIBS) OBJS=$(DEMO_OBJS) $(LIB_OBJS) $(TEST_OBJS) $(TESTS:=.o) # A small demo program. demo: libmovit.la $(DEMO_OBJS) - $(LIBTOOL) --mode=link $(CXX) -o demo $(DEMO_OBJS) libmovit.la $(LDFLAGS) $(DEMO_LDFLAGS) + $(LIBTOOL) --mode=link $(CXX) $(LDFLAGS) -o demo $(DEMO_OBJS) libmovit.la $(LDLIBS) $(DEMO_LDLIBS) # The library itself. -libmovit.la: $(LIB_OBJS) - $(LIBTOOL) --mode=link $(CXX) -rpath $(libdir) -o $@ $(LIB_OBJS:.o=.lo) +libmovit.la: $(LIB_OBJS:.o=.lo) + $(LIBTOOL) --mode=link $(CXX) $(LDFLAGS) -rpath $(libdir) -o $@ $^ $(LDLIBS) -%.o: %.cpp +%.lo: %.cpp $(LIBTOOL) --mode=compile $(CXX) -MMD -MP $(CPPFLAGS) $(CXXFLAGS) -o $@ -c $< +%.o: %.cpp + $(CXX) -MMD -MP $(CPPFLAGS) $(CXXFLAGS) -o $@ -c $< DEPS=$(OBJS:.o=.d) -include $(DEPS) clean: - $(LIBTOOL) --mode=clean $(RM) demo $(TESTS) libmovit.la $(OBJS:.o=.lo) + $(LIBTOOL) --mode=clean $(RM) demo $(TESTS) libmovit.la $(OBJS) $(OBJS:.o=.lo) $(RM) $(OBJS:.o=.gcno) $(OBJS:.o=.gcda) $(DEPS) step*.dot chain*.frag $(RM) -r movit.info coverage/ .libs/