From 3578156b3daa0e542afc3890a7cda29a670bedca Mon Sep 17 00:00:00 2001 From: Frediano Ziglio Date: Tue, 4 Oct 2016 19:10:52 +0100 Subject: Convert project to autoconf Allow more complicated rules. Avoid duplication of version. Use more standard settings in Makefiles. Signed-off-by: Frediano Ziglio --- .gitignore | 17 +++++++++++++++++ Makefile | 32 -------------------------------- Makefile.am | 25 +++++++++++++++++++++++++ configure.ac | 6 ++++++ latency.spec | 34 ---------------------------------- latency.spec.in | 34 ++++++++++++++++++++++++++++++++++ 6 files changed, 82 insertions(+), 66 deletions(-) delete mode 100644 Makefile create mode 100644 Makefile.am create mode 100644 configure.ac delete mode 100644 latency.spec create mode 100644 latency.spec.in diff --git a/.gitignore b/.gitignore index 7ebecd7..aeb53b5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,20 @@ latency latency.1 latency-*.tar.gz +install-sh +stamp-h1 +configure +Makefile.in +Makefile +aclocal.m4 +autom4te.cache/ +.deps/ +compile +config.h +config.h.in +config.log +config.status +depcomp +missing +*.o +latency.spec diff --git a/Makefile b/Makefile deleted file mode 100644 index b808414..0000000 --- a/Makefile +++ /dev/null @@ -1,32 +0,0 @@ -CFLAGS ?= -O2 -Wall -g -CC ?= gcc -INSTDIR ?= /usr/local/bin -MANDIR ?= /usr/local/share/man/man1 -VERSION = 1.0 -SOURCES = latency.c tun.c utils.c latency.h tun.h utils.h - -all: latency latency.1 - -latency: $(SOURCES) - $(CC) $(CFLAGS) -o $@ $^ -pthread - -latency.1: README.md - ronn < $< > $@ - -clean:: - rm -f latency latency.1 - -install:: latency latency.1 - umask 022 && cp $< $(INSTDIR) - chown root: $(INSTDIR)/$< - chmod 4751 $(INSTDIR)/$< - cp latency.1 $(MANDIR)/latency.1 - chown root: $(MANDIR)/latency.1 - -dist:: latency-$(VERSION).tar.gz - -latency-$(VERSION).tar.gz: Makefile $(SOURCES) - git archive HEAD --prefix latency-$(VERSION)/ | gzip -9 > $@ - -rpm:: dist - rpmbuild -D "_sourcedir $$PWD" -ba latency.spec diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..1bdcb7c --- /dev/null +++ b/Makefile.am @@ -0,0 +1,25 @@ +NULL = + +bin_PROGRAMS = latency +latency_SOURCES = \ + latency.c \ + tun.c \ + utils.c \ + latency.h \ + tun.h \ + utils.h \ + $(NULL) +latency_LDFLAGS = -pthread + +man1_MANS = latency.1 + +latency.1: README.md + ronn < $< > $@.tmp + mv -f $@.tmp $@ + +EXTRA_DIST = \ + latency.spec \ + README.md \ + latency.1 \ + $(NULL) +CLEANFILES = latency.1 diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..6e017da --- /dev/null +++ b/configure.ac @@ -0,0 +1,6 @@ +AC_INIT([latency], [1.0], [freddy77@gmail.com]) +AM_INIT_AUTOMAKE([-Wall -Werror foreign]) +AC_PROG_CC +AC_CONFIG_HEADERS([config.h]) +AC_CONFIG_FILES([Makefile latency.spec]) +AC_OUTPUT diff --git a/latency.spec b/latency.spec deleted file mode 100644 index 6348ee3..0000000 --- a/latency.spec +++ /dev/null @@ -1,34 +0,0 @@ -Name: latency -Version: 1.0 -Release: 1%{?dist} -Summary: Utility to help test network latency/bandwidth problems - -Group: Development/Debug -License: GPLv2 -URL: https://github.com/freddy77/latency -Source0: latency-%{version}.tar.gz - -BuildRequires: rubygem-ronn - -%description -This project provide an utility to help testing environments with high -latency and low bandwidth. - -%prep -%setup -q - -%build -make %{?_smp_mflags} - -%install -mkdir -p $RPM_BUILD_ROOT%{_mandir}/man1 $RPM_BUILD_ROOT/%{_bindir} -cp latency.1 $RPM_BUILD_ROOT%{_mandir}/man1/latency.1 -cp latency $RPM_BUILD_ROOT/%{_bindir}/latency - -%files -%defattr(-,root,root,-) -%attr(4751, root, root) %{_bindir}/latency -%{_mandir}/man1/* - -%changelog - diff --git a/latency.spec.in b/latency.spec.in new file mode 100644 index 0000000..ea61010 --- /dev/null +++ b/latency.spec.in @@ -0,0 +1,34 @@ +Name: latency +Version: @VERSION@ +Release: 1%{?dist} +Summary: Utility to help test network latency/bandwidth problems + +Group: Development/Debug +License: GPLv2 +URL: https://github.com/freddy77/latency +Source0: latency-%{version}.tar.gz + +BuildRequires: rubygem-ronn + +%description +This project provide an utility to help testing environments with high +latency and low bandwidth. + +%prep +%setup -q + +%build +make %{?_smp_mflags} + +%install +mkdir -p $RPM_BUILD_ROOT%{_mandir}/man1 $RPM_BUILD_ROOT/%{_bindir} +cp latency.1 $RPM_BUILD_ROOT%{_mandir}/man1/latency.1 +cp latency $RPM_BUILD_ROOT/%{_bindir}/latency + +%files +%defattr(-,root,root,-) +%attr(4751, root, root) %{_bindir}/latency +%{_mandir}/man1/* + +%changelog + -- cgit v1.2.3