1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-11 13:50:48 -05:00
rofi/Makefile

122 lines
2.6 KiB
Makefile
Raw Normal View History

2014-01-20 03:40:50 -05:00
QUIET?=@
2014-02-01 16:31:07 -05:00
CFLAGS?=-Wall -Wextra -O3 -g
2014-01-20 03:40:50 -05:00
VERSION?=0.14.1
2014-01-19 08:18:42 -05:00
PROGRAM=simpleswitcher
2012-08-27 06:24:30 -04:00
PREFIX?=$(DESTDIR)/usr
2014-01-20 03:40:50 -05:00
BIN_DIR?=$(PREFIX)/bin
MAN_DIR?=$(PREFIX)/share/man/man1
MAN_PAGE=$(PROGRAM).1
2012-06-29 13:10:13 -04:00
2014-01-19 08:18:42 -05:00
SOURCE_DIR=source
CONFIG_DIR=config
2014-01-19 08:18:42 -05:00
DOC_DIR=doc
BUILD_DIR=build
2014-01-19 08:18:42 -05:00
SOURCES=$(wildcard $(SOURCE_DIR)/*.c $(CONFIG_DIR)/*.c )
OBJECTS=$(SOURCES:%.c=$(BUILD_DIR)/%.o)
2014-01-19 08:18:42 -05:00
HEADERS=$(wildcard include/*.h)
2014-01-20 03:40:50 -05:00
OTHERS=Makefile LICENSE README.md
INSTALL_MANPAGE_PATH=$(MAN_DIR)/$(MAN_PAGE).gz
INSTALL_PROGRAM=$(BIN_DIR)/$(PROGRAM)
2014-01-20 03:40:50 -05:00
DIST_TARGET=$(BUILD_DIR)/$(PROGRAM)-$(VERSION).tar.xz
2014-01-20 03:40:50 -05:00
CFLAGS+=-DMANPAGE_PATH="\"$(INSTALL_MANPAGE_PATH)\""
CFLAGS+=-std=c99
2014-01-19 08:18:42 -05:00
CFLAGS+=-Iinclude/
2013-01-20 07:01:13 -05:00
# Check deps.
ifeq (${DEBUG},1)
CFLAGS+=-DTIMING=1 -g3
LDADD+=-lrt
endif
2013-01-20 07:01:13 -05:00
2014-01-27 16:15:05 -05:00
ifeq (${QC_MODE},1)
CFLAGS+=-D__QC_MODE__
endif
##
# Check dependencies
##
2013-01-20 07:01:13 -05:00
PKG_CONFIG?=$(shell which pkg-config)
ifeq (${PKG_CONFIG},${EMPTY})
$(error Failed to find pkg-config. Please install pkg-config)
endif
2014-01-31 07:57:49 -05:00
CFLAGS+=$(shell ${PKG_CONFIG} --cflags x11 xinerama xft libxdg-basedir )
LDADD+=$(shell ${PKG_CONFIG} --libs x11 xinerama xft libxdg-basedir )
2013-01-20 07:01:13 -05:00
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
2014-01-19 08:18:42 -05:00
all: $(BUILD_DIR)/$(PROGRAM)
$(BUILD_DIR):
2014-01-20 03:40:50 -05:00
$(info Creating build dir)
$(QUIET)mkdir -p $@
$(QUIET)mkdir -p $@/$(SOURCE_DIR)
$(QUIET)mkdir -p $@/$(CONFIG_DIR)
2012-06-29 13:10:13 -04:00
2014-01-20 03:40:50 -05:00
# Objects depend on header files and makefile too.
$(BUILD_DIR)/%.o: %.c | Makefile $(HEADERS) $(BUILD_DIR)
2014-01-20 03:40:50 -05:00
$(info Compiling $^ -> $@)
$(QUIET) $(CC) $(CFLAGS) -c -o $@ $^
2012-06-29 13:10:13 -04:00
2014-01-19 08:18:42 -05:00
$(BUILD_DIR)/$(PROGRAM): $(OBJECTS)
2014-01-20 03:40:50 -05:00
$(info Linking $@)
$(QUIET)$(CC) -o $@ $^ $(LDADD) $(LDFLAGS)
2012-06-29 13:10:13 -04:00
2014-01-20 03:40:50 -05:00
install: $(INSTALL_PROGRAM) $(INSTALL_MANPAGE_PATH)
2012-08-27 06:24:30 -04:00
2014-01-20 03:40:50 -05:00
$(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)
2012-06-29 13:10:13 -04:00
clean:
2014-01-20 03:40:50 -05:00
$(info Clean build dir)
$(QUIET)rm -rf $(BUILD_DIR)
2014-01-10 04:35:38 -05:00
indent:
2014-01-19 08:18:42 -05:00
@astyle --style=linux -S -C -D -N -H -L -W3 -f $(SOURCES) $(HEADERS)
2014-01-20 03:40:50 -05:00
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)