Fix SONAME.
[jelmer/ptabtools.git] / Makefile
1 -include Makefile.settings
2
3 SOVERSION = 0.5.0
4
5 PTBLIB_OBJS = ptb.o gp.o ptb-tuning.o
6 TARGETS = $(TARGET_BINS) $(TARGET_LIBS)
7
8 all: $(TARGETS)
9
10 tests/check: tests/check.o tests/ptb.o tests/gp.o ptb.o
11         $(CC) $(FLAGS) $^ -o $@ $(CHECK_LIBS) 
12
13 ptb2xml.o: ptb2xml.c
14         $(CC) $(CFLAGS) -c $< $(LIBXSLT_CFLAGS) $(LIBXML_CFLAGS) $(XSLT_DEFINE)
15
16 %.o: %.c
17         $(CC) $(CFLAGS) -c $< -o $@
18
19 %.po: %.c
20         $(CC) $(CFLAGS) -fPIC -c $< -o $@
21
22 ptb.dll: $(PTBLIB_OBJS)
23         $(CC) $(SHFLAGS) $(CFLAGS) -Wl,--out-implib=ptb.dll.a -o $@ $^
24
25 libptb.so.$(VERSION): $(PTBLIB_OBJS:.o=.po)
26         $(CC) $(SHFLAGS) -Wl,-soname,libptb.so.$(SOVERSION) -Wl,$@ $(CFLAGS) -o $@ $^
27
28 libptb.a: $(PTBLIB_OBJS)
29         $(AR) rs $@ $^
30
31 ptb2xml$(EXEEXT): ptb2xml.o ptb.o
32         $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) $(LIBXML_LIBS) $(LIBXSLT_LIBS) $(POPT_LIBS)
33         
34 ptb2ascii$(EXEEXT): ptb2ascii.o ptb.o
35         $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) $(POPT_LIBS)
36
37 ptb2ptb$(EXEEXT): ptb2ptb.o ptb.o
38         $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) $(POPT_LIBS)
39
40 ptb2ly$(EXEEXT): ptb2ly.o ptb.o
41         $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) $(POPT_LIBS)
42
43 ptb2abc$(EXEEXT): ptb2abc.o ptb.o
44         $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) $(POPT_LIBS)
45
46 gp2ly$(EXEEXT): gp2ly.o gp.o
47         $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) $(POPT_LIBS)
48
49 ptbinfo$(EXEEXT): ptbinfo.o ptb.o
50         $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) $(POPT_LIBS)
51
52 ptbdict$(EXEEXT): ptbdict.o ptb.o ptb-tuning.o
53         $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) $(POPT_LIBS)
54         
55 install: all
56         $(INSTALL) -d $(DESTDIR)$(bindir)
57         test -z "$(TARGET_BINS)" || $(INSTALL) $(TARGET_BINS) $(DESTDIR)$(bindir)
58         $(INSTALL) -d $(DESTDIR)$(mandir)/man1
59         $(INSTALL) -m 644 $(PROGS_MANPAGES) $(DESTDIR)$(mandir)/man1
60         $(INSTALL) -d $(DESTDIR)$(libdir)
61         test -z "$(TARGET_LIBS)" || $(INSTALL) -m 644 $(TARGET_LIBS) $(DESTDIR)$(libdir)
62         $(INSTALL) -d $(DESTDIR)$(includedir)
63         $(INSTALL) -m 644 ptb.h $(DESTDIR)$(includedir)
64         $(INSTALL) -m 644 gp.h $(DESTDIR)$(includedir)
65         $(INSTALL) -d $(DESTDIR)$(pkgconfigdir)
66         $(INSTALL) -m 644 ptabtools.pc $(DESTDIR)$(pkgconfigdir)
67         $(INSTALL) -d $(DESTDIR)$(datadir)
68         $(INSTALL) -m 644 ptbxml2musicxml.xsl $(DESTDIR)$(datadir)
69         $(INSTALL) -m 644 ptbxml.dtd $(DESTDIR)$(datadir)
70
71 test: all ptb2ptb
72         $(MAKE) -C tests
73
74 tags: $(wildcard *.c) $(wildcard *.h)
75         ctags *.c *.h
76
77 check:: tests/check
78         ./tests/check
79
80 configure: configure.in
81         autoreconf -f
82
83 config.status: configure
84         ./configure
85
86 Makefile.settings: config.status
87         ./config.status
88
89 clean: 
90         rm -f *.o core $(TARGETS) *.po
91         rm -f tests/check tests/*.o
92
93 distclean: clean
94         rm -f Makefile.settings config.h config.log
95         rm -f *~ ptabtools.spec ptabtools.pc
96         rm -f tags config.status aclocal.m4
97         rm -rf autom4te.cache/ 
98
99 realclean: distclean
100         rm -f configure
101
102 ctags:
103         ctags -R .