diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ac60207 --- /dev/null +++ b/Makefile @@ -0,0 +1,103 @@ +.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 = hashsum + + +OBJ =\ + libhashsum_init_hasher.o\ + libhashsum_init_md2_hasher.o\ + libhashsum_init_md4_hasher.o\ + libhashsum_init_md5_hasher.o\ + libhashsum_init_ripemd_128_hasher.o\ + libhashsum_init_ripemd_160_hasher.o\ + libhashsum_init_ripemd_256_hasher.o\ + libhashsum_init_ripemd_320_hasher.o + +HDR =\ + libhashsum.h\ + common.h + +TEST =\ + md2.t\ + md4.t\ + md5.t\ + ripemd-128.t\ + ripemd-160.t\ + ripemd-256.t\ + ripemd-320.t + +LOBJ = $(OBJ:.o=.lo) +TOBJ = $(TEST:.t=.o) + + +all: libhashsum.a libhashsum.$(LIBEXT) $(TEST) +$(OBJ): $(HDR) +$(LOBJ): $(HDR) +$(TOBJ): $(HDR) +$(TEST): libhashsum.a + +.c.o: + $(CC) -c -o $@ $< $(CFLAGS) $(CPPFLAGS) + +.c.lo: + $(CC) -fPIC -c -o $@ $< $(CFLAGS) $(CPPFLAGS) + +.c.t: + $(CC) -o $@ $< libhashsum.a $(CFLAGS) $(CPPFLAGS) + +.o.t: + $(CC) -o $@ $< libhashsum.a $(CFLAGS) $(CPPFLAGS) + +libhashsum.a: $(OBJ) + @rm -f -- $@ + $(AR) rc $@ $(OBJ) + $(AR) ts $@ > /dev/null + +libhashsum.$(LIBEXT): $(LOBJ) + $(CC) $(LIBFLAGS) -o $@ $(LOBJ) $(LDFLAGS) + +check: $(TEST) + @set -e;\ + for t in $(TEST); do\ + printf '%s\n' ./$$t;\ + $(CHECK_PREFIX) ./$$t;\ + done + +install: libhashsum.a libhashsum.$(LIBEXT) + mkdir -p -- "$(DESTDIR)$(PREFIX)/lib" + mkdir -p -- "$(DESTDIR)$(PREFIX)/include" + cp -- libhashsum.a "$(DESTDIR)$(PREFIX)/lib/" + cp -- libhashsum.$(LIBEXT) "$(DESTDIR)$(PREFIX)/lib/libhashsum.$(LIBMINOREXT)" + $(FIX_INSTALL_NAME) "$(DESTDIR)$(PREFIX)/lib/libhashsum.$(LIBMINOREXT)" + ln -sf -- libhashsum.$(LIBMINOREXT) "$(DESTDIR)$(PREFIX)/lib/libhashsum.$(LIBMAJOREXT)" + ln -sf -- libhashsum.$(LIBMAJOREXT) "$(DESTDIR)$(PREFIX)/lib/libhashsum.$(LIBEXT)" + cp -- libhashsum.h "$(DESTDIR)$(PREFIX)/include/" + +uninstall: + -rm -f -- "$(DESTDIR)$(PREFIX)/lib/libhashsum.a" + -rm -f -- "$(DESTDIR)$(PREFIX)/lib/libhashsum.$(LIBMAJOREXT)" + -rm -f -- "$(DESTDIR)$(PREFIX)/lib/libhashsum.$(LIBMINOREXT)" + -rm -f -- "$(DESTDIR)$(PREFIX)/lib/libhashsum.$(LIBEXT)" + -rm -f -- "$(DESTDIR)$(PREFIX)/include/libhashsum.h" + +clean: + -rm -f -- *.o *.a *.lo *.su *.so *.so.* *.dll *.dylib *.t + -rm -f -- *.gch *.gcov *.gcno *.gcda *.$(LIBEXT) + +.SUFFIXES: +.SUFFIXES: .lo .o .c .t + +.PHONY: all check install uninstall clean |