aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2019-10-22 18:59:27 +0200
committerMattias Andrée <maandree@kth.se>2019-10-22 18:59:27 +0200
commitbf4020471356938b9181a33984f511ffdd7ff25b (patch)
tree7f9a9abd1ae51318cd435f0ed7471be5f33b478c /Makefile
parentList radharc's priority (diff)
downloadlibcoopgamma-bf4020471356938b9181a33984f511ffdd7ff25b.tar.gz
libcoopgamma-bf4020471356938b9181a33984f511ffdd7ff25b.tar.bz2
libcoopgamma-bf4020471356938b9181a33984f511ffdd7ff25b.tar.xz
Change license, change style, clean up, flat file hier, clean valgrind output in test
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile66
1 files changed, 66 insertions, 0 deletions
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