PLUGIN_FILE := dumb.so INSTALL_DIR := $(shell pkg-config audacious --variable=input_plugin_dir) INSTALL_DIR_HOME := ~/.local/share/audacious/Plugins/Input CFLAGS ?= -O2 -pipe CFLAGS += -Wall -fPIC -DPIC -I/usr/local/include AUDACIOUSCFLAGS := $(shell pkg-config 'audacious >= 2.4' --cflags || echo "old") ifeq ($(AUDACIOUSCFLAGS),old) version: @false else CFLAGS += $(AUDACIOUSCFLAGS) endif 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) @echo @echo "The plug-in has been compiled. Run one of the following:" @echo "make install - for global (root) installation to $(INSTALL_DIR)" @echo "make install-home - for installation to home directory $(INSTALL_DIR_HOME)" $(PLUGIN_FILE): $(OBJECTS) $(CC) -shared $(LDFLAGS) -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=2.4 || { echo -n "version 2.4 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."