diff options
author | Mattias Andrée <maandree@kth.se> | 2019-04-12 21:12:12 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2019-04-12 21:13:19 +0200 |
commit | 1484b1264552ad05d75a4ca4f40972ac94e729e9 (patch) | |
tree | b9f6d6212866699db66e8bd64310d445498db2f3 /Makefile | |
download | liberror-1484b1264552ad05d75a4ca4f40972ac94e729e9.tar.gz liberror-1484b1264552ad05d75a4ca4f40972ac94e729e9.tar.bz2 liberror-1484b1264552ad05d75a4ca4f40972ac94e729e9.tar.xz |
First commit
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f2157ad --- /dev/null +++ b/Makefile @@ -0,0 +1,75 @@ +.POSIX: + +CONFIGFILE = config.mk +include $(CONFIGFILE) + +OS = linux +# linux = Linux +# macos = Mac OS +include $(OS).mk + +LIB_MAJOR = 1 +LIB_MINOR = 0 +LIB_VERSION = $(LIB_MAJOR).$(LIB_MINOR) + + +HDR =\ + liberror.h\ + internal.h + +OBJ =\ + copy_error.o\ + free_error.o\ + get_error.o\ + internal.o\ + print_backtrace.o\ + print_error.o\ + reset_error.o\ + save_backtrace.o\ + set_error.o\ + set_error_errno.o + +LOBJ = $(OBJ:.o=.lo) + + +all: liberror.a liberror.$(LIBEXT) +$(OBJ): $(@:.o=.c) $(HDR) +$(LOBJ): $(@:.lo=.c) $(HDR) + +liberror.a: $(OBJ) + -rm -f -- $@ + $(AR) rc $@ $(OBJ) + $(AR) s $@ + +liberror.$(LIBEXT): $(LOBJ) + $(CC) $(LIBFLAGS) -o $@ $(LOBJ) $(LDFLAGS) + +.c.o: + $(CC) -c -o $@ $< $(CFLAGS) $(CPPFLAGS) + +.c.lo: + $(CC) -c -o $@ $< -fPIC $(CFLAGS) $(CPPFLAGS) + +install: liberror.a liberror.$(LIBEXT) + mkdir -p -- "$(DESTDIR)$(PREFIX)/lib" + mkdir -p -- "$(DESTDIR)$(PREFIX)/include" + mkdir -p -- "$(DESTDIR)$(PREFIX)/licenses/liberror" + cp -- liberror.a "$(DESTDIR)$(PREFIX)/lib" + cp -- liberror.$(LIBEXT) "$(DESTDIR)$(PREFIX)/lib/liberror.$(LIBMINOREXT)" + ln -sf -- liberror.$(LIBMINOREXT) "$(DESTDIR)$(PREFIX)/lib/liberror.$(LIBMAJOREXT)" + ln -sf -- liberror.$(LIBMINOREXT) "$(DESTDIR)$(PREFIX)/lib/liberror.$(LIBEXT)" + cp -- liberror.h "$(DESTDIR)$(PREFIX)/include" + cp -- LICENSE "$(DESTDIR)$(PREFIX)/licenses/liberror" + +uninstall: + -rm -f -- "$(DESTDIR)$(PREFIX)/lib/liberror."* + -rm -f -- "$(DESTDIR)$(PREFIX)/include/liberror.h" + -rm -rf -- "$(DESTDIR)$(PREFIX)/licenses/liberror" + +clean: + -rm -f -- *.o *.lo *.a *.so *.so.* *.su *.test + +.SUFFIXES: +.SUFFIXES: .c .o .lo .a + +.PHONY: all install uninstall clean |