makefile 665 Bytes
Newer Older
O'Reilly Media, Inc. committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
program      := play_mp3
sources      := play_mp3.c
objects      := $(subst .c,.o,$(sources))
libraries    := -ldb -lcodec -lui
dependencies := $(subst .c,.d,$(sources))

include_dirs := .. ../../include
CPPFLAGS     += $(addprefix -I , $(include_dirs))
vpath %.h $(include_dirs)

lib_dirs     := ../../lib/codec ../../lib/db ../../lib/ui
vpath %.a $(lib_dirs)

all: $(program)

$(program): $(objects) $(libraries)

.PHONY: clean
clean:
	$(RM) $(program) $(objects) $(dependencies)

ifneq "$(MAKECMDGOALS)" "clean"
  include $(dependencies)
endif

%.d: %.c
	$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -M $< |	\
	sed 's,\($*\.o\) *:,\1 $@: ,' > $@.tmp
	mv $@.tmp $@