1# Quick Search plugin for the DeaDBeeF audio player 2# 3# Copyright (C) 2015 Christian Boxdörfer <christian.boxdoerfer@posteo.de> 4# 5# This program is free software; you can redistribute it and/or 6# modify it under the terms of the GNU General Public License 7# as published by the Free Software Foundation; either version 2 8# of the License, or (at your option) any later version. 9# 10# This program 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 this program; if not, write to the Free Software 17# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 19OUT_GTK2?=ddb_misc_quick_search_GTK2.so 20OUT_GTK3?=ddb_misc_quick_search_GTK3.so 21 22GTK2_CFLAGS?=`pkg-config --cflags gtk+-2.0` 23GTK3_CFLAGS?=`pkg-config --cflags gtk+-3.0` 24 25GTK2_LIBS?=`pkg-config --libs gtk+-2.0` 26GTK3_LIBS?=`pkg-config --libs gtk+-3.0` 27 28CC?=gcc 29CFLAGS+=-Wall -fPIC -std=c99 -D_GNU_SOURCE 30LDFLAGS+=-shared 31 32GTK2_DIR?=gtk2 33GTK3_DIR?=gtk3 34 35SOURCES?=$(wildcard *.c) 36OBJ_GTK2?=$(patsubst %.c, $(GTK2_DIR)/%.o, $(SOURCES)) 37OBJ_GTK3?=$(patsubst %.c, $(GTK3_DIR)/%.o, $(SOURCES)) 38 39define compile 40 echo $(CC) $(CFLAGS) $1 $2 $< -c -o $@ 41 $(CC) $(CFLAGS) $1 $2 $< -c -o $@ 42endef 43 44define link 45 echo $(CC) $(CFLAGS) $(LDFLAGS) $1 $2 $3 -o $@ 46 $(CC) $(CFLAGS) $(LDFLAGS) $1 $2 $3 -o $@ 47endef 48 49# Builds both GTK+2 and GTK+3 versions of the plugin. 50all: gtk2 gtk3 51 52# Builds GTK+2 version of the plugin. 53gtk2: mkdir_gtk2 $(SOURCES) $(GTK2_DIR)/$(OUT_GTK2) 54 55# Builds GTK+3 version of the plugin. 56gtk3: mkdir_gtk3 $(SOURCES) $(GTK3_DIR)/$(OUT_GTK3) 57 58mkdir_gtk2: 59 @echo "Creating build directory for GTK+2 version" 60 @mkdir -p $(GTK2_DIR) 61 62mkdir_gtk3: 63 @echo "Creating build directory for GTK+3 version" 64 @mkdir -p $(GTK3_DIR) 65 66$(GTK2_DIR)/$(OUT_GTK2): $(OBJ_GTK2) 67 @echo "Linking GTK+2 version" 68 $(call link, $(OBJ_GTK2), $(GTK2_LIBS)) 69 @echo "Done!" 70 71$(GTK3_DIR)/$(OUT_GTK3): $(OBJ_GTK3) 72 @echo "Linking GTK+3 version" 73 $(call link, $(OBJ_GTK3), $(GTK3_LIBS)) 74 @echo "Done!" 75 76$(GTK2_DIR)/%.o: %.c 77 @echo "Compiling $(subst $(GTK2_DIR)/,,$@)" 78 $(call compile, $(GTK2_CFLAGS)) 79 80$(GTK3_DIR)/%.o: %.c 81 @echo "Compiling $(subst $(GTK3_DIR)/,,$@)" 82 $(call compile, $(GTK3_CFLAGS)) 83 84clean: 85 @echo "Cleaning files from previous build..." 86 @rm -r -f $(GTK2_DIR) $(GTK3_DIR) 87