From f07c05138d4c5c1577435ba9f4e9059e5223978b Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Thu, 14 Jan 2016 17:40:26 +0100 Subject: [PATCH] Initial conversion to the GNU configure and build system Signed-off-by: Joachim Nilsson --- Makefile | 129 --------------------------------------------------- Makefile.am | 47 +++++++++++++++++++ autogen.sh | 3 ++ configure.ac | 20 ++++++++ 4 files changed, 70 insertions(+), 129 deletions(-) delete mode 100644 Makefile create mode 100644 Makefile.am create mode 100755 autogen.sh create mode 100644 configure.ac diff --git a/Makefile b/Makefile deleted file mode 100644 index 0e7bfb6..0000000 --- a/Makefile +++ /dev/null @@ -1,129 +0,0 @@ -# libite (LITE) -- Collection of frog DNA -# -# Copyright (c) 2008-2016 Joachim Nilsson -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -.PHONY: install test - -#VERSION = $(shell git tag -l | tail -1) -VERSION = 1.3.0 -NAME = libite -PKG = $(NAME)-$(VERSION) -ARCHIVE = $(PKG).tar.xz - -CFLAGS += -fPIC -CPPFLAGS += -W -Wall -LDFLAGS = $(EXTRA_LDFLAGS) - -DISTFILES = README ChangeLog LICENSE -HEADERS = lite.h queue.h conio.h -OBJS := chomp.o copyfile.o dir.o fexist.o fisdir.o fmode.o fsendfile.o -OBJS += ifconfig.o lfile.o makepath.o pidfile.o pidfilefn.o progress.o -OBJS += rsync.o strlcpy.o strlcat.o strtonum.o tempfile.o tree.o -DEPS := $(OBJS:.o=.d) -JUNK = *~ *.bak *.map .*.d *.d DEADJOE semantic.cache *.gdb *.elf core core.* - -VER = 2 -LIBNAME = $(NAME) -SOLIB = $(LIBNAME).so.$(VER) -SYMLIB = $(LIBNAME).so -STATICLIB = $(LIBNAME).a -TARGET = $(STATICLIB) $(SOLIB) - -# This magic trick looks like a comment, but works on BSD PMake -#include -include rules.mk - -test: clean - $(MAKE) -f chomp.mk - $(MAKE) -f copyfile.mk - $(MAKE) -f dir.mk - $(MAKE) -f fexist.mk - $(MAKE) -f fisdir.mk - $(MAKE) -f fsendfile.mk - $(MAKE) -f lfile.mk - $(MAKE) -f makepath.mk - $(MAKE) -f pidfilefn.mk - $(MAKE) -f progress.mk - $(MAKE) -f rsync.mk - $(MAKE) -f tempfile.mk - $(MAKE) -f tree.mk - -$(OBJS): Makefile - -$(SOLIB): Makefile $(OBJS) - $(PRINT) " LINK %s\n" $@ - $(Q)$(CC) $(LDFLAGS) -shared -Wl,-soname,$@ -o $@ $(OBJS) - -$(STATICLIB): Makefile $(OBJS) - $(Q)$(PRINT) " ARCHIVE $@\n" - $(Q)$(AR) $(ARFLAGS) $@ $(OBJS) 2>/dev/null - -install-exec: all - $(PRINT) " INSTALL $(DESTDIR)$(libdir)/$(SOLIB)\n" - $(Q)install -d $(DESTDIR)$(libdir) - $(Q)$(STRIPINST) $(SOLIB) $(DESTDIR)$(libdir)/$(SOLIB) - $(Q)ln -sf $(SOLIB) $(DESTDIR)$(libdir)/$(SYMLIB) - -install-dev: - $(Q)install -d $(DESTDIR)$(incdir)/$(LIBNAME) - $(Q)for file in $(HEADERS); do \ - printf " INSTALL $(DESTDIR)$(incdir)/$(LIBNAME)/$$file\n"; \ - $(INSTALL) -m 0644 $$file $(DESTDIR)$(incdir)/$(LIBNAME)/$$file; \ - done - $(PRINT) " INSTALL $(DESTDIR)$(libdir)/$(STATICLIB)\n" - $(Q)install -d $(DESTDIR)$(libdir) - $(Q)$(INSTALL) $(STATICLIB) $(DESTDIR)$(libdir)/$(STATICLIB) - -install-data: - $(Q)install -d $(DESTDIR)$(datadir) - $(Q)for file in $(DISTFILES); do \ - printf " INSTALL $(DESTDIR)$(datadir)/$$file\n"; \ - install -m 0644 $$file $(DESTDIR)$(datadir)/$$file; \ - done - -install: install-exec install-dev install-data - -uninstall: - -$(Q)$(RM) -r $(DESTDIR)$(datadir) - -$(Q)$(RM) -r $(DESTDIR)$(incdir)/$(LIBNAME) - -$(Q)$(RM) $(DESTDIR)$(libdir)/$(SOLIB) - -$(Q)$(RM) $(DESTDIR)$(libdir)/$(SYMLIB) - -$(Q)$(RM) $(DESTDIR)$(libdir)/$(STATICLIB) - -strip: $(TARGET) - $(Q)$(PRINT) " STRIP %s\n" $(TARGET) - $(Q)$(STRIP) --strip-unneeded $(TARGET) - $(Q)size $(TARGET) - -# Runs Clang scan-build on the whole tree -check: clean - $(Q)scan-build $(MAKE) all - -# When called from GNU configure and build system -distdir: - @git archive --format=tar HEAD | (cd $(distdir); tar xf -) - -dist: - $(Q)echo "Building .xz tarball of $(PKG) in parent dir..." - git archive --format=tar --prefix=$(PKG)/ v$(VERSION) | xz >../$(ARCHIVE) - $(Q)(cd ..; md5sum $(ARCHIVE) | tee $(ARCHIVE).md5) - -# Include automatically generated rules --include $(DEPS) diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..024d989 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,47 @@ +ACLOCAL_AMFLAGS = -I m4 + +lib_LTLIBRARIES = libite.la +include_HEADERS = lite.h queue.h conio.h +libite_la_SOURCES = chomp.c copyfile.c dir.c fexist.c fisdir.c fmode.c fsendfile.c \ + ifconfig.c lfile.c makepath.c pidfile.c pidfilefn.c progress.c \ + rsync.c strlcpy.c strlcat.c strtonum.c tempfile.c tree.c + +libite_la_CPPFLAGS = -D_GNU_SOURCE +libite_la_CFLAGS = -W -Wall -Werror -Wextra +libite_la_LDFLAGS = $(AM_LDFLAGS) -version-info 2:0:0 + +doc_DATA = README LICENSE +#EXTRA_DIST = README.md AUTHORS LICENSE ChangeLog.md + +## Generate MD5 checksum file +MD5 = md5sum +md5-dist: + @for file in $(DIST_ARCHIVES); do \ + $(MD5) $$file > $$file.md5; \ + done + +## Check if tagged in git +release-hook: + if [ ! `git tag | grep $(PACKAGE_VERSION)` ]; then \ + echo; \ + printf "\e[1m\e[41mCannot find release tag $(PACKAGE_VERSION)\e[0m\n"; \ + printf "\e[1m\e[5mDo release anyway?\e[0m "; read yorn; \ + if [ "$$yorn" != "y" -a "$$yorn" != "Y" ]; then \ + printf "OK, aborting release.\n"; \ + exit 1; \ + fi; \ + echo; \ + else \ + echo; \ + printf "\e[1m\e[42mFound GIT release tag $(PACKAGE_VERSION)\e[0m\n"; \ + printf "\e[1m\e[44m>>Remember to push tags!\e[0m\n"; \ + echo; \ + fi + +## Target to run when building a release +release: dist release-hook md5-dist + @for file in $(DIST_ARCHIVES); do \ + printf "$$file \tDistribution tarball\n"; \ + printf "$$file.md5\t"; cat $$file.md5 | cut -f1 -d' '; \ + mv $$file* ../; \ + done diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..dbbcad3 --- /dev/null +++ b/autogen.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +autoreconf -W portability -visfm diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..7bc956e --- /dev/null +++ b/configure.ac @@ -0,0 +1,20 @@ +# Use v2.61 for backwards compat with Ubuntu 12.04 LTS +AC_PREREQ([2.61]) +AC_INIT(libite, 1.4.0-dev, https://github.com/troglobit/libite/issues) +AM_MAINTAINER_MODE +AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz]) +AM_SILENT_RULES([yes]) + +AC_CONFIG_SRCDIR(lite.h) +AM_CONFIG_HEADER(config.h) +AC_CONFIG_FILES([Makefile]) +AC_CONFIG_MACRO_DIR([m4]) + +AC_PROG_CC +AM_PROG_AR +LT_INIT + +AC_HEADER_STDC +AC_C_CONST + +AC_OUTPUT