From 07f8073d4e4ad5c2bec16da573e464aa35d14340 Mon Sep 17 00:00:00 2001 From: Qball Cow Date: Mon, 17 Mar 2014 18:00:09 +0100 Subject: [PATCH] Use autotools (1) --- LICENSE => COPYING | 0 Makefile | 130 --------------------------------------------- Makefile.am | 50 +++++++++++++++++ configure.ac | 22 ++++++++ source/rofi.c | 2 + 5 files changed, 74 insertions(+), 130 deletions(-) rename LICENSE => COPYING (100%) delete mode 100644 Makefile create mode 100644 Makefile.am create mode 100644 configure.ac diff --git a/LICENSE b/COPYING similarity index 100% rename from LICENSE rename to COPYING diff --git a/Makefile b/Makefile deleted file mode 100644 index b10046c1..00000000 --- a/Makefile +++ /dev/null @@ -1,130 +0,0 @@ -QUIET?=@ -CFLAGS?=-Wall -Wextra -O3 -g -VERSION?=0.14.2 - -PROGRAM=rofi - - -PREFIX?=$(DESTDIR)/usr/local -BIN_DIR?=$(PREFIX)/bin -MAN_DIR?=$(PREFIX)/share/man/man1 - -MAN_PAGE=$(PROGRAM).1 - -SOURCE_DIR=source -CONFIG_DIR=config -DOC_DIR=doc -BUILD_DIR=build - -SOURCES=$(wildcard $(SOURCE_DIR)/*.c $(CONFIG_DIR)/*.c ) -OBJECTS=$(SOURCES:%.c=$(BUILD_DIR)/%.o) -HEADERS=$(wildcard include/*.h) -OTHERS=Makefile LICENSE README.md - -INSTALL_MANPAGE_PATH=$(MAN_DIR)/$(MAN_PAGE).gz -INSTALL_PROGRAM=$(BIN_DIR)/$(PROGRAM) - - -DIST_TARGET=$(BUILD_DIR)/$(PROGRAM)-$(VERSION).tar.xz - - -CFLAGS+=-DMANPAGE_PATH="\"$(INSTALL_MANPAGE_PATH)\"" -CFLAGS+=-std=c99 -CFLAGS+=-Iinclude/ -CFLAGS+=-DVERSION="\"$(VERSION)\"" - -# Check deps. -ifeq (${DEBUG},1) -CFLAGS+=-DTIMING=1 -g3 -LDADD+=-lrt -endif - -ifeq (${QC_MODE},1) -CFLAGS+=-D__QC_MODE__ -endif - - -CLANG=$(shell which clang 2>/dev/null) - -ifneq (${CLANG},${EMPTY}) - $(info Using clang compiler: ${CLANG}) - CC=${CLANG} -endif - - -## -# Check dependencies -## -PKG_CONFIG?=$(shell which pkg-config) -ifeq (${PKG_CONFIG},${EMPTY}) -$(error Failed to find pkg-config. Please install pkg-config) -endif - -CFLAGS+=$(shell ${PKG_CONFIG} --cflags x11 xinerama xft libxdg-basedir ) -LDADD+=$(shell ${PKG_CONFIG} --libs x11 xinerama xft libxdg-basedir ) - -ifeq (${LDADD},${EMPTY}) -$(error Failed to find the required dependencies: x11, xinerama, xft) -endif - - -## -# Check for i3. -## -I3?=$(shell which i3) -ifneq (${I3},${EMPTY}) -$(info I3 mode is enabled) -CFLAGS+=-DI3 -I${PREFIX}/include/ -endif - -all: $(BUILD_DIR)/$(PROGRAM) - -$(BUILD_DIR): - $(info Creating build dir) - $(QUIET)mkdir -p $@ - $(QUIET)mkdir -p $@/$(SOURCE_DIR) - $(QUIET)mkdir -p $@/$(CONFIG_DIR) - -# Objects depend on header files and makefile too. -$(BUILD_DIR)/%.o: %.c Makefile $(HEADERS) | $(BUILD_DIR) - $(info Compiling $< -> $@) - $(QUIET) $(CC) $(CFLAGS) -c -o $@ $< - -$(BUILD_DIR)/$(PROGRAM): $(OBJECTS) - $(info Linking $@) - $(QUIET)$(CC) -o $@ $^ $(LDADD) $(LDFLAGS) - -install: $(INSTALL_PROGRAM) $(INSTALL_MANPAGE_PATH) - -$(INSTALL_PROGRAM): $(BUILD_DIR)/$(PROGRAM) - $(info Install $^ -> $@ ) - $(QUIET)install -Dm 755 $^ $@ - - -$(BUILD_DIR)/$(MAN_PAGE).gz: $(DOC_DIR)/$(MAN_PAGE) - $(info Creating man page) - $(QUIET) gzip -c $^ > $@ - -$(INSTALL_MANPAGE_PATH): $(BUILD_DIR)/$(MAN_PAGE).gz - $(info Install $^ -> $@) - $(QUIET) install -Dm 644 $^ $(INSTALL_MANPAGE_PATH) - -clean: - $(info Clean build dir) - $(QUIET)rm -rf $(BUILD_DIR) - - -indent: - @astyle --style=linux -S -C -D -N -H -L -W3 -f $(SOURCES) $(HEADERS) - -dist: $(DIST_TARGET) - -$(BUILD_DIR)/$(PROGRAM)-$(VERSION): $(SOURCES) $(HEADERS) $(DOC_DIR)/$(MAN_PAGE) $(OTHERS) | $(BUILD_DIR) - $(info Create release directory) - $(QUIET)mkdir -p $@ - $(QUIET)cp -a --parents $^ $@ - - -$(DIST_TARGET): $(BUILD_DIR)/$(PROGRAM)-$(VERSION) - $(info Creating release tarball: $@) - $(QUIET) tar -C $(BUILD_DIR) -cavvJf $@ $(PROGRAM)-$(VERSION) diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 00000000..ad311f4f --- /dev/null +++ b/Makefile.am @@ -0,0 +1,50 @@ +bin_PROGRAMS=rofi + +LIBS=\ + @xft_LIBS@\ + @x11_LIBS@\ + @xdgbasedir_LIBS@\ + @xinerama_LIBS@ + +AM_CFLAGS=\ + @xft_CFLAGS@\ + @x11_CFLAGS@\ + @xdgbasedir_CFLAGS@\ + @xinerama_CFLAGS@\ + -DMANPAGE_PATH="\"$(datadir)/man/man1/rofi.1\""\ + -I$(top_srcdir)/include/\ + -I$(top_srcdir)/config/\ + -I$(top_builddir)/ + +rofi_SOURCES=\ + source/rofi.c\ + source/textbox.c\ + source/xrmoptions.c\ + source/dmenu-dialog.c\ + source/run-dialog.c\ + source/ssh-dialog.c\ + source/profile-dialog.c\ + config/config.c + +rofi_FILES=\ + include/rofi.h\ + include/run-dialog.h\ + include/ssh-dialog.h\ + include/dmenu-dialog.h\ + include/profile-dialog.h\ + include/xrmoptions.h\ + include/textbox.h + +## +# Manpage +## +man1_MANS=\ + doc/rofi.1 + + +## +# Extra DIST +## +EXTRA_DIST=\ + $(rofi_FILES)\ + $(man1_MANS) diff --git a/configure.ac b/configure.ac new file mode 100644 index 00000000..98ebaa05 --- /dev/null +++ b/configure.ac @@ -0,0 +1,22 @@ +AC_INIT([rofi], [0.14.3], [qball@gmpclient.org]) + +AC_CONFIG_SRCDIR([source]) +AC_CONFIG_HEADER([config.h]) + +AM_INIT_AUTOMAKE([-Wall -Werror foreign]) +AM_INIT_AUTOMAKE([subdir-objects]) + +AC_PROG_CC +AC_PROG_CC_STDC +AM_PROG_CC_C_O + +PKG_PROG_PKG_CONFIG + +PKG_CHECK_MODULES([xft], [xft]) +PKG_CHECK_MODULES([x11], [x11]) +PKG_CHECK_MODULES([xinerama], [xinerama]) +PKG_CHECK_MODULES([xdgbasedir], [libxdg-basedir]) + + +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT diff --git a/source/rofi.c b/source/rofi.c index f313d7f3..f5f5082b 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -70,6 +70,8 @@ #include "xrmoptions.h" +#include + #define LINE_MARGIN 4 #define OPAQUE 0xffffffff