change license from GPLv3 to GPLv3 or later
[mmq.git] / Makefile
blobd9d7700685a80d2fac2cb5fd6c498a0189b72dc7
1 # default target
2 all::
4 prefix = $(HOME)
5 bindir = $(prefix)/bin
6 INSTALL = install
7 STRIP ?= strip
8 GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
9 @./GIT-VERSION-GEN
10 -include GIT-VERSION-FILE
12 DISTNAME = mmq-$(GIT_VERSION)
14 LIBS = -lrt
15 EXTLIBS =
17 # overridable from command-line or config.mk
18 CFLAGS = -g -O2 -Wall
19 LDFLAGS = -Wl,-O1
20 MMQ_AO = pa
22 config.mk:
23 @true
24 -include config.mk
25 include $(MMQ_AO).mk
27 OBJS := $(addsuffix .o,mmq-player print ao input)
28 HDRS = $(wildcard compat/*.h *.h)
30 ao.o: cflags = $(CFLAGS) $(MMQ_AO_CFLAGS)
31 ao.o: ao.c $(MMQ_AO).c mmq.h config.mk
32 $(CC) -o $*.o -c $(cflags) -DMMQ_AO_IMPL='"$(MMQ_AO).c"' $<
34 FIXEDDEC_LIB := fixeddec/libfixeddec.a
35 FIXEDDEC_OBJS := $(addprefix fixeddec/,$(addsuffix .o,flac tremor mad))
36 $(FIXEDDEC_OBJS): fixeddec/fixeddec.h
37 $(FIXEDDEC_LIB): $(FIXEDDEC_OBJS)
38 $(RM) $@
39 $(AR) rcs $@ $(FIXEDDEC_OBJS)
41 %.o: %.c $(HDRS)
42 $(CC) -o $*.o -c $(CFLAGS) $<
44 MMQ_DEC_LIBS := $(FIXEDDEC_LIB)
46 MMQ_BIN := mmq-player mmq-enq
48 mmq-enq: mmq-enq.c print.o
49 $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS)
51 mmq-player: ldflags = $(LDFLAGS) $(MMQ_AO_LDFLAGS)
52 mmq-player: libs = $(LIBS) $(MMQ_AO_LIBS) $(MMQ_DEC_LIBS)
53 mmq-player: $(OBJS) $(MMQ_DEC_LIBS)
54 $(CC) $(CFLAGS) -o $@ $(OBJS) $(ldflags) $(libs) $(EXTLIBS)
56 all:: $(MMQ_BIN)
58 install: $(MMQ_BIN)
59 $(INSTALL) -d -m 755 '$(DESTDIR)$(bindir)'
60 $(INSTALL) $^ '$(DESTDIR)$(bindir)'
62 strip: $(MMQ_BIN)
63 $(STRIP) $(STRIP_OPTS) $(MMQ_BIN)
65 install-strip: strip
66 $(MAKE) install
68 dist: GIT-VERSION-FILE
69 git archive --format=tar --prefix=$(DISTNAME)/ HEAD^{tree} \
70 | gzip -9 > $(DISTNAME).tar.gz+
71 mv $(DISTNAME).tar.gz+ $(DISTNAME).tar.gz
72 clean:
73 $(RM) $(MMQ_BIN) $(DISTNAME).tar.gz* GIT-VERSION-FILE $(OBJS)
74 $(RM) $(FIXEDDEC_OBJS) $(FIXEDDEC_LIB)
76 .PHONY: .FORCE-GIT-VERSION-FILE install