| 1 |
# |
| 2 |
# This file is part of devilspie2 |
| 3 |
# Copyright (C) 2011-2015 Andreas Rönnquist |
| 4 |
# |
| 5 |
# devilspie2 is free software: you can redistribute it and/or |
| 6 |
# modify it under the terms of the GNU General Public License as published |
| 7 |
# by the Free Software Foundation, either version 3 of the License, or |
| 8 |
# (at your option) any later version. |
| 9 |
# |
| 10 |
# devilspie2 is distributed in the hope that it will be useful, |
| 11 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
# GNU General Public License for more details. |
| 14 |
# |
| 15 |
# You should have received a copy of the GNU General Public License |
| 16 |
# along with devilspie2. |
| 17 |
# If not, see <http://www.gnu.org/licenses/>. |
| 18 |
# |
| 19 |
|
| 20 |
ifndef CC |
| 21 |
CC=gcc |
| 22 |
endif |
| 23 |
SRC=src |
| 24 |
OBJ=obj |
| 25 |
BIN=bin |
| 26 |
|
| 27 |
ifdef DEBUG |
| 28 |
STD_CFLAGS=-Wall -g3 -ggdb -D_DEBUG |
| 29 |
else |
| 30 |
STD_CFLAGS=-Wall -Wformat -Wno-format-extra-args -Wformat-security -Wformat-nonliteral -Wformat=2 |
| 31 |
endif |
| 32 |
|
| 33 |
DEPEND=Makefile.dep |
| 34 |
|
| 35 |
OBJECTS=$(OBJ)/config.o $(OBJ)/devilspie2.o $(OBJ)/xutils.o $(OBJ)/script.o $(OBJ)/script_functions.o $(OBJ)/error_strings.o |
| 36 |
|
| 37 |
ifndef PREFIX |
| 38 |
ifdef INSTALL_PREFIX |
| 39 |
PREFIX=$(INSTALL_PREFIX) |
| 40 |
else |
| 41 |
PREFIX=/usr/local |
| 42 |
endif |
| 43 |
endif |
| 44 |
|
| 45 |
NAME = devilspie2 |
| 46 |
PROG=$(BIN)/$(NAME) |
| 47 |
VERSION = $(shell cat ./VERSION) |
| 48 |
DATADIR = ${DESTDIR}${PREFIX}/share |
| 49 |
LOCALEDIR = ${DATADIR}/locale |
| 50 |
MANPAGE = ${NAME}.1 |
| 51 |
|
| 52 |
ifdef GTK2 |
| 53 |
PKG_GTK=gtk+-2.0 |
| 54 |
PKG_WNCK=libwnck-1.0 |
| 55 |
|
| 56 |
CHECK_GTK3=1 |
| 57 |
else |
| 58 |
PKG_GTK=gtk+-3.0 |
| 59 |
PKG_WNCK=libwnck-3.0 |
| 60 |
endif |
| 61 |
|
| 62 |
LIB_CFLAGS=$(shell pkg-config --cflags --silence-errors $(PKG_GTK) $(PKG_WNCK) lua5.1 || pkg-config --cflags $(PKG_GTK) $(PKG_WNCK) lua) |
| 63 |
STD_LDFLAGS= |
| 64 |
LIBS=-lX11 $(shell pkg-config --libs --silence-errors $(PKG_GTK) $(PKG_WNCK) lua5.1 || pkg-config --libs $(PKG_GTK) $(PKG_WNCK) lua) |
| 65 |
|
| 66 |
LOCAL_CFLAGS=$(STD_CFLAGS) $(DEPRECATED) $(CFLAGS) $(LIB_CFLAGS) |
| 67 |
LOCAL_LDFLAGS=$(STD_CFLAGS) $(LDFLAGS) $(STD_LDFLAGS) |
| 68 |
|
| 69 |
LOCAL_CPPFLAGS=$(CPPFLAGS) |
| 70 |
|
| 71 |
ifdef CHECK_GTK3 |
| 72 |
LOCAL_CFLAGS+=-DGTK_DISABLE_SINGLE_INCLUDES |
| 73 |
LOCAL_CFLAGS+=-DGSEAL_ENABLE |
| 74 |
|
| 75 |
CHECK_DEPRECATED=1 |
| 76 |
endif |
| 77 |
|
| 78 |
ifdef CHECK_DEPRECATED |
| 79 |
LOCAL_CFLAGS+=-DGDK_PIXBUF_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED |
| 80 |
endif |
| 81 |
|
| 82 |
LOCAL_CFLAGS+=-DLOCALEDIR=\"$(LOCALEDIR)\" -DPACKAGE=\"$(NAME)\" -DDEVILSPIE2_VERSION=\"$(VERSION)\" |
| 83 |
|
| 84 |
.PHONY: all |
| 85 |
all: $(BIN)/devilspie2 |
| 86 |
${MAKE} -C po -j1 all |
| 87 |
|
| 88 |
$(OBJ)/%.o: $(SRC)/%.c |
| 89 |
$(CC) $(LOCAL_CFLAGS) $(LOCAL_CPPFLAGS) -c $< -o $@ |
| 90 |
|
| 91 |
$(BIN)/$(NAME): $(OBJECTS) |
| 92 |
$(CC) $(LOCAL_CFLAGS) $(LOCAL_LDFLAGS) $(OBJECTS) -o $(PROG) $(LIBS) |
| 93 |
|
| 94 |
.PHONY: clean |
| 95 |
clean: |
| 96 |
rm -rf $(OBJECTS) $(PROG) $(DEPEND) |
| 97 |
${MAKE} -C po clean |
| 98 |
|
| 99 |
install: |
| 100 |
install -d $(DESTDIR)$(PREFIX)/bin |
| 101 |
install -m 755 $(PROG) $(DESTDIR)$(PREFIX)/bin |
| 102 |
install -d $(DESTDIR)$(PREFIX)/share/man/man1 |
| 103 |
install -m 644 $(MANPAGE) $(DESTDIR)$(PREFIX)/share/man/man1 |
| 104 |
${MAKE} -C po install |
| 105 |
|
| 106 |
.PHONY: uninstall |
| 107 |
uninstall: |
| 108 |
rm -f $(DESTDIR)$(PREFIX)/$(PROG) |
| 109 |
${MAKE} -C po uninstall |
| 110 |
|
| 111 |
$(DEPEND): |
| 112 |
$(CC) -MM $(LOCAL_CFLAGS) $(SRC)/*.c | sed -e "s/\([A-Za-z0-9+-0._&+-]*:\)/\$(OBJ)\/\1/g" > $(DEPEND) |
| 113 |
|
| 114 |
-include $(DEPEND) |