<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,6 +1,5 @@
 *~
-*.o
-*.a
+*.[doa]
 .*.swp
 manual/shell-fm.1.gz
 source/shell-fm</diff>
      <filename>.gitignore</filename>
    </modified>
    <modified>
      <diff>@@ -1,10 +1,15 @@
 MAIN	:= main.c
 SOURCE	:= $(filter-out $(MAIN),$(wildcard *.c))
 OBJECT	:= $(subst .c,.o,$(SOURCE))
+DEP	:= $(subst .c,.d,$(SOURCE))
 BINARY	:= shell-fm
 LIB	:= libshellfm.so
 STATIC	:= libshellfm.a
+CFLAGS  += -Os -Wall -MD -W -I./include/
 
+ifdef EXTERN_ONLY
+	CFLAGS += -DEXTERN_ONLY
+else
 ifeq ($(shell uname -s), OpenBSD)
 	LDFLAGS += -lossaudio
 endif
@@ -15,7 +20,7 @@ ifeq ($(shell uname -s), Darwin)
 	CFLAGS += -D__darwin__
 endif
 
-CFLAGS  += -Os -Wall -W -I./include/ -DLIBAO \
+CFLAGS  += -DLIBAO \
 	   $(shell pkg-config --cflags mad) \
 	   $(shell pkg-config --cflags ao)
 LDFLAGS += $(shell pkg-config --libs mad) \
@@ -25,25 +30,25 @@ ifeq ($(shell pkg-config --exists taglib_c &amp;&amp; echo 1), 1)
 	CFLAGS  += $(shell pkg-config --cflags taglib_c) -DTAGLIB
 	LDFLAGS += $(shell pkg-config --libs taglib_c)
 endif
+endif
 
 .PHONY: clean tags cscope
 
-all	: shell-fm
-
-objects	: $(SOURCE)
-	$(CC) $(CFLAGS) -fPIC -c $(SOURCE)	
+all	: $(BINARY)
 
 $(LIB)	: $(OBJECT)
-	$(CC) -shared -Wl,-soname,$(LIB) -o $(LIB) $(OBJECT) 
+	$(CC) -shared -Wl,-soname,$(LIB) -o $(LIB) $(OBJECT)
 
 $(STATIC) : $(OBJECT)
 	$(AR) -cvq $(STATIC) $(OBJECT)
 
-$(BINARY)	: $(STATIC)
+$(BINARY)	: $(STATIC) $(MAIN)
 	$(CC) -o $(BINARY) $(CFLAGS) $(MAIN) $(LDFLAGS) $(STATIC)
 
 clean		:
-	rm -f $(OBJECT) $(BINARY) $(LIB) $(STATIC)
+	rm -f $(OBJECT) $(BINARY) $(LIB) $(STATIC) $(DEP)
 
 tags cscope	:
 	$(MAKE) -C .. $@
