diff --git a/doc/examples/Makefile b/doc/examples/Makefile index 5127fd36..fb981828 100644 --- a/doc/examples/Makefile +++ b/doc/examples/Makefile @@ -1,9 +1,26 @@ +targets = mpg123_to_wav scan id3dump mpglib -CFLAGS := -g -Wall $(shell pkg-config --cflags libmpg123 sndfile) -LDFLAGS := $(shell pkg-config --libs libmpg123 sndfile) +all: $(targets) + +MPG123_CFLAGS := $(shell pkg-config --cflags libmpg123) +MPG123_LDFLAGS := $(shell pkg-config --libs libmpg123) +SND_CFLAGS := $(shell pkg-config --cflags sndfile) +SND_LDFLAGS := $(shell pkg-config --libs sndfile) + +# Oder of libs not that important here... +compile = $(CC) $(CFLAGS) $(LDFLAGS) $(MPG123_CFLAGS) $(MPG123_LDFLAGS) mpg123_to_wav: mpg123_to_wav.c - $(CC) $(CFLAGS) $(LDFLAGS) -o mpg123_to_wav mpg123_to_wav.c + $(compile) $(SND_CFLAGS) $(SND_LDFLAGS)-o mpg123_to_wav mpg123_to_wav.c + +scan: scan.c + $(compile) -o scan scan.c + +id3dump:id3dump.c + $(compile) -o id3dump id3dump.c + +mpglib: mpglib.c + $(compile) -o mpglib mpglib.c clean: - rm -f mpg123_to_wav + rm -vf $(targets) diff --git a/src/id3dump.c b/doc/examples/id3dump.c similarity index 100% rename from src/id3dump.c rename to doc/examples/id3dump.c diff --git a/src/mpglib.c b/doc/examples/mpglib.c similarity index 100% rename from src/mpglib.c rename to doc/examples/mpglib.c diff --git a/src/scan.c b/doc/examples/scan.c similarity index 100% rename from src/scan.c rename to doc/examples/scan.c diff --git a/src/Makefile.am b/src/Makefile.am index 79b06340..641adf05 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -18,25 +18,6 @@ EXTRA_DIST = Makefile.legacy config.h.legacy legacy_module.c module.c CLEANFILES = *.a bin_PROGRAMS = mpg123 -EXTRA_PROGRAMS = mpglib scan id3dump - -# Dammit, how do I cross-directory dependencies so that they actually _work_? -# Putting all rules in one makefile doesn't work with libtool as long as I got the sources organized in subdirs. -# That SUCKS. - -mpglib_LDADD = libmpg123/libmpg123.la -mpglib_DEPENDENCIES = libmpg123/libmpg123.la - -scan_LDADD = libmpg123/libmpg123.la -scan_DEPENDENCIES = libmpg123/libmpg123.la -scan_SOURCES = scan.c - -id3dump_LDADD = libmpg123/libmpg123.la -id3dump_DEPENDENCIES = libmpg123/libmpg123.la -id3dump_SOURCES = id3dump.c - -mpglib_SOURCES = \ - mpglib.c mpg123_SOURCES = \ audio.c \