From bf4020471356938b9181a33984f511ffdd7ff25b Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 22 Oct 2019 18:59:27 +0200 Subject: Change license, change style, clean up, flat file hier, clean valgrind output in test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- Makefile | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 Makefile (limited to 'Makefile') diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ab595c6 --- /dev/null +++ b/Makefile @@ -0,0 +1,66 @@ +.POSIX: + +LIB_MAJOR = 1 +LIB_MINOR = 2 +LIB_VERSION = $(LIB_MAJOR).$(LIB_MINOR) + +CONFIGFILE = config.mk +OSCONFIGFILE = linux.mk + +include $(CONFIGFILE) +include $(OSCONFIGFILE) +include man.mk + +all: libcoopgamma.a libcoopgamma.so test + +.c.o: + $(CC) -c -o $@ $< $(CPPFLAGS) $(CFLAGS) + +.c.lo: + $(CC) -fPIC -c -o $@ $< $(CPPFLAGS) $(CFLAGS) + +libcoopgamma.a: libcoopgamma.o + $(AR) rc $@ $? + $(AR) s $@ + +libcoopgamma.$(LIBEXT): libcoopgamma.lo + $(CC) $(LIBFLAGS) -o $@ libcoopgamma.lo $(LDFLAGS) + +test: test.o libcoopgamma.a + $(CC) -o $@ test.o libcoopgamma.a $(LDFLAGS) + +check: test + ./test + +install: libcoopgamma.a libcoopgamma.$(LIBEXT) + mkdir -p -- "$(DESTDIR)$(PREFIX)/include" + mkdir -p -- "$(DESTDIR)$(PREFIX)/lib" + mkdir -p -- "$(DESTDIR)$(MANPREFIX)/man0" + mkdir -p -- "$(DESTDIR)$(MANPREFIX)/man3" + mkdir -p -- "$(DESTDIR)$(MANPREFIX)/man7" + cp -- libcoopgamma.h "$(DESTDIR)$(PREFIX)/include" + cp -- libcoopgamma.a "$(DESTDIR)$(PREFIX)/lib" + cp -- libcoopgamma.$(LIBEXT) "$(DESTDIR)$(PREFIX)/lib/libcoopgamma.$(LIBMINOREXT)" + ln -sf -- libcoopgamma.$(LIBMINOREXT) "$(DESTDIR)$(PREFIX)/lib/libcoopgamma.$(LIBMAJOREXT)" + ln -sf -- libcoopgamma.$(LIBMINOREXT) "$(DESTDIR)$(PREFIX)/lib/libcoopgamma.$(LIBEXT)" + cp -- $(MAN0) "$(DESTDIR)$(MANPREFIX)/man0" + cp -- $(MAN3) "$(DESTDIR)$(MANPREFIX)/man3" + cp -- $(MAN7) "$(DESTDIR)$(MANPREFIX)/man7" + +uninstall: + -rm -f -- "$(DESTDIR)$(PREFIX)/include/libcoopgamma.h" + -rm -f -- "$(DESTDIR)$(PREFIX)/lib/libcoopgamma.a" + -rm -f -- "$(DESTDIR)$(PREFIX)/lib/libcoopgamma.$(LIBMINOREXT)" + -rm -f -- "$(DESTDIR)$(PREFIX)/lib/libcoopgamma.$(LIBMAJOREXT)" + -rm -f -- "$(DESTDIR)$(PREFIX)/lib/libcoopgamma.$(LIBEXT)" + -cd -- "$(DESTDIR)$(MANPREFIX)/man0/" && rm -f -- $(MAN0) + -cd -- "$(DESTDIR)$(MANPREFIX)/man3/" && rm -f -- $(MAN3) + -cd -- "$(DESTDIR)$(MANPREFIX)/man7/" && rm -f -- $(MAN7) + +clean: + -rm -f -- *.a *.lo *.o *.su *.$(LIBEXT) test + +.SUFFIXES: +.SUFFIXES: .lo .o .c + +.PHONY: all check install uninstall clean -- cgit v1.2.3-70-g09d2