+
+sinclude $(DEP)</diff>
      <filename>source/Makefile</filename>
    </modified>
    <modified>
      <diff>@@ -154,10 +154,18 @@ int main(int argc, char ** argv) {
 	if(nerror)
 		help(argv[0], EXIT_FAILURE);
 
+#ifdef EXTERN_ONLY
+	/* Abort if EXTERN_ONLY is defined and no extern command is present */
+	if(!haskey(&amp; rc, &quot;extern&quot;)) {
+		fputs(&quot;Can't continue without extern command.\n&quot;, stderr);
+		exit(EXIT_FAILURE);
+	}
+#else
 #ifndef LIBAO
 	if(!haskey(&amp; rc, &quot;device&quot;))
 		set(&amp; rc, &quot;device&quot;, &quot;/dev/audio&quot;);
 #endif
+#endif
 
 	if(!background) {
 		puts(&quot;Shell.FM v&quot; PACKAGE_VERSION &quot;, (C) 2006-2009 by Jonas Kramer&quot;);</diff>
      <filename>source/main.c</filename>
    </modified>
    <modified>
      <diff>@@ -8,8 +8,6 @@
 
 #define _GNU_SOURCE
 
-#include &lt;mad.h&gt;
-
 #include &lt;stdio.h&gt;
 #include &lt;stdlib.h&gt;
 #include &lt;string.h&gt;
@@ -23,6 +21,9 @@
 #include &lt;sys/stat.h&gt;
 #include &lt;assert.h&gt;
 
+#ifndef EXTERN_ONLY
+#include &lt;mad.h&gt;
+
 #ifdef LIBAO
 #include &lt;ao/ao.h&gt;
 #else
@@ -39,16 +40,18 @@
 
 #endif
 
+#ifdef TAGLIB
+#include &lt;taglib/tag_c.h&gt;
+#endif
+#endif
+
 #include &quot;settings.h&quot;
 #include &quot;pipe.h&quot;
 #include &quot;play.h&quot;
 #include &quot;interface.h&quot;
 #include &quot;globals.h&quot;
 
-#ifdef TAGLIB
-#include &lt;taglib/tag_c.h&gt;
-#endif
-
+#ifndef EXTERN_ONLY
 struct stream {
 	FILE * streamfd;
 #ifdef LIBAO
@@ -67,13 +70,16 @@ struct stream {
 	int timeout;
 	int preload;
 };
+#endif
 
 #define BUFSIZE (32*1024)
 
+#ifndef EXTERN_ONLY
 static enum mad_flow input(void *, struct mad_stream *);
 static enum mad_flow output(void *, const struct mad_header *, struct mad_pcm *);
 inline signed scale(mad_fixed_t);
 static int timed_read(int, unsigned char *, int, int);
+#endif
 
 int killed = 0;
 
@@ -115,12 +121,13 @@ mkpath(char *path)
 }
 
 int playback(FILE * streamfd, int pipefd) {
-	const char * freetrack = NULL;
-
 	killed = 0;
 	signal(SIGUSR1, sighand);
 
+#ifndef EXTERN_ONLY
 	if(!haskey(&amp; rc, &quot;extern&quot;)) {
+		const char * freetrack = NULL;
+
 		struct stream data;
 		struct mad_decoder dec;
 
@@ -262,8 +269,10 @@ int playback(FILE * streamfd, int pipefd) {
 
 			free(data.path);
 		}
-
-	} else {
+	}
+	else
+#endif
+	{
 		pid_t ppid = getppid(), cpid = 0;
 		const char * cmd = meta(value(&amp; rc, &quot;extern&quot;), M_SHELLESC, &amp; track);
 		FILE * ext = openpipe(cmd, &amp; cpid);
@@ -303,6 +312,12 @@ int playback(FILE * streamfd, int pipefd) {
 	return !0;
 }
 
+static void sighand(int sig) {
+	if(sig == SIGUSR1)
+		killed = !0;
+}
+
+#ifndef EXTERN_ONLY
 static enum mad_flow input(void * data, struct mad_stream * stream) {
 	static unsigned char buf[BUFSIZE + 1] = { 0 };
 	struct stream * ptr = (struct stream *) data;
@@ -517,12 +532,6 @@ inline signed scale(register mad_fixed_t sample) {
 	return (sample &gt;&gt; (MAD_F_FRACBITS + 1 - 16)) * volume / MAX_VOLUME;
 }
 
-static void sighand(int sig) {
-	if(sig == SIGUSR1)
-		killed = !0;
-}
-
-
 static int timed_read(int fd, unsigned char * p, int count, int timeout) {
 	fd_set fdset;
 	struct timeval tv;
@@ -546,3 +555,4 @@ static int timed_read(int fd, unsigned char * p, int count, int timeout) {
 	fprintf(stderr, &quot;Track stream timed out (%d).\n&quot;, timeout);
 	return -1;
 }
+#endif</diff>
      <filename>source/play.c</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>f241e1ac69a25799cb004c6015acc57354051af3</id>
    </parent>
  </parents>
  <author>
    <name>Yuri D'Elia</name>
    <email>yuri.delia@eurac.edu</email>
  </author>
  <url>http://github.com/jkramer/shell-fm/commit/d1f6dde330da8c25fc72a51dc54d7d23c8c7f47e</url>
  <id>d1f6dde330da8c25fc72a51dc54d7d23c8c7f47e</id>
  <committed-date>2009-09-19T08:26:20-07:00</committed-date>
  <authored-date>2009-09-16T07:02:29-07:00</authored-date>
  <message>Allow to build shell-fm without dependencies.

Call make with EXTERN_ONLY=1:

  make EXTERN_ONLY=1 [args]

to build shell-fm without built-in playback capabilities.

Signed-off-by: Jonas Kramer &lt;jkramer@nex.scrapping.cc&gt;</message>
  <tree>5f7af073e05f3380afb721bf0b5424230fdbbdd7</tree>
  <committer>
    <name>Jonas Kramer</name>
    <email>jkramer@nex.scrapping.cc</email>
  </committer>
</commit>
