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