From c7a4f00fd701c7e1bd071c7a5aa8199f96833823 Mon Sep 17 00:00:00 2001 From: Jannis Pohlmann Date: Thu, 22 Mar 2012 13:55:30 +0000 Subject: Switch to a shared tbdiff library and make this an autotools project. This commit converts tbdiff to being an autotools-based project. This means that we now support the usual autoreconf -i && ./configure && make && make install process, plus we provide 'make check' for the tbdiff test suite. The tbdiff library is now build as a shared library and is also installed into the system for others to use. The library is libtool-versioned and ships a pkg-config file (tbdiff-1.pc). The headers were adjusted so that only tbdiff/tbdiff.h may be included directly; all others are considered internal. The tbdiff-create and tbdiff-deploy tools were changed to include this header file. The tbdiff library is still GPL, not LGPL. We might want to change this in the future. Thanks to switching to autotools we now have a way to make releases by means of 'make dist' and 'make distcheck'. Unfortunately, the latter currently fails, probably due to something being missing in tbdiff/Makefile.am. --- Makefile.pre-autotools | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 Makefile.pre-autotools (limited to 'Makefile.pre-autotools') diff --git a/Makefile.pre-autotools b/Makefile.pre-autotools new file mode 100644 index 0000000..da4a3c1 --- /dev/null +++ b/Makefile.pre-autotools @@ -0,0 +1,57 @@ +.PHONY: all + +CC := gcc + +OPT ?= -O2 + +DESTDIR = / +PREFIX = /usr + +DEPLOY=tbdiff-deploy +CREATE=tbdiff-create + +CFLAGS ?= +CFLAGS += -g +CFLAGS += -Wall -Wextra -Werror -Wno-unused-result $(OPT) + +SHARED_SRC := libtbd_stat.c libtbd_xattrs.c libtbd_io.c +DEPLOY_SRC := tbdiff_deploy.c libtbd_create.c +CREATE_SRC := tbdiff_create.c libtbd_apply.c + +DEPLOY_OBJ := $(patsubst %.c,%.o,$(SHARED_SRC) $(DEPLOY_SRC)) +CREATE_OBJ := $(patsubst %.c,%.o,$(SHARED_SRC) $(CREATE_SRC)) + +all: $(DEPLOY) $(CREATE) + +$(DEPLOY): tbdiff_deploy.o libtbd_apply.o libtbd_stat.o libtbd_xattrs.o libtbd_io.o + $(CC) $(LDFLAGS) -o $@ $^ + +$(CREATE): tbdiff_create.o libtbd_create.o libtbd_stat.o libtbd_xattrs.o libtbd_io.o + $(CC) $(LDFLAGS) -o $@ $^ + +%.o: %.c + $(CC) $(CFLAGS) -MMD -o $@ -c $< + +ifeq (,$(findstring clean,$(MAKECMDGOALS))) +-include $(patsubst %.c,%.d,$(SHARED_SRC) $(DEPLOY_SRC) $(CREATE_SRC)) +endif + +install: $(DEPLOY) $(CREATE) + install -m 755 -d $(DESTDIR)$(PREFIX)/bin + install $(CREATE) $(DESTDIR)$(PREFIX)/bin + install $(DEPLOY) $(DESTDIR)$(PREFIX)/bin + +uninstall: + rm -rf $(DESTDIR)/$(DEPLOY) + rm -rf $(DESTDIR)/$(CREATE) + +test: + cd tests && ./run_tests.sh && fakeroot -- ./cross_plat.sh && cd .. + +.PHONY: clean + +check: + cd tests && ./run_tests.sh && cd .. + +clean: + rm -f $(DEPLOY) $(CREATE) *.o *.d -- cgit v1.2.1