From 6cf7eae04bb334b7f02decc95bc2fef56670328e Mon Sep 17 00:00:00 2001 From: Daniel Fiser Date: Thu, 6 Sep 2007 12:35:34 +0200 Subject: [PATCH] Modified Makefile. Modified Makefile to create libcppu.a, install and uninstall library and header file. --- .gitignore | 1 + Makefile | 32 ++++++++++++++++++++++++-------- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 200836f..9ea4960 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ NOTES *~ test doc/html +*.a diff --git a/Makefile b/Makefile index 61875d7..2bad9f3 100644 --- a/Makefile +++ b/Makefile @@ -1,31 +1,47 @@ -SOURCES = cppu.cpp -HEADERS = cppu.h -OBJS = cppu.o - GCC = g++ CXXFLAGS = -pedantic -Wall DEBUGFLAGS = -g -all: cppu.o +INSTALL = install +RM = rm +DESTDIR = /usr/local + +all: libcppu.a + +libcppu.a: cppu.o + ar cr $@ $^ + ranlib $@ + cppu.o: cppu.cpp cppu.h $(GCC) $(CXXFLAGS) $(DEBUGFLAGS) -c -o $@ $< +install: libcppu.a cppu.h + $(INSTALL) -d -m755 $(DESTDIR)/lib + $(INSTALL) -d -m755 $(DESTDIR)/include + $(INSTALL) -m644 libcppu.a $(DESTDIR)/lib/libcppu.a + $(INSTALL) -m644 cppu.h $(DESTDIR)/include/cppu.h + +uninstall: + $(RM) $(DESTDIR)/lib/libcppu.a + $(RM) $(DESTDIR)/include/cppu.h + doc: doxygen doc/doxygen.conf todo: - todo $(SOURCES) $(HEADERS) + todo cppu.h cppu.cpp clean: rm -f *.o rm -f test + rm -f *.a rm -rf doc/html rm -f doc/test test: doc/test -doc/test: $(OBJS) doc/example.cpp +doc/test: cppu.o doc/example.cpp $(GCC) $(CXXFLAGS) $(DEBUGFLAGS) -I./ -o doc/test $^ run_test: cd doc && ./test -.PHONY: clean doc +.PHONY: clean doc install uninstall -- 2.11.4.GIT