Make track_db public
[cmus.git] / Makefile
blob25dba2a8c0770ac9f5326d576f014d162e10087b
1 VERSION = 2.2.0
3 all: main plugins man
5 include config.mk
6 include scripts/lib.mk
8 CFLAGS += -D_FILE_OFFSET_BITS=64
10 CMUS_LIBS = $(PTHREAD_LIBS) $(NCURSES_LIBS) $(ICONV_LIBS) $(DL_LIBS) -lm $(COMPAT_LIBS)
12 input.o main.o ui_curses.o: .version
13 input.o main.o ui_curses.o: CFLAGS += -DVERSION=\"$(VERSION)\"
14 main.o server.o: CFLAGS += -DDEFAULT_PORT=3000
16 .version: Makefile
17 @test "`cat $@ 2> /dev/null`" = "$(VERSION)" && exit 0; \
18 echo " GEN $@"; echo $(VERSION) > $@
20 # programs {{{
21 cmus-y := \
22 ape.o browser.o buffer.o cmdline.o cmus.o command_mode.o comment.o \
23 db.o debug.o editable.o expr.o filters.o \
24 format_print.o glob.o help.o history.o http.o id3.o input.o \
25 keys.o lib.o load_dir.o locking.o mergesort.o misc.o options.o \
26 output.o pcm.o pl.o play_queue.o player.o \
27 read_wrapper.o server.o search.o \
28 search_mode.o spawn.o tabexp.o tabexp_file.o \
29 track.o track_db.o track_info.o tree.o uchar.o ui_curses.o \
30 utf8_encode.lo window.o worker.o xstrjoin.o
32 $(cmus-y): CFLAGS += $(PTHREAD_CFLAGS) $(NCURSES_CFLAGS) $(ICONV_CFLAGS) $(DL_CFLAGS)
34 cmus: $(cmus-y) file.o path.o prog.o xmalloc.o
35 $(call cmd,ld,$(CMUS_LIBS))
37 cmus-remote: main.o file.o path.o prog.o xmalloc.o
38 $(call cmd,ld,$(COMPAT_LIBS))
40 # cygwin compat
41 DLLTOOL=dlltool
43 libcmus-$(CONFIG_CYGWIN) := libcmus.a
45 libcmus.a: $(cmus-y) file.o path.o prog.o xmalloc.o
46 $(LD) -shared -o cmus.exe -Wl,--out-implib=libcmus.a -Wl,--base-file,cmus.base \
47 -Wl,--export-all-symbols -Wl,--no-whole-archive $^ $(CMUS_LIBS)
48 $(DLLTOOL) --output-def cmus.def --dllname cmus.exe --export-all-symbols $^
49 $(DLLTOOL) --base-file cmus.base --dllname cmus.exe --input-def cmus.def --output-exp cmus.exp
50 $(LD) -o cmus.exe -Wl,cmus.exp $^ $(CMUS_LIBS)
52 # }}}
54 # input plugins {{{
55 flac-objs := flac.lo
56 mad-objs := mad.lo nomad.lo
57 mikmod-objs := mikmod.lo
58 modplug-objs := modplug.lo
59 mpc-objs := mpc.lo
60 vorbis-objs := vorbis.lo
61 wavpack-objs := wavpack.lo
62 wav-objs := wav.lo
63 mp4-objs := mp4.lo
64 aac-objs := aac.lo
65 ffmpeg-objs := ffmpeg.lo
67 ip-$(CONFIG_FLAC) += flac.so
68 ip-$(CONFIG_MAD) += mad.so
69 ip-$(CONFIG_MIKMOD) += mikmod.so
70 ip-$(CONFIG_MODPLUG) += modplug.so
71 ip-$(CONFIG_MPC) += mpc.so
72 ip-$(CONFIG_VORBIS) += vorbis.so
73 ip-$(CONFIG_WAVPACK) += wavpack.so
74 ip-$(CONFIG_WAV) += wav.so
75 ip-$(CONFIG_MP4) += mp4.so
76 ip-$(CONFIG_AAC) += aac.so
77 ip-$(CONFIG_FFMPEG) += ffmpeg.so
79 $(flac-objs): CFLAGS += $(FLAC_CFLAGS)
80 $(mad-objs): CFLAGS += $(MAD_CFLAGS)
81 $(mikmod-objs): CFLAGS += $(MIKMOD_CFLAGS)
82 $(modplug-objs): CFLAGS += $(MODPLUG_CFLAGS)
83 $(mpc-objs): CFLAGS += $(MPC_CFLAGS)
84 $(vorbis-objs): CFLAGS += $(VORBIS_CFLAGS)
85 $(wavpack-objs): CFLAGS += $(WAVPACK_CFLAGS)
86 $(mp4-objs): CFLAGS += $(MP4_CFLAGS)
87 $(aac-objs): CFLAGS += $(AAC_CFLAGS)
88 $(ffmpeg-objs): CFLAGS += $(FFMPEG_CFLAGS)
90 flac.so: $(flac-objs) $(libcmus-y)
91 $(call cmd,ld_dl,$(FLAC_LIBS))
93 mad.so: $(mad-objs) $(libcmus-y)
94 $(call cmd,ld_dl,$(MAD_LIBS) $(ICONV_LIBS))
96 mikmod.so: $(mikmod-objs) $(libcmus-y)
97 $(call cmd,ld_dl,$(MIKMOD_LIBS))
99 modplug.so: $(modplug-objs) $(libcmus-y)
100 $(call cmd,ld_dl,$(MODPLUG_LIBS))
102 mpc.so: $(mpc-objs) $(libcmus-y)
103 $(call cmd,ld_dl,$(MPC_LIBS))
105 vorbis.so: $(vorbis-objs) $(libcmus-y)
106 $(call cmd,ld_dl,$(VORBIS_LIBS))
108 wavpack.so: $(wavpack-objs) $(libcmus-y)
109 $(call cmd,ld_dl,$(WAVPACK_LIBS))
111 wav.so: $(wav-objs) $(libcmus-y)
112 $(call cmd,ld_dl,)
114 mp4.so: $(mp4-objs) $(libcmus-y)
115 $(call cmd,ld_dl,$(MP4_LIBS))
117 aac.so: $(aac-objs) $(libcmus-y)
118 $(call cmd,ld_dl,$(AAC_LIBS))
120 ffmpeg.so: $(ffmpeg-objs) $(libcmus-y)
121 $(call cmd,ld_dl,$(FFMPEG_LIBS))
123 # }}}
125 # output plugins {{{
126 alsa-objs := alsa.lo mixer_alsa.lo
127 arts-objs := arts.lo
128 oss-objs := oss.lo mixer_oss.lo
129 sun-objs := sun.lo mixer_sun.lo
130 ao-objs := ao.lo
131 waveout-objs := waveout.lo
133 op-$(CONFIG_ALSA) += alsa.so
134 op-$(CONFIG_ARTS) += arts.so
135 op-$(CONFIG_OSS) += oss.so
136 op-$(CONFIG_SUN) += sun.so
137 op-$(CONFIG_AO) += ao.so
138 op-$(CONFIG_WAVEOUT) += waveout.so
140 $(alsa-objs): CFLAGS += $(ALSA_CFLAGS)
141 $(arts-objs): CFLAGS += $(ARTS_CFLAGS)
142 $(oss-objs): CFLAGS += $(OSS_CFLAGS)
143 $(sun-objs): CFLAGS += $(SUN_CFLAGS)
144 $(ao-objs): CFLAGS += $(AO_CFLAGS)
145 $(waveout-objs): CFLAGS += $(WAVEOUT_CFLAGS)
147 alsa.so: $(alsa-objs) $(libcmus-y)
148 $(call cmd,ld_dl,$(ALSA_LIBS))
150 arts.so: $(arts-objs) $(libcmus-y)
151 $(call cmd,ld_dl,$(ARTS_LIBS))
153 oss.so: $(oss-objs) $(libcmus-y)
154 $(call cmd,ld_dl,$(OSS_LIBS))
156 sun.so: $(sun-objs) $(libcmus-y)
157 $(call cmd,ld_dl,$(SUN_LIBS))
159 ao.so: $(ao-objs) $(libcmus-y)
160 $(call cmd,ld_dl,$(AO_LIBS))
162 waveout.so: $(waveout-objs) $(libcmus-y)
163 $(call cmd,ld_dl,$(WAVEOUT_LIBS))
164 # }}}
166 # man {{{
167 man1 := Doc/cmus.1 Doc/cmus-remote.1
169 $(man1): Doc/ttman
171 %.1: %.txt
172 $(call cmd,ttman)
174 Doc/ttman: Doc/ttman.o
175 $(call cmd,ld,)
177 quiet_cmd_ttman = MAN $@
178 cmd_ttman = Doc/ttman $< $@
179 # }}}
181 data = $(wildcard data/*)
183 clean += *.o *.lo *.so cmus libcmus.a cmus.def cmus.base cmus.exp cmus-remote Doc/*.o Doc/ttman Doc/*.1
184 distclean += .version config.mk config/*.h tags
186 main: cmus cmus-remote
187 plugins: $(ip-y) $(op-y)
188 man: $(man1)
190 install-main: main
191 $(INSTALL) -m755 $(bindir) cmus cmus-remote
193 install-plugins: plugins
194 $(INSTALL) -m755 $(libdir)/cmus/ip $(ip-y)
195 $(INSTALL) -m755 $(libdir)/cmus/op $(op-y)
197 install-data: man
198 $(INSTALL) -m644 $(datadir)/cmus $(data)
199 $(INSTALL) -m644 $(mandir)/man1 $(man1)
200 $(INSTALL) -m755 $(exampledir) cmus-status-display
202 install: all install-main install-plugins install-data
204 tags:
205 exuberant-ctags *.[ch]
207 # generating tarball using GIT {{{
208 REV = HEAD
210 # version from an annotated tag
211 _ver0 = $(shell git describe $(REV) 2>/dev/null)
212 # version from a plain tag
213 _ver1 = $(shell git describe --tags $(REV) 2>/dev/null)
214 # SHA1
215 _ver2 = $(shell git rev-parse --verify --short $(REV) 2>/dev/null)
217 TARNAME = cmus-$(or $(_ver0),$(_ver1),g$(_ver2))
219 dist:
220 @tarname=$(TARNAME); \
221 test "$(_ver2)" || { echo "No such revision $(REV)"; exit 1; }; \
222 echo " DIST $$tarname.tar.bz2"; \
223 git archive --format=tar --prefix=$$tarname/ $(REV)^{tree} | bzip2 -c -9 > $$tarname.tar.bz2
225 # }}}
227 .PHONY: all main plugins man dist tags
228 .PHONY: install install-main install-plugins install-man