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