PLUGIN_FILE := libdumb.so INSTALL_DIR := $(shell pkg-config audacious --variable=input_plugin_dir) INSTALL_DIR_HOME := ~/.local/share/audacious/Plugins/Input CC ?= gcc CFLAGS ?= -O2 -pipe CFLAGS += -Wall -fPIC -DPIC -I$(LOCALBASE)/include AUDACIOUSCFLAGS = $(shell pkg-config 'audacious >= 1.3' --cflags || echo "old") ifeq ($(AUDACIOUSCFLAGS),old) error else CFLAGS += $(AUDACIOUSCFLAGS) endif LDFLAGS+= -fPIC -DPIC DUMBLIBS := -ldumb -L/usr/local/lib AUDACIOUSLIBS := $(shell pkg-config audacious --libs) SOURCES := audacious-dumb.c callbacks.c interface.c support.c OBJDIR := obj OBJECTS := $(SOURCES:%.c=$(OBJDIR)/%.o) all: $(PLUGIN_FILE) $(PLUGIN_FILE): $(OBJECTS) $(CC) $(LDFLAGS) -shared -o $@ $^ $(DUMBLIBS) $(AUDACIOUSLIBS) $(OBJDIR)/%.o: %.c $(CC) -o $@ $(CFLAGS) -c $< install: all install -d $(DESTDIR)$(INSTALL_DIR) install -m 0755 $(PLUGIN_FILE) $(DESTDIR)$(INSTALL_DIR) @echo @echo "The plug-in has been installed." @echo "It is recommended you disable the Modplug plug-in" @echo "and any others that support the IT, XM, S3M or MOD formats." @echo "Enjoy!" install-home: all install -d $(INSTALL_DIR_HOME) install -m 0755 $(PLUGIN_FILE) $(INSTALL_DIR_HOME) @echo @echo "The plug-in has been installed." @echo "It is recommended you disable the Modplug plug-in" @echo "and any others that support the IT, XM, S3M or MOD formats." @echo "Enjoy!" uninstall: rm -f $(DESTDIR)$(INSTALL_DIR)/$(PLUGIN_FILE) @echo @echo "The plug-in has been uninstalled." uninstall-home: rm -f $(INSTALL_DIR_HOME)/$(PLUGIN_FILE) @echo @echo "The plug-in has been uninstalled." clean: rm -f $(OBJECTS) distclean: clean rm -f $(PLUGIN_FILE) *~ DEPCC := echo "int main() { return 0; };" | $(CC) -x c -o /dev/null - depcheck: @echo -n "dumb.h ... " @$(DEPCC) -include dumb.h && echo "found." || exit 1 @echo -n "libdumb.so ... " @$(DEPCC) $(DUMBLIBS) -lm && echo "found." || exit 1 @echo -n "Audacious ... " @pkg-config audacious --exists || { echo -n "pkg-config audacious not found: " && exit 1; } @pkg-config audacious --atleast-version=1.3 || { echo -n "version 1.3 or later not found." && exit 1; } @$(DEPCC) $(CFLAGS) $(AUDACIOUSLIBS) -include audacious/plugin.h && echo "`pkg-config audacious --modversion` found." || exit 1 @echo "Everything seems to be ok."