1From 2a5cf5021b56bc92c9953d2c82e8c90502d22c97 Mon Sep 17 00:00:00 2001 2From: Bartosz Golaszewski <bgolaszewski@baylibre.com> 3Date: Fri, 13 Sep 2019 10:20:53 +0200 4Subject: [PATCH] build: use autotools 5 6This removes the hand-crafted Makefile in favor of standardized autotools 7build configuration. This is done to allow for easy cross-compilation of 8this project. 9 10Upstream-Status: Submitted 11 12Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> 13--- 14 .gitignore | 17 ++++++++++++ 15 Makefile | 66 --------------------------------------------- 16 Makefile.am | 10 +++++++ 17 configure.ac | 36 +++++++++++++++++++++++++ 18 include/Makefile.am | 9 +++++++ 19 man/Makefile.am | 7 +++++ 20 obj/.gitkeep | 0 21 src/Makefile.am | 13 +++++++++ 22 8 files changed, 92 insertions(+), 66 deletions(-) 23 delete mode 100644 Makefile 24 create mode 100644 Makefile.am 25 create mode 100644 configure.ac 26 create mode 100644 include/Makefile.am 27 create mode 100644 man/Makefile.am 28 delete mode 100644 obj/.gitkeep 29 create mode 100644 src/Makefile.am 30 31diff --git a/.gitignore b/.gitignore 32index af88e94..4e7355a 100644 33--- a/.gitignore 34+++ b/.gitignore 35@@ -3,3 +3,20 @@ obj/*.o 36 man/*.1 37 man/*.xml 38 test/GLOB* 39+*.o 40+ 41+# autotools stuff 42+.deps/ 43+Makefile 44+Makefile.in 45+aclocal.m4 46+autom4te.cache/ 47+autostuff/ 48+config.h 49+config.h.in 50+config.h.in~ 51+config.log 52+config.status 53+configure 54+m4/ 55+stamp-h1 56diff --git a/Makefile b/Makefile 57deleted file mode 100644 58index 6264da0..0000000 59--- a/Makefile 60+++ /dev/null 61@@ -1,66 +0,0 @@ 62-TARGET = unclutter 63-VERSION = 1.6 64-SDIR = src 65-IDIR = include 66-ODIR = obj 67- 68-INSTALL = install 69-PREFIX = /usr 70- 71-BINDIR = $(PREFIX)/bin 72-MANDIR = $(PREFIX)/share/man/man1 73-LICENSEDIR = $(PREFIX)/share/licenses/$(TARGET) 74- 75-CC = gcc 76-LD = $(CC) 77-PKG_CONFIG = pkg-config 78- 79-CPPFLAGS += -D'__VERSION="${VERSION}"' "-I$(IDIR)" 80- 81-CFLAGS += -std=gnu99 82-CFLAGS += -Wall -Wundef -Wshadow -Wformat-security 83- 84-LDFLAGS += $(shell $(PKG_CONFIG) --libs x11 xi xfixes) 85-# libev has no pkg-config support 86-LDFLAGS += -lev 87- 88-INCS = $(wildcard $(IDIR)/*.h) 89-SRCS = $(wildcard $(SDIR)/*.c) 90-OBJS = $(patsubst %,$(ODIR)/%,$(notdir $(SRCS:.c=.o))) 91- 92-MANS = man/unclutter-xfixes.1 93- 94-.NOTPARALLEL: 95- 96-.PHONY: all 97-all: clean $(TARGET) mans 98- 99-.PHONY: $(TARGET) 100-$(TARGET): $(OBJS) 101- $(LD) $(OBJS) $(LDFLAGS) -o "$(TARGET)" 102- 103-$(ODIR)/%.o: $(SDIR)/%.c $(INCS) 104- $(CC) $(CPPFLAGS) $(CFLAGS) -o "$@" -c "$<" 105- 106-.PHONY: install 107-install: $(TARGET) mans 108- $(INSTALL) -Dm 0755 "$(TARGET)" "$(DESTDIR)$(BINDIR)/$(TARGET)" 109- $(INSTALL) -Dm 0644 man/unclutter-xfixes.1 "$(DESTDIR)$(MANDIR)/unclutter.1" 110- $(INSTALL) -Dm 0644 -t "$(DESTDIR)$(LICENSEDIR)/" LICENSE 111- 112-.PHONY: uninstall 113-uninstall: 114- $(RM) "$(DESTDIR)$(BINDIR)/$(TARGET)" 115- $(RM) "$(DESTDIR)$(MANDIR)/unclutter.1" 116- $(RM) "$(DESTDIR)$(LICENSEDIR)/LICENSE" 117- 118-.PHONY: mans 119-mans: $(MANS) 120- 121-$(MANS): %.1: %.man 122- a2x --no-xmllint -f manpage "$<" 123- 124-.PHONY: clean 125-clean: 126- $(RM) $(TARGET) $(OBJS) 127- $(RM) man/*.1 man/*.xml 128diff --git a/Makefile.am b/Makefile.am 129new file mode 100644 130index 0000000..38ecaa1 131--- /dev/null 132+++ b/Makefile.am 133@@ -0,0 +1,10 @@ 134+ACLOCAL_AMFLAGS = -I m4 135+AUTOMAKE_OPTIONS = foreign 136+SUBDIRS = include src 137+ 138+if HAS_A2X 139+SUBDIRS += man 140+endif 141+ 142+licensedir = $(datadir)/licenses/unclutter 143+license_DATA = LICENSE 144diff --git a/configure.ac b/configure.ac 145new file mode 100644 146index 0000000..1d59197 147--- /dev/null 148+++ b/configure.ac 149@@ -0,0 +1,36 @@ 150+AC_PREREQ(2.61) 151+ 152+AC_INIT([unclutter-xfixes], 1.6) 153+AC_DEFINE_UNQUOTED([VERSION], ["$PACKAGE_VERSION"]) 154+ 155+AC_CONFIG_AUX_DIR([autostuff]) 156+AC_CONFIG_MACRO_DIRS([m4]) 157+AM_INIT_AUTOMAKE([foreign subdir-objects]) 158+ 159+m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) 160+ 161+AC_CONFIG_SRCDIR([src]) 162+AC_CONFIG_HEADER([config.h]) 163+ 164+AM_PROG_AR 165+AC_PROG_CC 166+AC_PROG_INSTALL 167+ 168+# libev has no pkg-config support 169+AC_CHECK_HEADERS([ev.h], [], [AC_MSG_ERROR([ev.h not found - please install libev])]) 170+ 171+PKG_CHECK_MODULES([X11], [x11 xi xfixes]) 172+ 173+AC_CHECK_PROG([has_a2x], [a2x], [true], [false]) 174+AM_CONDITIONAL([HAS_A2X], [test "x$has_a2x" = xtrue]) 175+if test "x$has_a2x" = xfalse 176+then 177+ AC_MSG_NOTICE([a2x not found - needed to generate man pages]) 178+fi 179+ 180+AC_CONFIG_FILES([Makefile 181+ include/Makefile 182+ src/Makefile 183+ man/Makefile]) 184+ 185+AC_OUTPUT 186diff --git a/include/Makefile.am b/include/Makefile.am 187new file mode 100644 188index 0000000..90d8bbc 189--- /dev/null 190+++ b/include/Makefile.am 191@@ -0,0 +1,9 @@ 192+noinst_HEADERS = \ 193+ all.h \ 194+ cursor.h \ 195+ event.h \ 196+ extensions.h \ 197+ externals.h \ 198+ globals.h \ 199+ types.h \ 200+ util.h 201diff --git a/man/Makefile.am b/man/Makefile.am 202new file mode 100644 203index 0000000..7856e6a 204--- /dev/null 205+++ b/man/Makefile.am 206@@ -0,0 +1,7 @@ 207+unclutter-xfixes.1: 208+ a2x --no-xmllint -f manpage unclutter-xfixes.man 209+ 210+dist_man1_MANS = unclutter-xfixes.1 211+ 212+clean-local: 213+ rm -f unclutter-xfixes.1 214diff --git a/obj/.gitkeep b/obj/.gitkeep 215deleted file mode 100644 216index e69de29..0000000 217diff --git a/src/Makefile.am b/src/Makefile.am 218new file mode 100644 219index 0000000..c7f0729 220--- /dev/null 221+++ b/src/Makefile.am 222@@ -0,0 +1,13 @@ 223+AM_CFLAGS = -D'__VERSION="${VERSION}"' "-I$(top_srcdir)/include" 224+AM_CFLAGS += -std=gnu99 -Wall -Wundef -Wshadow -Wformat-security 225+AM_CFLAGS += $(X11_CFLAGS) 226+AM_LDFLAGS = -lev $(X11_LIBS) 227+ 228+bin_PROGRAMS = unclutter 229+ 230+unclutter_SOURCES = \ 231+ cursor.c \ 232+ event.c \ 233+ extensions.c \ 234+ unclutter.c \ 235+ util.c 236-- 2372.21.0 238 239