1# Musical Spectrum plugin for the DeaDBeeF audio player 2# 3# Copyright (C) 2015 Christian Boxdörfer <christian.boxdoerfer@posteo.de> 4# 5# Based on DeaDBeeFs stock spectrum. 6# Copyright (c) 2009-2015 Alexey Yakovenko <waker@users.sourceforge.net> 7# Copyright (c) 2011 William Pitcock <nenolod@dereferenced.org> 8# 9# This program is free software; you can redistribute it and/or 10# modify it under the terms of the GNU General Public License 11# as published by the Free Software Foundation; either version 2 12# of the License, or (at your option) any later version. 13# 14# This program is distributed in the hope that it will be useful, 15# but WITHOUT ANY WARRANTY; without even the implied warranty of 16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17# GNU General Public License for more details. 18# 19# You should have received a copy of the GNU General Public License 20# along with this program; if not, write to the Free Software 21# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 22 23OUT_GTK2?=ddb_vis_musical_spectrum_GTK2.so 24OUT_GTK3?=ddb_vis_musical_spectrum_GTK3.so 25 26GTK2_CFLAGS?=`pkg-config --cflags gtk+-2.0` 27GTK3_CFLAGS?=`pkg-config --cflags gtk+-3.0` 28 29GTK2_LIBS?=`pkg-config --libs gtk+-2.0` 30GTK3_LIBS?=`pkg-config --libs gtk+-3.0` 31 32FFTW_LIBS?=-lfftw3 33 34CC?=gcc 35CFLAGS+=-Wall -fPIC -std=c99 -D_GNU_SOURCE 36LDFLAGS+=-shared 37 38GTK2_DIR?=gtk2 39GTK3_DIR?=gtk3 40 41SOURCES?=$(wildcard *.c) 42OBJ_GTK2?=$(patsubst %.c, $(GTK2_DIR)/%.o, $(SOURCES)) 43OBJ_GTK3?=$(patsubst %.c, $(GTK3_DIR)/%.o, $(SOURCES)) 44 45define compile 46 $(CC) $(CFLAGS) $1 $2 $< -c -o $@ 47endef 48 49define link 50 $(CC) $(LDFLAGS) $1 $2 $3 -o $@ 51endef 52 53# Builds both GTK+2 and GTK+3 versions of the plugin. 54all: gtk2 gtk3 55 56# Builds GTK+2 version of the plugin. 57gtk2: mkdir_gtk2 $(SOURCES) $(GTK2_DIR)/$(OUT_GTK2) 58 59# Builds GTK+3 version of the plugin. 60gtk3: mkdir_gtk3 $(SOURCES) $(GTK3_DIR)/$(OUT_GTK3) 61 62mkdir_gtk2: 63 @echo "Creating build directory for GTK+2 version" 64 @mkdir -p $(GTK2_DIR) 65 66mkdir_gtk3: 67 @echo "Creating build directory for GTK+3 version" 68 @mkdir -p $(GTK3_DIR) 69 70$(GTK2_DIR)/$(OUT_GTK2): $(OBJ_GTK2) 71 @echo "Linking GTK+2 version" 72 $(call link, $(OBJ_GTK2), $(GTK2_LIBS), $(FFTW_LIBS)) 73 @echo "Done!" 74 75$(GTK3_DIR)/$(OUT_GTK3): $(OBJ_GTK3) 76 @echo "Linking GTK+3 version" 77 $(call link, $(OBJ_GTK3), $(GTK3_LIBS), $(FFTW_LIBS)) 78 @echo "Done!" 79 80$(GTK2_DIR)/%.o: %.c 81 @echo "Compiling $(subst $(GTK2_DIR)/,,$@)" 82 $(call compile, $(GTK2_CFLAGS)) 83 84$(GTK3_DIR)/%.o: %.c 85 @echo "Compiling $(subst $(GTK3_DIR)/,,$@)" 86 $(call compile, $(GTK3_CFLAGS)) 87 88clean: 89 @echo "Cleaning files from previous build..." 90 @rm -r -f $(GTK2_DIR) $(GTK3_DIR) 91