aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2022-02-13 00:28:37 +0100
committerMattias Andrée <maandree@kth.se>2022-02-13 00:28:37 +0100
commit2ef79ab9d01090c1b3a2cc445a18d141cbb3c781 (patch)
tree1a455cc6d734f4b63adaf7857e4747dd2ed8ffcb /Makefile
downloadlibar2simplified-2ef79ab9d01090c1b3a2cc445a18d141cbb3c781.tar.gz
libar2simplified-2ef79ab9d01090c1b3a2cc445a18d141cbb3c781.tar.bz2
libar2simplified-2ef79ab9d01090c1b3a2cc445a18d141cbb3c781.tar.xz
First commit
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r--Makefile79
1 files changed, 79 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..faee51e
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,79 @@
+.POSIX:
+
+CONFIGFILE = config.mk
+include $(CONFIGFILE)
+
+OS = linux
+# Linux: linux
+# Mac OS: macos
+# Windows: windows
+include mk/$(OS).mk
+
+
+LIB_MAJOR = 1
+LIB_MINOR = 0
+LIB_VERSION = $(LIB_MAJOR).$(LIB_MINOR)
+LIB_NAME = ar2simplified
+
+
+OBJ =\
+ libar2simplified_decode.o\
+ libar2simplified_encode.o\
+ libar2simplified_encode_hash.o\
+ libar2simplified_hash.o
+
+HDR =\
+ libar2simplified.h\
+ common.h
+
+LOBJ = $(OBJ:.o=.lo)
+
+
+all: libar2simplified.a libar2simplified.$(LIBEXT) test
+$(OBJ): $(HDR)
+$(LOBJ): $(HDR)
+test.o: test.c $(HDR)
+
+.c.o:
+ $(CC) -c -o $@ $< $(CFLAGS) $(CPPFLAGS)
+
+.c.lo:
+ $(CC) -fPIC -c -o $@ $< $(CFLAGS) $(CPPFLAGS)
+
+test: test.o libar2simplified.a
+ $(CC) -o $@ test.o libar2simplified.a $(LDFLAGS)
+
+libar2simplified.a: $(OBJ)
+ @rm -f -- $@
+ $(AR) rc $@ $(OBJ)
+
+libar2simplified.$(LIBEXT): $(LOBJ)
+ $(CC) $(LIBFLAGS) -o $@ $(LOBJ) $(LDFLAGS)
+
+check: test
+ ./test
+
+install: libar2simplified.a libar2simplified.$(LIBEXT)
+ mkdir -p -- "$(DESTDIR)$(PREFIX)/lib"
+ mkdir -p -- "$(DESTDIR)$(PREFIX)/include"
+ cp -- libar2simplified.a "$(DESTDIR)$(PREFIX)/lib/"
+ cp -- libar2simplified.$(LIBEXT) "$(DESTDIR)$(PREFIX)/lib/libar2simplified.$(LIBMINOREXT)"
+ ln -sf -- libar2simplified.$(LIBMINOREXT) "$(DESTDIR)$(PREFIX)/lib/libar2simplified.$(LIBMAJOREXT)"
+ ln -sf -- libar2simplified.$(LIBMAJOREXT) "$(DESTDIR)$(PREFIX)/lib/libar2simplified.$(LIBEXT)"
+ cp -- libar2simplified.h "$(DESTDIR)$(PREFIX)/include/"
+
+uninstall:
+ -rm -f -- "$(DESTDIR)$(PREFIX)/lib/libar2simplified.a"
+ -rm -f -- "$(DESTDIR)$(PREFIX)/lib/libar2simplified.$(LIBMAJOREXT)"
+ -rm -f -- "$(DESTDIR)$(PREFIX)/lib/libar2simplified.$(LIBMINOREXT)"
+ -rm -f -- "$(DESTDIR)$(PREFIX)/lib/libar2simplified.$(LIBEXT)"
+ -rm -f -- "$(DESTDIR)$(PREFIX)/include/libar2simplified.h"
+
+clean:
+ -rm -f -- *.o *.a *.lo *.su *.so *.so.* *.dll *.dylib
+ -rm -f -- *.gch *.gcov *.gcno *.gcda *.$(LIBEXT) test
+
+.SUFFIXES:
+.SUFFIXES: .lo .o .c
+
+.PHONY: all check install uninstall clean